Skip to content

Commit

Permalink
tweak(ban-tpl): reset the input dialog after close
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed May 7, 2024
1 parent 9bbb528 commit 7fdc11c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
- [x] "Search by Player IDs" filter on players page is overflowing
- [x] history action modal needs py-1 because of the reason field outline
- [x] remove all "blur" as that is slow as hell for browsers with hw acceleration disabled
- [x] make the new page searches case insensitive (history->reason and maybe more)
- [ ] ctrl+f doesn't work in the player modal anymore, if on the player or history pages
- criar um estado "any modal open" pra desabilitar todos hotkeys das páginas?
- [ ] make the new page searches case insensitive (history->reason and maybe more)

## Highlights
- [x] pre-configured ban/warn reasons with new perm to lock admins to only use them?
Expand Down
11 changes: 11 additions & 0 deletions panel/src/pages/BanTemplates/BanTemplatesInputDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ export default function BanTemplatesInputDialog({
const [selectedDuration, setSelectedDuration] = useState(initialSelectedDuration);
const [customUnits, setCustomUnits] = useState(initialCustomUnits);

useEffect(() => {
const timeout = setTimeout(() => {
if (isDialogOpen) return;
setSelectedDuration(initialSelectedDuration);
setCustomUnits(initialCustomUnits);
if (reasonRef.current) reasonRef.current.textArea.value = '';
if (customMultiplierRef.current) customMultiplierRef.current.value = '';
}, 500);
return () => clearTimeout(timeout);
}, [isDialogOpen]);

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const form = e.currentTarget;
Expand Down

0 comments on commit 7fdc11c

Please sign in to comment.