Files
sass-mohfarawati/app/[locale]/(site)/layout.tsx
T
moh 6c213699a2 ADDED - Replace site header menu with macOS menu bar and Magic UI dock
Swap the pill navigation for a macOS-style dock as the primary nav and a
slim top menu bar for utilities:

- components/ui/dock.tsx: Magic UI Dock/DockIcon (magnification via
  useSpring/useTransform), ported to the project's framer-motion.
- components/layout/site-dock.tsx: bottom dock with the logo as the first
  icon, each item a real next/link (SEO preserved, active state from the
  pathname), monochrome squircle tiles, hover tooltips and a "soon" badge
  for Products; top menu bar keeps locale/sound/theme/admin + a live clock.
- (site)/layout.tsx: render SiteDock instead of SiteHeader.

Home bento grid and all page content are unchanged.
2026-09-20 18:56:46 +02:00

64 lines
2.3 KiB
TypeScript

import type { ReactNode } from "react";
import { unstable_noStore as noStore } from "next/cache";
import { getLocale } from "next-intl/server";
import { redirect } from "next/navigation";
import { SiteAmbientBackdrop } from "@/components/layout/site-ambient-backdrop";
import { SiteDock } from "@/components/layout/site-dock";
import { SiteFooter } from "@/components/layout/site-footer";
import { ScrollSmootherProvider } from "@/components/scroll-smoother-provider";
import { isSuperAdmin } from "@/lib/admin-auth";
import { getMaintenanceMode, getSiteSettings, getSiteSettingsMediaBindings } from "@/lib/app-config";
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
type SiteLayoutProps = {
children: ReactNode;
params: Promise<{
locale: string;
}>;
};
export const dynamic = "force-dynamic";
export const revalidate = 0;
export default async function SiteLayout({ children, params }: SiteLayoutProps) {
noStore();
await params;
const [maintenanceEnabled, mediaBindings, siteSettings] = await Promise.all([
getMaintenanceMode(),
getSiteSettingsMediaBindings(),
getSiteSettings(),
]);
const localeKey = resolveLocale(await getLocale().catch(() => siteSettings.defaultLocale), siteSettings.defaultLocale);
// Server-side decision only. The header receives just this boolean and uses
// it purely to show/hide the Admin shortcut link — it grants no access by
// itself. Every admin page/action re-checks the session independently, so
// this value is not a security boundary, only a UI convenience.
const authenticated = await isSuperAdmin();
if (maintenanceEnabled && !authenticated) {
redirect(getLocalizedPath(localeKey, "/coming-soon", siteSettings.defaultLocale));
}
return (
<>
<ScrollSmootherProvider />
<SiteAmbientBackdrop />
<SiteDock
lightLogoUrl={mediaBindings.siteLogoLight?.url}
darkLogoUrl={mediaBindings.siteLogoDark?.url}
defaultLocale={siteSettings.defaultLocale}
isSuperAdmin={authenticated}
/>
<div id="smooth-wrapper">
<div id="smooth-content">
<div className="site-content-frame flex min-h-screen flex-col">
<main className="flex-1">{children}</main>
<SiteFooter defaultLocale={siteSettings.defaultLocale} />
</div>
</div>
</div>
</>
);
}