From 2278ec1848a309a7f2569cef0d313cff6099dddf Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 27 Apr 2024 23:21:56 +0700 Subject: [PATCH] error dialog --- app/components/ErrorDialog.tsx | 34 +++++++++++++++++++++++++++ app/components/TransitionDialogue.tsx | 29 ++++++++++++++++------- app/components/index.tsx | 2 ++ app/pages/PageEnigma/PageEnigma.tsx | 2 ++ app/pages/PageEnigma/store/error.ts | 13 ++++++++++ app/pages/PageEnigma/store/index.ts | 1 + 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 app/components/ErrorDialog.tsx create mode 100644 app/pages/PageEnigma/store/error.ts diff --git a/app/components/ErrorDialog.tsx b/app/components/ErrorDialog.tsx new file mode 100644 index 0000000000..01cba3238e --- /dev/null +++ b/app/components/ErrorDialog.tsx @@ -0,0 +1,34 @@ +import { Button, TransitionDialogue } from "~/components"; +import { + showErrorDialog, + errorDialogMessage, + errorDialogTitle, +} from "~/pages/PageEnigma/store"; +import { useSignals } from "@preact/signals-react/runtime"; +import { faTriangleExclamation } from "@fortawesome/pro-solid-svg-icons"; + +export function ErrorDialog() { + useSignals(); + + return ( + (showErrorDialog.value = false)} + showClose={false}> +
+ {errorDialogMessage.value} +
+ +
+
+
+ ); +} diff --git a/app/components/TransitionDialogue.tsx b/app/components/TransitionDialogue.tsx index 2f2784e509..3ba1772062 100644 --- a/app/components/TransitionDialogue.tsx +++ b/app/components/TransitionDialogue.tsx @@ -44,15 +44,19 @@ export const TransitionDialogue = ({ width, children, childPadding = true, + titleIconClassName, + showClose = true, }: { isOpen: boolean; title?: ReactNode; titleIcon?: IconDefinition; + titleIconClassName?: string; onClose: () => void; className?: string; width?: number; children: ReactNode; childPadding?: boolean; + showClose?: boolean; }) => { return ( @@ -81,16 +85,25 @@ export const TransitionDialogue = ({ as="div" className="mb-5 flex justify-between p-5 pb-0 text-xl font-bold text-white">
- {titleIcon && } + {titleIcon && ( + + )} {title}
- - - + {showClose && ( + + + + )} )}
diff --git a/app/components/index.tsx b/app/components/index.tsx index c187db65bf..fc87629c1a 100644 --- a/app/components/index.tsx +++ b/app/components/index.tsx @@ -21,6 +21,7 @@ import { import { Pill } from "./Pill"; import { WaveformPlayer } from "./WaveformPlayer"; import UploadModal from "./UploadModal"; +import { ErrorDialog } from "./ErrorDialog"; export { Button, @@ -28,6 +29,7 @@ export { ButtonIcon, ButtonLink, ButtonIconSelect, + ErrorDialog, FileWrapper, H1, H2, diff --git a/app/pages/PageEnigma/PageEnigma.tsx b/app/pages/PageEnigma/PageEnigma.tsx index bfc707c39c..e9c94d494c 100644 --- a/app/pages/PageEnigma/PageEnigma.tsx +++ b/app/pages/PageEnigma/PageEnigma.tsx @@ -5,6 +5,7 @@ import { EngineProvider } from "~/contexts/EngineProvider"; import { useInferenceJobManager } from "~/hooks"; import { LoadingBar } from "~/components"; import { MyMovies } from "~/pages/PageEnigma/comps/MyMovies/MyMovies"; +import { ErrorDialog } from "~/components/ErrorDialog"; export const PageEnigma = () => { useInferenceJobManager(); @@ -14,6 +15,7 @@ export const PageEnigma = () => { +