Skip to content

Commit

Permalink
UI: small fix: hide form after submitting (#981)
Browse files Browse the repository at this point in the history
* UI: small fix: hide form after submitting
  • Loading branch information
DimaAmega authored Feb 7, 2024
1 parent e8720df commit 0ccbcf8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/evidently/ui/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
content="Evidently - ML Monitoring Demo. Hosted example to monitor the performance of a demand forecasting model on a toy dataset."
/>
<title>Evidently - ML Monitoring Demo</title>
<script type="module" crossorigin src="/static/js/index-60d52bdf.js"></script>
<script type="module" crossorigin src="/static/js/index-4e1be776.js"></script>
<link rel="modulepreload" crossorigin href="/static/js/vendor-19847e6d.js">
<link rel="stylesheet" href="/static/css/index.css">
</head>
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/evidently/ui/ui/static/js/index-e131f011.js

This file was deleted.

1 change: 1 addition & 0 deletions src/evidently/ui/ui/static/js/index-ec143eac.js

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions ui/packages/evidently-ui-lib/src/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,23 @@ export const AddNewProjectButton = ({
children?: React.ReactNode
}) => {
const [on, toggle] = useToggle(false)
const [wasSubmitting, toggleSubmitting] = useToggle(false)
const navigation = useNavigation()
const isDisabled = navigation.state !== 'idle'

useEffect(() => {
if (navigation.state === 'submitting') {
toggleSubmitting(true)
}
}, [navigation.state === 'submitting'])

useEffect(() => {
if (wasSubmitting && navigation.state === 'idle') {
toggle(false)
toggleSubmitting(false)
}
}, [wasSubmitting, navigation.state === 'idle'])

return (
<Box py={2}>
<Box display={'flex'} justifyContent={'center'}>
Expand All @@ -231,7 +245,7 @@ export const AddNewProjectButton = ({
</Tooltip>
</Box>

<Fade in={on} unmountOnExit>
{on && (
<Box py={1} display={'flex'} flexDirection={'column'} rowGap={1}>
{children}
<EditProjectInfoForm
Expand All @@ -240,7 +254,7 @@ export const AddNewProjectButton = ({
action="create-new-project"
/>
</Box>
</Fade>
)}
</Box>
)
}

0 comments on commit 0ccbcf8

Please sign in to comment.