Skip to content

Commit

Permalink
🐛 fix bugs in LanguageSettings page
Browse files Browse the repository at this point in the history
  • Loading branch information
anuejn committed Oct 11, 2023
1 parent 4a84457 commit 6d1b7f3
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions app/src/pages/LanguageSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,23 @@ function ModelTable({
isDefault={null}
action={
<Tooltip content={`downloading model ${Math.round(model.progress * 100)}%`}>
<HoverSwitcher
onClick={() => dispatch(cancelDownload(model.task_uuid))}
hoverChild={<IconButton icon={StopIcon} />}
defaultChild={
<Button appearance={'minimal'} padding={0}>
<Circle
style={{ height: majorScale(3) }}
percent={model.progress * 100}
strokeWidth={50}
trailWidth={0}
strokeLinecap={'butt'}
/>
</Button>
}
/>
<Pane>
<HoverSwitcher
onClick={() => dispatch(cancelDownload(model.task_uuid))}
hoverChild={<IconButton icon={StopIcon} />}
defaultChild={
<Button appearance={'minimal'} padding={0}>
<Circle
style={{ height: majorScale(3) }}
percent={model.progress * 100}
strokeWidth={50}
trailWidth={0}
strokeLinecap={'butt'}
/>
</Button>
}
/>
</Pane>
</Tooltip>
}
key={model.model_id}
Expand Down Expand Up @@ -221,19 +223,19 @@ function HoverSwitcher({
hoverChild: JSX.Element;
defaultChild: JSX.Element;
}): JSX.Element {
const [shownChild, setShownChild] = useState(defaultChild);
const [hover, setHover] = useState(false);

return (
<Pane
{...switcherProps}
onMouseLeave={() => {
setShownChild(defaultChild);
setHover(false);
}}
onMouseOver={() => {
setShownChild(hoverChild);
setHover(true);
}}
>
{shownChild}
{hover ? hoverChild : defaultChild}
</Pane>
);
}
Expand Down

0 comments on commit 6d1b7f3

Please sign in to comment.