From 8235f516e9edb3a8639d471f9a2f68fe24010587 Mon Sep 17 00:00:00 2001 From: Juan Di Toro Date: Fri, 29 Mar 2024 00:37:41 +0100 Subject: [PATCH] feat: add verification bannner --- app/components/general-layout.tsx | 146 +++++++++++++++--------------- app/data/auth-provider.ts | 2 + app/root.tsx | 2 +- 3 files changed, 77 insertions(+), 73 deletions(-) diff --git a/app/components/general-layout.tsx b/app/components/general-layout.tsx index 58b8928..d615027 100644 --- a/app/components/general-layout.tsx +++ b/app/components/general-layout.tsx @@ -2,7 +2,7 @@ import { Button } from "~/components/ui/button"; import logoPng from "~/images/lume-logo.png?url"; import lumeColorLogoPng from "~/images/lume-color-logo.png?url"; import discordLogoPng from "~/images/discord-logo.png?url"; -import { Form, Link, useLocation } from "@remix-run/react"; +import { Link, useLocation } from "@remix-run/react"; import { Dialog, DialogContent, @@ -46,18 +46,22 @@ import { TooltipProvider, } from "./ui/tooltip"; import filesize from "./lib/filesize"; -import { z } from "zod"; -import { getFormProps, useForm, useInputControl } from "@conform-to/react"; -import { getZodConstraint, parseWithZod } from "@conform-to/zod"; import { ErrorList } from "./forms"; export const GeneralLayout = ({ children }: React.PropsWithChildren) => { const location = useLocation(); const { data: identity } = useGetIdentity(); const { mutate: logout } = useLogout(); + return ( -
+ {!identity?.verified ? ( +
+ We have sent you a verification email. Please click on the link in the + email to start using the platform. +
+ ) : null} +
Lume logo @@ -201,77 +205,73 @@ const UploadFileForm = () => { Upload Files - {!hasStarted ? ( -
- - -

Drag & Drop Files or Browse

-
- ) : null} - -
- {getFiles().map((file) => ( - { - removeFile(id); - }} - failedState={getFailedState(file.id)} - /> - ))} + {!hasStarted ? ( +
+ + +

Drag & Drop Files or Browse

+ ) : null} - +
+ {getFiles().map((file) => ( + { + removeFile(id); + }} + failedState={getFailedState(file.id)} + /> + ))} +
- {hasStarted && !hasErrored ? ( -
- - {isCompleted - ? "Upload completed" - : `${getFiles().length} files being uploaded`} -
- ) : null} + - {isUploading ? ( - - - - ) : null} + {hasStarted && !hasErrored ? ( +
+ + {isCompleted + ? "Upload completed" + : `${getFiles().length} files being uploaded`} +
+ ) : null} - {isCompleted ? ( - - - - ) : null} - - {!hasStarted && !isCompleted && !isUploading ? ( - - ) : null} + + ) : null} + + {isCompleted ? ( + + + + ) : null} + + {!hasStarted && !isCompleted && !isUploading ? ( + + ) : null} ); }; @@ -285,7 +285,7 @@ const UploadFileItem = ({ failedState?: FailedUppyFile, Record>; onRemove: (id: string) => void; }) => { - console.log({file: file.progress}) + console.log({ file: file.progress }); return (
) : null} - {file.progress?.preprocess ?

Processing...

: null} + {file.progress?.preprocess ? ( +

Processing...

+ ) : null} {file.progress?.uploadStarted && !file.progress.uploadComplete ? ( ) : null} diff --git a/app/data/auth-provider.ts b/app/data/auth-provider.ts index fd2ea5e..9a6e932 100644 --- a/app/data/auth-provider.ts +++ b/app/data/auth-provider.ts @@ -31,6 +31,7 @@ export type Identity = { firstName: string; lastName: string; email: string; + verified: boolean; } export interface UpdatePasswordFormRequest extends UpdatePasswordFormTypes { @@ -197,6 +198,7 @@ export const createPortalAuthProvider = (sdk: Sdk): AuthProvider => { firstName: acct.first_name, lastName: acct.last_name, email: acct.email, + verified: acct.verified, }; }, }; diff --git a/app/root.tsx b/app/root.tsx index c1cb184..54e2ba3 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -32,7 +32,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - + {children}