diff --git a/app/layouts/shell.tsx b/app/layouts/shell.tsx index eb0c85d..5ec00be 100644 --- a/app/layouts/shell.tsx +++ b/app/layouts/shell.tsx @@ -1,5 +1,7 @@ -import { Outlet, redirect } from "react-router"; +import { Form, Outlet, redirect } from "react-router"; +import Button from "~/components/Button"; +import Card from "~/components/Card"; import Footer from "~/components/Footer"; import Header from "~/components/Header"; import { Capabilities } from "~/server/web/roles"; @@ -25,10 +27,6 @@ export async function loader({ request, context }: Route.LoaderArgs) { const api = context.hsApi.getRuntimeClient(apiKey); const check = context.auth.can(principal, Capabilities.ui_access); - if (!check && principal.kind === "oidc" && !request.url.endsWith("/onboarding")) { - throw new Error("You do not have permission to access the UI"); - } - const user = principal.kind === "oidc" ? { @@ -55,6 +53,7 @@ export async function loader({ request, context }: Route.LoaderArgs) { settings: context.auth.can(principal, Capabilities.read_feature), }, onboarding: request.url.endsWith("/onboarding"), + pendingApproval: !check && principal.kind === "oidc", healthy: await api.isHealthy(), }; } catch { @@ -67,6 +66,34 @@ export async function loader({ request, context }: Route.LoaderArgs) { } export default function Shell({ loaderData }: Route.ComponentProps) { + if (loaderData.pendingApproval && !loaderData.onboarding) { + return ( + <> +
+
+
+ + Pending Approval + + Your account has been created but you don't have access to the UI yet. An + administrator needs to assign you a role before you can continue. + + + If you believe this is a mistake, please contact your administrator. + +
+ +
+
+
+
+