Skip to content

Commit

Permalink
feat(progress tracks): Added a checkbox to reset track progress when …
Browse files Browse the repository at this point in the history
…changing the difficulty of a progress track
  • Loading branch information
scottbenton committed Nov 25, 2023
1 parent f934eb4 commit baf0123
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Redesigned stats and tracks sections on mobile
- Redesigned moves and oracles to make each section collapsible
- Added bond tracks, experience, and legacy tracks to the character cards on the GM screen
- Added a checkbox to reset track progress when changing the difficulty of a progress track

### Accessibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import {
Alert,
AlertTitle,
Button,
Checkbox,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
FormControlLabel,
MenuItem,
Stack,
TextField,
Expand Down Expand Up @@ -47,6 +49,7 @@ export function EditOrCreateTrackDialog(props: EditOrCreateTrackDialogProps) {
const [difficulty, setDifficulty] = useState<DIFFICULTY | undefined>(
initialTrack?.difficulty
);
const [resetProgress, setResetProgress] = useState(false);

const handleDialogClose = () => {
setTitle("");
Expand Down Expand Up @@ -74,7 +77,7 @@ export function EditOrCreateTrackDialog(props: EditOrCreateTrackDialogProps) {
label: title,
description,
difficulty: difficulty,
value: initialTrack?.value ?? 0,
value: initialTrack && !resetProgress ? initialTrack.value : 0,
};

setLoading(true);
Expand Down Expand Up @@ -132,6 +135,18 @@ export function EditOrCreateTrackDialog(props: EditOrCreateTrackDialogProps) {
<MenuItem value={DIFFICULTY.EXTREME}>Extreme</MenuItem>
<MenuItem value={DIFFICULTY.EPIC}>Epic</MenuItem>
</TextField>
{initialTrack && initialTrack.difficulty !== difficulty && (
<FormControlLabel
control={
<Checkbox
checked={resetProgress}
onChange={(evt, value) => setResetProgress(value)}
/>
}
label={"Reset Track Progress"}
sx={{ textTransform: "capitalize", marginRight: 3 }}
/>
)}
</Stack>
</DialogContent>
<DialogActions>
Expand Down

0 comments on commit baf0123

Please sign in to comment.