NORY-36: add error page for unauthorised users
This commit is contained in:
parent
9f497ce99d
commit
66775a001e
10 changed files with 54 additions and 35 deletions
37
dashboard/src/app/(inside)/layout.tsx
Normal file
37
dashboard/src/app/(inside)/layout.tsx
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import '../globals.css';
|
||||||
|
import { Toaster } from '@/components/ui/sonner';
|
||||||
|
import React from 'react';
|
||||||
|
import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
|
||||||
|
import { AppSidebar } from '@/components/app-sidebar';
|
||||||
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList } from '@/components/ui/breadcrumb';
|
||||||
|
|
||||||
|
export default function InsideLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||||
|
return (
|
||||||
|
<SidebarProvider className="max-h-screen min-h-screen">
|
||||||
|
<AppSidebar className="mx-1"/>
|
||||||
|
<SidebarInset className="overflow-hidden p-6 space-y-6">
|
||||||
|
<header className="flex h-4 items-center gap-2">
|
||||||
|
<SidebarTrigger className="-ml-1 p-1"/>
|
||||||
|
<Separator orientation="vertical" className="mr-2 h-4"/>
|
||||||
|
{
|
||||||
|
// TODO: implement dynamic Breadcrumbs
|
||||||
|
}
|
||||||
|
<Breadcrumb>
|
||||||
|
<BreadcrumbList>
|
||||||
|
<BreadcrumbItem className="hidden md:block">
|
||||||
|
<BreadcrumbLink href="/">
|
||||||
|
Ory Dashboard
|
||||||
|
</BreadcrumbLink>
|
||||||
|
</BreadcrumbItem>
|
||||||
|
</BreadcrumbList>
|
||||||
|
</Breadcrumb>
|
||||||
|
</header>
|
||||||
|
<div className="flex-1 overflow-scroll">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</SidebarInset>
|
||||||
|
<Toaster/>
|
||||||
|
</SidebarProvider>
|
||||||
|
);
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import { DataTable } from '@/components/ui/data-table';
|
||||||
import { CircleCheck, CircleX, Copy, MoreHorizontal, Trash, UserCheck, UserMinus, UserPen, UserX } from 'lucide-react';
|
import { CircleCheck, CircleX, Copy, MoreHorizontal, Trash, UserCheck, UserMinus, UserPen, UserX } from 'lucide-react';
|
||||||
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card';
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { FetchIdentityPageProps } from '@/app/user/page';
|
import { FetchIdentityPageProps } from '@/app/(inside)/user/page';
|
||||||
import { Spinner } from '@/components/ui/spinner';
|
import { Spinner } from '@/components/ui/spinner';
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
|
@ -29,7 +29,7 @@ import {
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from '@/components/ui/alert-dialog';
|
} from '@/components/ui/alert-dialog';
|
||||||
import { blockIdentity, deleteIdentity, deleteIdentitySessions, unblockIdentity } from '@/app/user/action';
|
import { blockIdentity, deleteIdentity, deleteIdentitySessions, unblockIdentity } from '@/app/(inside)/user/action';
|
||||||
|
|
||||||
interface IdentityDataTableProps {
|
interface IdentityDataTableProps {
|
||||||
data: Identity[];
|
data: Identity[];
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { IdentityDataTable } from '@/app/user/data-table';
|
import { IdentityDataTable } from '@/app/(inside)/user/data-table';
|
||||||
import { getIdentityApi } from '@/ory/sdk/server';
|
import { getIdentityApi } from '@/ory/sdk/server';
|
||||||
import { SearchInput } from '@/components/search-input';
|
import { SearchInput } from '@/components/search-input';
|
||||||
|
|
11
dashboard/src/app/(outside)/unauthorised/page.tsx
Normal file
11
dashboard/src/app/(outside)/unauthorised/page.tsx
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { ErrorDisplay } from '@/components/error';
|
||||||
|
|
||||||
|
export default async function UnauthorizedPage() {
|
||||||
|
return (
|
||||||
|
<div className="bg-background min-h-screen p-16">
|
||||||
|
<ErrorDisplay
|
||||||
|
title="Unauthorised"
|
||||||
|
message="You are unauthorised to access this application!"/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -2,13 +2,8 @@ import type { Viewport } from 'next';
|
||||||
import { Inter } from 'next/font/google';
|
import { Inter } from 'next/font/google';
|
||||||
import './globals.css';
|
import './globals.css';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { Toaster } from '@/components/ui/sonner';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ThemeProvider } from 'next-themes';
|
import { ThemeProvider } from 'next-themes';
|
||||||
import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
|
|
||||||
import { AppSidebar } from '@/components/app-sidebar';
|
|
||||||
import { Separator } from '@/components/ui/separator';
|
|
||||||
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList } from '@/components/ui/breadcrumb';
|
|
||||||
|
|
||||||
const inter = Inter({ subsets: ['latin'] });
|
const inter = Inter({ subsets: ['latin'] });
|
||||||
|
|
||||||
|
@ -56,31 +51,7 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
|
||||||
enableSystem
|
enableSystem
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
<SidebarProvider className="max-h-screen min-h-screen">
|
{children}
|
||||||
<AppSidebar className="mx-1"/>
|
|
||||||
<SidebarInset className="overflow-hidden p-6 space-y-6">
|
|
||||||
<header className="flex h-4 items-center gap-2">
|
|
||||||
<SidebarTrigger className="-ml-1 p-1"/>
|
|
||||||
<Separator orientation="vertical" className="mr-2 h-4"/>
|
|
||||||
{
|
|
||||||
// TODO: implement dynamic Breadcrumbs
|
|
||||||
}
|
|
||||||
<Breadcrumb>
|
|
||||||
<BreadcrumbList>
|
|
||||||
<BreadcrumbItem className="hidden md:block">
|
|
||||||
<BreadcrumbLink href="/">
|
|
||||||
Ory Dashboard
|
|
||||||
</BreadcrumbLink>
|
|
||||||
</BreadcrumbItem>
|
|
||||||
</BreadcrumbList>
|
|
||||||
</Breadcrumb>
|
|
||||||
</header>
|
|
||||||
<div className="flex-1 overflow-scroll">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</SidebarInset>
|
|
||||||
<Toaster/>
|
|
||||||
</SidebarProvider>
|
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -5,9 +5,9 @@ interface ErrorDisplayProps {
|
||||||
|
|
||||||
export async function ErrorDisplay({ title, message }: ErrorDisplayProps) {
|
export async function ErrorDisplay({ title, message }: ErrorDisplayProps) {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<>
|
||||||
<p className="text-3xl font-bold leading-tight tracking-tight">{title}</p>
|
<p className="text-3xl font-bold leading-tight tracking-tight">{title}</p>
|
||||||
<p className="text-lg font-light">{message}</p>
|
<p className="text-lg font-light">{message}</p>
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue