Skip to content

Commit

Permalink
eslint + add description above server tag row
Browse files Browse the repository at this point in the history
  • Loading branch information
Ithanil committed Apr 26, 2024
1 parent f58abd9 commit 24ae4e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ export default function RoomSettings() {
/>
{(process.env.SERVER_TAG_NAMES !== '') && (
<ServerTagRow
updateMutation={updateMutationWrapper}
currentTag={roomSetting?.data?.serverTag}
tagRequired={roomSetting?.data?.serverTagRequired === 'true'}
allowedTags={currentUser?.allowedTags}
updateMutation={updateMutationWrapper}
description="Select a specialized server type for this room"
/>
)}
</Col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

import React from 'react';
import PropTypes from 'prop-types';
import { Row, Col, Dropdown, ButtonGroup, ToggleButton } from 'react-bootstrap';
import {
Row, Col, Dropdown, ButtonGroup, ToggleButton
} from 'react-bootstrap';
import SimpleSelect from '../../../shared_components/utilities/SimpleSelect';

export default function ServerTagRow({
currentTag, tagRequired, allowedTags, updateMutation: useUpdateAPI,
updateMutation: useUpdateAPI, currentTag, tagRequired, allowedTags, description,
}) {
const updateAPI = useUpdateAPI();

Expand Down Expand Up @@ -54,6 +56,7 @@ export default function ServerTagRow({

return (
<Row>
<h6 className="text-brand">{description}</h6>
<Col>
<SimpleSelect defaultValue={getTagName(currentTag)}>
{[
Expand All @@ -73,11 +76,10 @@ export default function ServerTagRow({
key="desired"
id="desired"
type="radio"
variant='outline-success'
variant="outline-success"
name="radio"
checked={tagRequired === false}
onChange={(event) => {
console.log(event);
updateAPI.mutate({ settingName: 'serverTagRequired', settingValue: false });
}}
>
Expand All @@ -87,11 +89,10 @@ export default function ServerTagRow({
key="required"
id="required"
type="radio"
variant='outline-danger'
variant="outline-danger"
name="radio"
checked={tagRequired === true}
onChange={(event) => {
console.log(event);
updateAPI.mutate({ settingName: 'serverTagRequired', settingValue: true });
}}
>
Expand All @@ -109,8 +110,9 @@ ServerTagRow.defaultProps = {
};

ServerTagRow.propTypes = {
updateMutation: PropTypes.func.isRequired,
currentTag: PropTypes.string,
tagRequired: PropTypes.bool,
allowedTags: PropTypes.arrayOf(PropTypes.string).isRequired,
updateMutation: PropTypes.func.isRequired,
description: PropTypes.string.isRequired,
};

0 comments on commit 24ae4e7

Please sign in to comment.