Skip to content

Commit

Permalink
UI fixes (#13030)
Browse files Browse the repository at this point in the history
* Fix difficulty overwriting export name

* Fix NaN for score selector
  • Loading branch information
NickM-27 authored Aug 13, 2024
1 parent b0d42ea commit 1b876bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
14 changes: 9 additions & 5 deletions web/src/components/card/ExportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ export default function ExportCard({

const [editName, setEditName] = useState<{
original: string;
update: string;
update?: string;
}>();

const submitRename = useCallback(() => {
if (editName == undefined) {
return;
}

onRename(exportedRecording.id, editName.update);
onRename(exportedRecording.id, editName.update ?? "");
setEditName(undefined);
}, [editName, exportedRecording, onRename, setEditName]);

Expand All @@ -64,7 +64,7 @@ export default function ExportCard({
modifiers.down &&
!modifiers.repeat &&
editName &&
editName.update.length > 0
(editName.update?.length ?? 0) > 0
) {
submitRename();
}
Expand Down Expand Up @@ -92,7 +92,11 @@ export default function ExportCard({
className="mt-3"
type="search"
placeholder={editName?.original}
value={editName?.update || editName?.original}
value={
editName?.update == undefined
? editName?.original
: editName?.update
}
onChange={(e) =>
setEditName({
original: editName.original ?? "",
Expand Down Expand Up @@ -159,7 +163,7 @@ export default function ExportCard({
onClick={() =>
setEditName({
original: exportedRecording.name,
update: "",
update: undefined,
})
}
>
Expand Down
32 changes: 20 additions & 12 deletions web/src/pages/SubmitPlus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,16 @@ function PlusFilterGroup({
className="w-12"
inputMode="numeric"
value={Math.round((currentScoreRange?.at(0) ?? 0.5) * 100)}
onChange={(e) =>
setCurrentScoreRange([
parseInt(e.target.value) / 100.0,
currentScoreRange?.at(1) ?? 1.0,
])
}
onChange={(e) => {
const value = e.target.value;

if (value) {
setCurrentScoreRange([
parseInt(value) / 100.0,
currentScoreRange?.at(1) ?? 1.0,
]);
}
}}
/>
<DualThumbSlider
className="w-full"
Expand All @@ -513,12 +517,16 @@ function PlusFilterGroup({
className="w-12"
inputMode="numeric"
value={Math.round((currentScoreRange?.at(1) ?? 1.0) * 100)}
onChange={(e) =>
setCurrentScoreRange([
currentScoreRange?.at(0) ?? 0.5,
parseInt(e.target.value) / 100.0,
])
}
onChange={(e) => {
const value = e.target.value;

if (value) {
setCurrentScoreRange([
currentScoreRange?.at(0) ?? 0.5,
parseInt(value) / 100.0,
]);
}
}}
/>
</div>
<DropdownMenuSeparator />
Expand Down

0 comments on commit 1b876bf

Please sign in to comment.