From 1d97c5c01499b352db8f4c0a29fc3756c198edec Mon Sep 17 00:00:00 2001 From: Sau1707 <83017316+Sau1707@users.noreply.github.com> Date: Thu, 3 Dec 2026 22:50:38 +0100 Subject: [PATCH] fix(web): stabilize sidebar spacing and loading layouts --- web/src/components/api.tsx | 5 +- web/src/components/layouts/content.tsx | 28 +- web/src/components/layouts/loading.tsx | 60 +++++ web/src/components/layouts/platform.tsx | 4 + .../components/ui/organization-switcher.tsx | 12 +- web/src/components/ui/utils.tsx | 2 +- web/src/platform/layouts/authenticated.tsx | 5 +- web/src/platform/layouts/loading.tsx | 81 ++++++ .../platform/layouts/organization-access.tsx | 34 ++- web/src/platform/layouts/organization.tsx | 134 +++++++--- web/src/platform/root.tsx | 12 +- web/src/solution/root.tsx | 6 +- web/tests/components/api-boundary.test.tsx | 48 ++++ .../platform/layouts/authenticated.test.tsx | 4 + .../layouts/organization-access.test.tsx | 137 +++++++++- web/tests/platform/root.test.tsx | 239 +++++++++++++++++- 16 files changed, 736 insertions(+), 75 deletions(-) create mode 100644 web/src/components/layouts/loading.tsx create mode 100644 web/src/platform/layouts/loading.tsx diff --git a/web/src/components/api.tsx b/web/src/components/api.tsx index 68aae33b3..2de5ba641 100644 --- a/web/src/components/api.tsx +++ b/web/src/components/api.tsx @@ -1,9 +1,10 @@ import { useLocation } from 'react-router'; +import { PageError } from '@/components/ui/utils'; import { Toaster } from '@/components/shadcn/sonner'; import { createQueryRuntime } from '@/lib/react-query'; +import { ViewLoading } from '@/components/layouts/loading'; import { ApiErrorContext, useApiError } from '@/lib/errors'; import { Button } from '@/components/longlink/action/button'; -import { PageError, PageLoading } from '@/components/ui/utils'; import { ErrorBoundary, type FallbackProps } from 'react-error-boundary'; import { Suspense, useEffect, useId, useState, type ReactNode } from 'react'; import { createNotifications, NotificationContext } from '@/lib/notifications'; @@ -41,7 +42,7 @@ export function ApiProvider({ children, platformSession }: { children: ReactNode /** Shares loading and recoverable errors, resetting failed reads on retry or navigation. */ export function ApiBoundary({ children, - fallback = , + fallback = , fallbackRender }: { children: ReactNode; diff --git a/web/src/components/layouts/content.tsx b/web/src/components/layouts/content.tsx index e3d5867b3..c561da31b 100644 --- a/web/src/components/layouts/content.tsx +++ b/web/src/components/layouts/content.tsx @@ -1,7 +1,16 @@ +import { cn } from 'cn'; import type { ReactNode } from 'react'; /** Pins the card surface to the viewport while its content scrolls with the document. */ -export default function Content({ children, toolbar }: { children: ReactNode; toolbar?: ReactNode }) { +export default function Content({ + children, + toolbar, + flushStart = false +}: { + children: ReactNode; + toolbar?: ReactNode; + flushStart?: boolean; +}) { return (