Skip to content

Commit

Permalink
Merge pull request #193 from elmadev/mod-edit-replay
Browse files Browse the repository at this point in the history
feat(replays): Allow mods to edit replay tags and DrivenBy
  • Loading branch information
sunehs authored Feb 5, 2024
2 parents dc53ab1 + 3b00790 commit e238048
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/pages/replay/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { MergeContainer } from 'components/RecListItem';
import useMediaQuery from '@material-ui/core/useMediaQuery';
import { Row, Column } from 'components/Containers';
import { pts } from 'utils/cups';
import { mod } from 'utils/nick';

const getLink = replay => {
let link = '';
Expand Down Expand Up @@ -299,29 +300,33 @@ const Replay = ({ ReplayUuid, RecFileName }) => {
/>
</AccordionDetails>
</Accordion>
{userid === `${replay.UploadedBy}` && type === 'replay' && (
{(userid === `${replay.UploadedBy}` || mod() === 1) && type === 'replay' && (
<Accordion>
<AccordionSummary expandIcon={<ExpandMore />}>
<Header h3>Edit replay</Header>
</AccordionSummary>
<AccordionDetails style={{ flexDirection: 'column' }}>
<TextField
name="Comment"
value={edit.Comment}
onChange={value => setEdit({ field: 'Comment', value })}
/>
{userid === `${replay.UploadedBy}` && (
<TextField
name="Comment"
value={edit.Comment}
onChange={value => setEdit({ field: 'Comment', value })}
/>
)}
<TextField
name="Driven by"
value={edit.DrivenBy}
onChange={value => setEdit({ field: 'DrivenBy', value })}
/>
<FieldBoolean
label="Unlisted"
value={edit.Unlisted}
onChange={() =>
setEdit({ field: 'Unlisted', value: 1 - edit.Unlisted })
}
/>
{userid === `${replay.UploadedBy}` && (
<FieldBoolean
label="Unlisted"
value={edit.Unlisted}
onChange={() =>
setEdit({ field: 'Unlisted', value: 1 - edit.Unlisted })
}
/>
)}
<Box padding={2}>
<Typography color="textSecondary">Tags</Typography>
{tagOptions.map(option => {
Expand Down

0 comments on commit e238048

Please sign in to comment.