import { AppShell, AuthProvider, DefaultSidebar, SidebarGroup, SidebarItem, SidebarLayout, useAuth, } from "@tailor-platform/app-shell"; import { useQuery } from "urql"; import { UserProfileMenu } from "@/components/composed/user-profile-menu"; import { graphql } from "@/graphql"; import { authClient } from "./lib/auth-client"; import { GraphQLProvider } from "./providers/graphql-provider"; const MeStatusQuery = graphql(` query MeStatus { me { status } } `); const AuthGuard = () => { const { login } = useAuth(); return ( Sign in required Continue with your Tailor account to access this app. { void login(); }} className="inline-flex h-9 w-full items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90" > Sign in ); }; const ActiveUserGuard = ({ children }: { children: React.ReactNode }) => { const { logout } = useAuth(); const [{ data, fetching }] = useQuery({ query: MeStatusQuery }); if (fetching) return null; if (data?.me?.status !== "ACTIVE") { return ( Account deactivated Your account has been deactivated. Please contact an administrator. void logout()} className="inline-flex h-9 w-full items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90" > Sign out ); } return <>{children}>; }; const App = () => { return ( }> } /> ); }; export default App;
Continue with your Tailor account to access this app.
Your account has been deactivated. Please contact an administrator.