move to sub layouts

This commit is contained in:
Nate Kelley 2025-08-15 17:32:04 -06:00
parent a13aa3e831
commit b3909ae837
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
36 changed files with 543 additions and 503 deletions

View File

@ -20,7 +20,7 @@ export const useGetDashboardVersionNumber = (
// Get the dashboard_version_number query param from the route
const paramVersionNumber = useSearch({
from: '/app/dashboards/$dashboardId',
from: '/app/_app/dashboards/$dashboardId',
select: stableVersionSearchSelector,
});

View File

@ -20,7 +20,7 @@ export const useGetMetricVersionNumber = (
// Get the metric_version_number query param from the route
const paramVersionNumber = useSearch({
from: '/app/metrics/$metricId',
from: '/app/_app/metrics/$metricId',
select: stableVersionSearchSelector,
});

View File

@ -19,7 +19,7 @@ export const useGetReportVersionNumber = (
});
const paramVersionNumber = useSearch({
from: '/app/reports/$reportId',
from: '/app/_app/reports/$reportId',
select: stableVersionSearchSelector,
});

View File

@ -39,10 +39,8 @@ import { Sidebar } from '@/components/ui/sidebar/Sidebar';
import { Tooltip } from '@/components/ui/tooltip/Tooltip';
import { useContactSupportModalStore, useInviteModalStore } from '@/context/BusterAppLayout';
import { toggleContactSupportModal } from '@/context/BusterAppLayout/useContactSupportModalStore';
import { toggleInviteModal } from '@/context/BusterAppLayout/useInviteModalStore';
import { cn } from '@/lib/classMerge';
import { Route as AppHomeRoute } from '@/routes/app.home';
import { Route as AppSettingsRoute } from '@/routes/app.settings.profile';
import { toggleInviteModal } from '../../../context/BusterAppLayout/useInviteModalStore';
import { ASSET_ICONS } from '../icons/assetIcons';
// import { InvitePeopleModal } from '../modal/InvitePeopleModal';
// import { SupportModal } from '../modal/SupportModal';
@ -215,19 +213,19 @@ const SidebarPrimaryHeader: React.FC<{ hideActions?: boolean }> = ({ hideActions
return (
<div className={cn(COLLAPSED_JUSTIFY_CENTER, 'flex min-h-7 items-center')}>
<Link to={AppHomeRoute.to}>
<Link to={'/app/home'}>
<BusterLogoWithText className={COLLAPSED_HIDDEN} />
<BusterLogo className={COLLAPSED_VISIBLE} />
</Link>
{!hideActions && (
<div className={cn(COLLAPSED_HIDDEN, 'items-center gap-2')}>
<Tooltip title="Settings">
<Link to={AppSettingsRoute.to}>
<Link to={'/app/settings/profile'}>
<Button prefix={<Gear />} variant="ghost" />
</Link>
</Tooltip>
<Tooltip title="Start a chat" shortcuts={['C']}>
<Link to={AppHomeRoute.to}>
<Link to={'/app/home'}>
<Button size="tall" rounding={'large'} prefix={<PencilSquareIcon />} />
</Link>
</Tooltip>

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ const searchParamsSchema = z.object({
});
export const Route = createFileRoute(
'/app/chats/$chatId/dashboards/$dashboardId/metrics/$metricId'
'/app/_app/chats/$chatId/dashboards/$dashboardId/metrics/$metricId'
)({
validateSearch: searchParamsSchema,
component: RouteComponent,

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
dashboard_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/chats/$chatId/dashboards/$dashboardId')({
export const Route = createFileRoute('/app/_app/chats/$chatId/dashboards/$dashboardId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute, Link } from '@tanstack/react-router';
export const Route = createFileRoute('/app/chats/$chatId/')({
export const Route = createFileRoute('/app/_app/chats/$chatId/')({
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
metric_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/chats/$chatId/metrics/$metricId')({
export const Route = createFileRoute('/app/_app/chats/$chatId/metrics/$metricId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -6,7 +6,7 @@ const searchParamsSchema = z.object({
metric_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/chats/$chatId/report/$reportId/metrics/$metricId')({
export const Route = createFileRoute('/app/_app/chats/$chatId/report/$reportId/metrics/$metricId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
report_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/chats/$chatId/report/$reportId')({
export const Route = createFileRoute('/app/_app/chats/$chatId/report/$reportId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/chats/')({
export const Route = createFileRoute('/app/_app/chats/')({
component: RouteComponent,
});

View File

@ -7,7 +7,7 @@ const searchParamsSchema = z.object({
});
export const Route = createFileRoute(
'/app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId/metrics/$metricId'
'/app/_app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId/metrics/$metricId'
)({
validateSearch: searchParamsSchema,
component: RouteComponent,

View File

@ -6,7 +6,7 @@ const searchParamsSchema = z.object({
});
export const Route = createFileRoute(
'/app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId'
'/app/_app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId'
)({
validateSearch: searchParamsSchema,
component: RouteComponent,

View File

@ -6,7 +6,7 @@ const searchParamsSchema = z.object({
});
export const Route = createFileRoute(
'/app/collections/$collectionId/chats/$chatId/metrics/$metricId'
'/app/_app/collections/$collectionId/chats/$chatId/metrics/$metricId'
)({
validateSearch: searchParamsSchema,
component: RouteComponent,

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/collections/$collectionId/chats/$chatId')({
export const Route = createFileRoute('/app/_app/collections/$collectionId/chats/$chatId')({
component: RouteComponent,
});

View File

@ -7,7 +7,7 @@ const searchParamsSchema = z.object({
});
export const Route = createFileRoute(
'/app/collections/$collectionId/dashboard/$dashboardId/metrics/$metricId'
'/app/_app/collections/$collectionId/dashboard/$dashboardId/metrics/$metricId'
)({
validateSearch: searchParamsSchema,
component: RouteComponent,

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
dashboard_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/collections/$collectionId/dashboard/$dashboardId')({
export const Route = createFileRoute('/app/_app/collections/$collectionId/dashboard/$dashboardId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
metric_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/collections/$collectionId/metrics/$metricId')({
export const Route = createFileRoute('/app/_app/collections/$collectionId/metrics/$metricId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/collections/$collectionId')({
export const Route = createFileRoute('/app/_app/collections/$collectionId')({
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/collections/')({
export const Route = createFileRoute('/app/_app/collections/')({
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
dashboard_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/dashboards/$dashboardId')({
export const Route = createFileRoute('/app/_app/dashboards/$dashboardId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/dashboards/')({
export const Route = createFileRoute('/app/_app/dashboards/')({
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/datasets/$datasetId')({
export const Route = createFileRoute('/app/_app/datasets/$datasetId')({
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/datasets/')({
export const Route = createFileRoute('/app/_app/datasets/')({
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ import { useAppSplitterContext } from '../components/ui/layouts/AppSplitter';
const layoutId = 'primary-layout';
export const Route = createFileRoute('/app/home')({
export const Route = createFileRoute('/app/_app/home')({
component: RouteComponent,
loader: async () => {
const initialLayout = await getAppLayout({ data: { id: layoutId, preservedSide: 'right' } });

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/logs/')({
export const Route = createFileRoute('/app/_app/logs/')({
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
metric_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/metrics/$metricId')({
export const Route = createFileRoute('/app/_app/metrics/$metricId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/metrics/')({
export const Route = createFileRoute('/app/_app/metrics/')({
component: RouteComponent,
});

View File

@ -5,7 +5,7 @@ const searchParamsSchema = z.object({
report_version_number: z.coerce.number().optional(),
});
export const Route = createFileRoute('/app/reports/$reportId')({
export const Route = createFileRoute('/app/_app/reports/$reportId')({
validateSearch: searchParamsSchema,
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/reports/')({
export const Route = createFileRoute('/app/_app/reports/')({
component: RouteComponent,
});

View File

@ -0,0 +1,14 @@
import { createFileRoute, Outlet } from '@tanstack/react-router';
import { PrimaryAppLayout } from '@/layouts/PrimaryAppLayout';
import { Route as AppRoute } from '@/routes/app';
export const Route = createFileRoute('/app/_app')({
component: () => {
const { initialLayout } = AppRoute.useLoaderData();
return (
<PrimaryAppLayout initialLayout={initialLayout}>
<Outlet />
</PrimaryAppLayout>
);
},
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/settings/datasources')({
export const Route = createFileRoute('/app/_settings/settings/datasources')({
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/settings/profile')({
export const Route = createFileRoute('/app/_settings/settings/profile')({
component: RouteComponent,
});

View File

@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/app/settings/users')({
export const Route = createFileRoute('/app/_settings/settings/users')({
component: RouteComponent,
});

View File

@ -3,7 +3,7 @@ import { prefetchGetUserFavorites } from '@/api/buster_rest/users/favorites/quer
import { prefetchGetMyUserInfo } from '@/api/buster_rest/users/queryRequests';
import { getAppLayout } from '@/api/server-functions/getAppLayout';
import { AppProviders } from '@/context/Providers';
import { PRIMARY_APP_LAYOUT_ID, PrimaryAppLayout } from '@/layouts/PrimaryAppLayout';
import { PRIMARY_APP_LAYOUT_ID } from '@/layouts/PrimaryAppLayout';
export const Route = createFileRoute('/app')({
beforeLoad: async ({ context, location }) => {
@ -31,13 +31,9 @@ export const Route = createFileRoute('/app')({
};
},
component: () => {
const { initialLayout } = Route.useLoaderData();
return (
<AppProviders>
<PrimaryAppLayout initialLayout={initialLayout}>
<Outlet />
</PrimaryAppLayout>
<Outlet />
</AppProviders>
);
},