App shell

The frame of every admin screen: rail, top bar, bell, company switch, account menu.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/app-shell.json
Buka layar penuh

When to use

  • Once, in the signed-in layout. Every admin and HR screen renders inside it; screens only fill the content slot.
  • The role decides the rail items (admin: Ringkasan · Karyawan · Organisasi · Cuti · Gaji · Akses + Pengaturan · Bantuan).

When not to use

  • Sign-in and invite pages → no shell, the page gradient only.
  • A screen that needs its own frame (a full-screen import wizard) → still inside the shell; never a second rail.

Built from

Usage

The screen is the page content only. Put it inside AppShell (once, in your layout) and pass your data.

page.tsx
import { AppShell } from "@/components/mahr/app-shell"export default function SignedInLayout({ children }: { children: React.ReactNode }) {  const { me, company, companies, notifications, pendingLeave } = useSession() // your data layer  const [overlay, setOverlay] = useState<ShellOverlay | null>(null)  return (    <AppShell      role={me.role}      activeItem={activeItemFromPath()}      company={company}      user={me}      unreadCount={notifications.unread}      leaveCount={pendingLeave}      notifications={{ items: notifications.items, onMarkAllRead, onSeeAll: () => router.push("/notifikasi") }}      companies={{ items: companies, currentId: company.id, onSwitch: switchCompany, onAdd: () => router.push("/perusahaan/baru") }}      account={{ subtitle: `${me.roleLabel} · ${company.name}`, onSelect: handleAccountMenu }}      openOverlay={overlay}      onOpenOverlayChange={setOverlay}      linkRender={<Link href="" />}    >      {children}    </AppShell>  )}

Installation

Adds the screen, its parts and its types. The components it uses come with it (registry dependencies).

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/app-shell.json

API

import { AppShell } from "@/components/mahr/app-shell"
PropTypeDefaultDescription
role · activeItem"admin" | "hr" | "manager" | "employee" · RailItemId–The role sets the rail items; screens never add or reorder items.
company · user{ name; logoUrl? } · { name; avatarUrl? }–Top-bar pill and avatar.
unreadCount · leaveCountnumber · number–Red dot on the bell · count badge on Cuti (admin, hr).
notifications{ items: ShellNotification[]; onOpen?; onMarkAllRead?; onSeeAll? }–Bell popover, 400 wide. Unread = 600 title + primary dot.
companies{ items: ShellCompany[]; currentId; onSwitch?; onAdd? }–Company switcher menu, 320 wide. Admin and hr only; the current company says "Sedang dipakai".
account{ subtitle; onSelect?("profil" | "kata-sandi" | "bantuan" | "keluar") }–Account menu, 260 wide; Keluar in danger text.
openOverlay · onOpenOverlayChange"notifications" | "company" | "account" | null–Optional control; one overlay at a time.
linkRender · logoReactElement · ReactNode–Router link for the rail; the 40 px logo.