-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove modal navigation from router transactions * cache gathered paths * remove sidebar mode * data flow updates * core updates * filtering updates * e2e updates * update selection test * bugs and details * toast work * integrating, boxes input * boxes * rm lightning tests * disable default query performance * toast updates * fix options logic * label tags update * fix e2e
- Loading branch information
1 parent
36faaac
commit 866c8c6
Showing
80 changed files
with
1,106 additions
and
1,498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
app/packages/app/src/components/QueryPerformanceToast.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { Toast } from "@fiftyone/components"; | ||
import { QP_MODE } from "@fiftyone/core"; | ||
import { getBrowserStorageEffectForKey } from "@fiftyone/state"; | ||
import { Box, Button, Typography } from "@material-ui/core"; | ||
import { Bolt } from "@mui/icons-material"; | ||
import React, { useEffect, useState } from "react"; | ||
import { createPortal } from "react-dom"; | ||
import { atom, useRecoilState } from "recoil"; | ||
|
||
const SHOWN_FOR = 10000; | ||
|
||
const hideQueryPerformanceToast = atom({ | ||
key: "hideQueryPerformanceToast", | ||
default: false, | ||
effects: [ | ||
getBrowserStorageEffectForKey("hideQueryPerformanceToast", { | ||
valueClass: "boolean", | ||
}), | ||
], | ||
}); | ||
|
||
const QueryPerformanceToast = () => { | ||
const [shown, setShown] = useState(false); | ||
const [disabled, setDisabled] = useRecoilState(hideQueryPerformanceToast); | ||
const element = document.getElementById("queryPerformance"); | ||
|
||
useEffect(() => { | ||
const listen = () => { | ||
setShown(true); | ||
}; | ||
window.addEventListener("queryperformance", listen); | ||
return () => window.removeEventListener("queryperformance", listen); | ||
}, []); | ||
|
||
if (!element) { | ||
throw new Error("no query performance element"); | ||
} | ||
|
||
if (!shown || disabled) { | ||
return null; | ||
} | ||
|
||
return createPortal( | ||
<Toast | ||
duration={SHOWN_FOR} | ||
primary={(setOpen) => { | ||
return ( | ||
<Button | ||
variant="contained" | ||
size="small" | ||
onClick={() => { | ||
open(QP_MODE, "_blank")?.focus(); | ||
setOpen(false); | ||
}} | ||
style={{ marginLeft: "auto" }} // Right align the button | ||
> | ||
View Documentation | ||
</Button> | ||
); | ||
}} | ||
secondary={(setOpen) => { | ||
return ( | ||
<div> | ||
<Button | ||
variant="text" | ||
color="secondary" | ||
size="small" | ||
onClick={() => { | ||
setDisabled(true); | ||
setOpen(false); | ||
}} | ||
style={{ marginLeft: "auto" }} // Right align the button | ||
> | ||
Don't show me again | ||
</Button> | ||
</div> | ||
); | ||
}} | ||
message={ | ||
<> | ||
<Box sx={{ display: "flex", alignItems: "center" }}> | ||
<Bolt sx={{ color: "#f5b700", marginRight: "8px" }} /> | ||
<Typography | ||
variant="subtitle1" | ||
sx={{ fontWeight: 500, marginRight: "8px" }} | ||
> | ||
Query Performance is Available! | ||
</Typography> | ||
<Typography | ||
variant="caption" | ||
sx={{ | ||
color: "#fff", | ||
borderRadius: "2px", | ||
padding: "2px 4px", | ||
fontWeight: 600, | ||
}} | ||
> | ||
NEW | ||
</Typography> | ||
</Box> | ||
<br /> | ||
<Typography variant="body2" sx={{ color: "#757575" }}> | ||
Index the most critical fields for faster data loading and query | ||
performance. | ||
</Typography> | ||
</> | ||
} | ||
/>, | ||
element | ||
); | ||
}; | ||
|
||
export default QueryPerformanceToast; |
20 changes: 3 additions & 17 deletions
20
app/packages/app/src/pages/__generated__/IndexPageQuery.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.