Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
255d39a2d7
commit
4715dcc4f7
@@ -10,6 +10,7 @@
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as SetupRouteImport } from './routes/setup'
|
||||
import { Route as SettingsRouteImport } from './routes/settings'
|
||||
import { Route as LoginRouteImport } from './routes/login'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ClientsIndexRouteImport } from './routes/clients.index'
|
||||
@@ -24,6 +25,11 @@ const SetupRoute = SetupRouteImport.update({
|
||||
path: '/setup',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SettingsRoute = SettingsRouteImport.update({
|
||||
id: '/settings',
|
||||
path: '/settings',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const LoginRoute = LoginRouteImport.update({
|
||||
id: '/login',
|
||||
path: '/login',
|
||||
@@ -68,6 +74,7 @@ const AdminUsersRoute = AdminUsersRouteImport.update({
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/settings': typeof SettingsRoute
|
||||
'/setup': typeof SetupRoute
|
||||
'/admin/users': typeof AdminUsersRoute
|
||||
'/cases/$caseId': typeof CasesCaseIdRoute
|
||||
@@ -79,6 +86,7 @@ export interface FileRoutesByFullPath {
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/settings': typeof SettingsRoute
|
||||
'/setup': typeof SetupRoute
|
||||
'/admin/users': typeof AdminUsersRoute
|
||||
'/cases/$caseId': typeof CasesCaseIdRoute
|
||||
@@ -91,6 +99,7 @@ export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/settings': typeof SettingsRoute
|
||||
'/setup': typeof SetupRoute
|
||||
'/admin/users': typeof AdminUsersRoute
|
||||
'/cases/$caseId': typeof CasesCaseIdRoute
|
||||
@@ -104,6 +113,7 @@ export interface FileRouteTypes {
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/login'
|
||||
| '/settings'
|
||||
| '/setup'
|
||||
| '/admin/users'
|
||||
| '/cases/$caseId'
|
||||
@@ -115,6 +125,7 @@ export interface FileRouteTypes {
|
||||
to:
|
||||
| '/'
|
||||
| '/login'
|
||||
| '/settings'
|
||||
| '/setup'
|
||||
| '/admin/users'
|
||||
| '/cases/$caseId'
|
||||
@@ -126,6 +137,7 @@ export interface FileRouteTypes {
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/login'
|
||||
| '/settings'
|
||||
| '/setup'
|
||||
| '/admin/users'
|
||||
| '/cases/$caseId'
|
||||
@@ -138,6 +150,7 @@ export interface FileRouteTypes {
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
LoginRoute: typeof LoginRoute
|
||||
SettingsRoute: typeof SettingsRoute
|
||||
SetupRoute: typeof SetupRoute
|
||||
AdminUsersRoute: typeof AdminUsersRoute
|
||||
CasesCaseIdRoute: typeof CasesCaseIdRoute
|
||||
@@ -156,6 +169,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof SetupRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/settings': {
|
||||
id: '/settings'
|
||||
path: '/settings'
|
||||
fullPath: '/settings'
|
||||
preLoaderRoute: typeof SettingsRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/login': {
|
||||
id: '/login'
|
||||
path: '/login'
|
||||
@@ -218,6 +238,7 @@ declare module '@tanstack/react-router' {
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
LoginRoute: LoginRoute,
|
||||
SettingsRoute: SettingsRoute,
|
||||
SetupRoute: SetupRoute,
|
||||
AdminUsersRoute: AdminUsersRoute,
|
||||
CasesCaseIdRoute: CasesCaseIdRoute,
|
||||
@@ -229,3 +250,12 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
|
||||
import type { getRouter } from './router.tsx'
|
||||
import type { createStart } from '@tanstack/react-start'
|
||||
declare module '@tanstack/react-start' {
|
||||
interface Register {
|
||||
ssr: true
|
||||
router: Awaited<ReturnType<typeof getRouter>>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { createFileRoute, Link, useLocation } from "@tanstack/react-router";
|
||||
import { ProtectedLayout } from "@/components/protected-layout";
|
||||
import { PageContainer, PageHeader } from "@/components/app-shell";
|
||||
import { Outlet } from "@tanstack/react-router";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const Route = createFileRoute("/settings")({
|
||||
component: SettingsLayout,
|
||||
});
|
||||
|
||||
const TABS = [
|
||||
{ to: "/settings", label: "Company", exact: true },
|
||||
{ to: "/settings/fees", label: "Fee schedule" },
|
||||
];
|
||||
|
||||
function SettingsLayout() {
|
||||
const location = useLocation();
|
||||
return (
|
||||
<ProtectedLayout adminOnly>
|
||||
<PageContainer>
|
||||
<PageHeader
|
||||
title="Settings"
|
||||
description="Configure firm-wide information and billing defaults."
|
||||
/>
|
||||
<div className="flex gap-1 border-b mb-6">
|
||||
{TABS.map((t) => {
|
||||
const active = t.exact
|
||||
? location.pathname === t.to
|
||||
: location.pathname.startsWith(t.to);
|
||||
return (
|
||||
<Link
|
||||
key={t.to}
|
||||
to={t.to}
|
||||
className={cn(
|
||||
"px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",
|
||||
active
|
||||
? "border-primary text-foreground"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Outlet />
|
||||
</PageContainer>
|
||||
</ProtectedLayout>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user