From 32be0de6743f3ccf24b9b916555da71c73431669 Mon Sep 17 00:00:00 2001 From: potts99 Date: Tue, 26 Mar 2024 00:27:00 +0000 Subject: [PATCH] client portal tomfoolery --- apps/api/src/controllers/auth.ts | 1 + apps/client/layouts/newLayout.tsx | 19 +- apps/client/layouts/portalLayout.tsx | 4 +- apps/client/pages/portal/index.tsx | 88 ++++--- apps/client/pages/portal/new.tsx | 331 ++++++++++++++++++++++++++- 5 files changed, 383 insertions(+), 60 deletions(-) diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts index 6f6a7ed54..4c11f7e13 100644 --- a/apps/api/src/controllers/auth.ts +++ b/apps/api/src/controllers/auth.ts @@ -527,6 +527,7 @@ export function authRoutes(fastify: FastifyInstance) { sso_status: config!.sso_active, version: config!.client_version, notifcations, + external_user: user!.external_user, }; reply.send({ diff --git a/apps/client/layouts/newLayout.tsx b/apps/client/layouts/newLayout.tsx index 74833a56d..744d313c7 100644 --- a/apps/client/layouts/newLayout.tsx +++ b/apps/client/layouts/newLayout.tsx @@ -334,6 +334,10 @@ export default function NewLayout({ children }: any) { alert("You do not have the correct perms for that action."); } + if (user && user.external_user) { + location.push("/portal"); + } + const navigation = [ { name: t("create_ticket"), @@ -437,14 +441,6 @@ export default function NewLayout({ children }: any) { await fetchUserProfile(); } - // useEffect(() => { - // getQueues(); - // }, [user]); - - // useEffect(() => { - // getQueues(); - // }, [user]) - function handleKeyPress(event: any) { const pathname = location.pathname; console.log(pathname); @@ -493,7 +489,8 @@ export default function NewLayout({ children }: any) { }, [handleKeyPress, location]); return ( - !loading && ( + !loading && + user && (
-
{children}
+ {!loading && !user.external_user && ( +
{children}
+ )} ) diff --git a/apps/client/layouts/portalLayout.tsx b/apps/client/layouts/portalLayout.tsx index 9a6c0f75b..865904ed7 100644 --- a/apps/client/layouts/portalLayout.tsx +++ b/apps/client/layouts/portalLayout.tsx @@ -494,7 +494,7 @@ export default function PortalLayout({ children }: any) { leaveTo="transform opacity-0 scale-95" > - + {/* {({ active }) => ( )} - + */} {({ active }) => (