Overview page

A page of sections on the grey page surface: figures across the top, a main section, and a 320 px column beside it.

Screen

The live layout, built only from the library's exports on made-up records. It is a page of its own in the frame, so it lays out, scrolls and opens its panels as it would in an app.

View full screen

What to try

  • The stat cards share a row and a height, so their figures line up whatever their titles.
  • Narrow the window: below 1280 px the side column drops under the main section, and the cards go two to a row.
  • Each section has its own heading. The page's one h1 is its title.

Source

Each file as written. Copy the screen's own file first; the shell and the sample data are shared by every screen.

OverviewPage.tsx

import { CalendarClock, History } from "lucide-react";
import {
  Avatar,
  Badge,
  Card,
  List,
  ListItem,
  ScrollArea,
  SectionHeader,
  StatCard,
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
  Truncate,
} from "@leap-crm/design-system";
import { AppShell } from "./AppShell";
import { records, stats, statuses, upcoming } from "./fixtures";

const recent = records.slice(0, 5);

/**
 * A page of sections on the grey page surface, laid out as the CRM's
 * dashboard is: the whole page scrolls, 24 px in from the window's edges
 * (56 px on a wide one), with 20 px between its parts. The figures run across
 * the top; under them the main section takes the room and a 320 px column
 * sits beside it, dropping underneath below 1280 px.
 */
function OverviewPage() {
  return (
    <AppShell page="Overview" unread={3}>
      <ScrollArea className="bg-neutral-surface-subtle min-h-0 flex-1">
        <div className="flex flex-col gap-5 px-6 pt-6 pb-6 lg:px-14 lg:pt-7 lg:pb-8">
          <header className="flex flex-col gap-1">
            <h1 className="text-heading font-book text-neutral-text m-0">
              Overview
            </h1>
            <p className="text-neutral-text-secondary m-0 text-base">
              Records across the team this month.
            </p>
          </header>

          <div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
            {stats.map(stat => (
              <StatCard
                key={stat.id}
                title={stat.title}
                value={stat.value}
                trend={stat.trend}
              />
            ))}
          </div>

          <div className="grid items-start gap-5 xl:grid-cols-[minmax(0,1fr)_20rem] xl:gap-8">
            <section className="flex min-w-0 flex-col gap-3">
              <SectionHeader
                level={2}
                icon={<History />}
                title="Recently updated"
                subtitle="The five records changed most recently."
              />
              <ScrollArea
                horizontal
                aria-label="Recently updated"
                className="-m-px"
              >
                <Table className="min-w-160">
                  <TableHeader>
                    <TableRow>
                      <TableHead>Name</TableHead>
                      <TableHead>Status</TableHead>
                      <TableHead>Owner</TableHead>
                      <TableHead>Last updated</TableHead>
                    </TableRow>
                  </TableHeader>
                  <TableBody>
                    {recent.map(record => (
                      <TableRow key={record.id}>
                        <TableCell className="max-w-72">
                          <Truncate>{record.name}</Truncate>
                        </TableCell>
                        <TableCell>
                          <Badge size="sm" tone={statuses[record.status].tone}>
                            {statuses[record.status].label}
                          </Badge>
                        </TableCell>
                        <TableCell>
                          <span className="flex items-center gap-2 whitespace-nowrap">
                            <Avatar
                              size="xs"
                              person="staff"
                              name={record.owner.name}
                              initials={record.owner.initials}
                            />
                            {record.owner.name}
                          </span>
                        </TableCell>
                        <TableCell className="text-neutral-text-secondary whitespace-nowrap">
                          {record.updated}
                        </TableCell>
                      </TableRow>
                    ))}
                  </TableBody>
                </Table>
              </ScrollArea>
            </section>

            <section className="flex min-w-0 flex-col gap-3">
              <SectionHeader
                level={2}
                icon={<CalendarClock />}
                title="Coming up"
                subtitle="Due in the next four weeks."
              />
              <Card className="py-1">
                <List dividers aria-label="Coming up">
                  {upcoming.map(item => (
                    <ListItem
                      key={item.id}
                      primary={item.title}
                      secondary={item.detail}
                      trailing={item.when}
                    />
                  ))}
                </List>
              </Card>
            </section>
          </div>
        </div>
      </ScrollArea>
    </AppShell>
  );
}

export { OverviewPage };

AppShell.tsx

import {
  Bell,
  ChartLine,
  LayoutDashboard,
  Plus,
  Search,
  Table2,
} from "lucide-react";
import type { ReactNode } from "react";
import {
  AppHeader,
  Avatar,
  HeaderIconButton,
  HeaderNavLink,
} from "@leap-crm/design-system";
import { me } from "./fixtures";

const pages = [
  { label: "Overview", icon: <LayoutDashboard /> },
  { label: "Records", icon: <Table2 /> },
  { label: "Reports", icon: <ChartLine /> },
] as const;

type PageName = (typeof pages)[number]["label"];

/**
 * The frame every page of the app sits in, as the CRM lays it out: the 48 px
 * navy header across the top, and one page under it that fills the rest of
 * the window and owns its own scrolling. There is no side menu and no page
 * chrome between the header and the page.
 *
 * The header holds the main pages on the left and, on the right, New, Search,
 * Notifications and the person signed in. New things are made from the header,
 * so a page's own toolbar carries no "New" button.
 *
 * In an app, pass your router's link to each HeaderNavLink's `render`.
 */
function AppShell({
  page,
  unread = 0,
  onNew,
  creating = false,
  children,
}: {
  /** The page you're on, marked in the header. Leave it out on a page the header doesn't list, like Settings. */
  page?: PageName;
  /** Unread notifications, on the bell. */
  unread?: number;
  /** Runs when New is pressed. */
  onNew?: () => void;
  /** Whether what New opens is open now. */
  creating?: boolean;
  children: ReactNode;
}) {
  return (
    <div className="bg-neutral-surface flex h-dvh flex-col overflow-hidden">
      <AppHeader
        nav={pages.map(item => (
          <HeaderNavLink
            key={item.label}
            href="#"
            icon={item.icon}
            active={item.label === page}
            onClick={event => event.preventDefault()}
          >
            {item.label}
          </HeaderNavLink>
        ))}
        actions={
          <>
            <HeaderIconButton
              icon={<Plus />}
              aria-label="New record"
              open={creating}
              onClick={onNew}
            />
            <HeaderIconButton icon={<Search />} aria-label="Search" />
            <HeaderIconButton
              icon={<Bell />}
              aria-label="Notifications"
              count={unread}
            />
            <Avatar
              size="lg"
              person="staff"
              name={me.name}
              initials={me.initials}
            />
          </>
        }
      />
      <main className="flex min-h-0 flex-1 flex-col overflow-hidden">
        {children}
      </main>
    </div>
  );
}

export { AppShell };
export type { PageName };

fixtures.ts

// Sample data for the example screens: plainly made-up records, so a screen
// reads as a layout to copy and never as one of the CRM's own pages.

type Person = { id: string; name: string; initials: string };

const people = [
  { id: "ah", name: "Ada Hartley", initials: "AH" },
  { id: "bo", name: "Ben Okafor", initials: "BO" },
  { id: "cm", name: "Chloe Moreau", initials: "CM" },
] as const satisfies Person[];

/** The person signed in: "Mine" lists their records. */
const me: Person = people[0];

const statuses = {
  active: { label: "Active", tone: "success" },
  review: { label: "In review", tone: "warning" },
  closed: { label: "Closed", tone: "default" },
} as const;

type StatusId = keyof typeof statuses;

const categories = ["Agreement", "Report", "Request", "Template"] as const;

type Category = (typeof categories)[number];

type SampleRecord = {
  id: string;
  name: string;
  category: Category;
  status: StatusId;
  owner: Person;
  /** Who to write to about it, when someone is named. */
  email: string | null;
  /** An ISO date. */
  due: string | null;
  created: string;
  updated: string;
};

const [ada, ben, chloe] = people;

const records: SampleRecord[] = [
  {
    id: "r-1042",
    name: "Supplier agreement renewal",
    category: "Agreement",
    status: "active",
    owner: ada,
    email: "accounts@northwind.example",
    due: "2026-12-11",
    created: "3 Nov 2026",
    updated: "2 hours ago",
  },
  {
    id: "r-1041",
    name: "Quarterly activity report",
    category: "Report",
    status: "review",
    owner: ben,
    email: null,
    due: "2026-12-01",
    created: "2 Nov 2026",
    updated: "Yesterday",
  },
  {
    id: "r-1040",
    name: "Access request for the shared archive and its historical exports",
    category: "Request",
    status: "active",
    owner: chloe,
    email: "it@harbourside.example",
    due: null,
    created: "30 Oct 2026",
    updated: "Yesterday",
  },
  {
    id: "r-1039",
    name: "Onboarding checklist",
    category: "Template",
    status: "closed",
    owner: ada,
    email: null,
    due: null,
    created: "28 Oct 2026",
    updated: "3 days ago",
  },
  {
    id: "r-1038",
    name: "Office lease variation",
    category: "Agreement",
    status: "review",
    owner: ben,
    email: "leasing@quayside.example",
    due: "2026-12-18",
    created: "24 Oct 2026",
    updated: "4 days ago",
  },
  {
    id: "r-1037",
    name: "Annual compliance summary",
    category: "Report",
    status: "active",
    owner: ada,
    email: null,
    due: "2027-01-15",
    created: "21 Oct 2026",
    updated: "5 days ago",
  },
  {
    id: "r-1036",
    name: "Equipment purchase request",
    category: "Request",
    status: "closed",
    owner: chloe,
    email: "orders@fieldworks.example",
    due: null,
    created: "17 Oct 2026",
    updated: "1 week ago",
  },
  {
    id: "r-1035",
    name: "Welcome letter",
    category: "Template",
    status: "active",
    owner: ben,
    email: null,
    due: null,
    created: "14 Oct 2026",
    updated: "1 week ago",
  },
  {
    id: "r-1034",
    name: "Service agreement",
    category: "Agreement",
    status: "closed",
    owner: chloe,
    email: "hello@brightline.example",
    due: null,
    created: "9 Oct 2026",
    updated: "2 weeks ago",
  },
  {
    id: "r-1033",
    name: "Monthly usage report",
    category: "Report",
    status: "active",
    owner: ada,
    email: null,
    due: "2026-12-04",
    created: "6 Oct 2026",
    updated: "2 weeks ago",
  },
];

type ActivityKind = "created" | "status" | "note" | "owner";

/** What happened to a record, newest first. */
const activity: {
  id: string;
  kind: ActivityKind;
  what: string;
  who: string;
  when: string;
}[] = [
  {
    id: "a4",
    kind: "note",
    what: "Note added",
    who: "Ada Hartley",
    when: "2 hours ago",
  },
  {
    id: "a3",
    kind: "status",
    what: "Status changed to Active",
    who: "Ben Okafor",
    when: "Yesterday",
  },
  {
    id: "a2",
    kind: "owner",
    what: "Owner changed to Ada Hartley",
    who: "Chloe Moreau",
    when: "5 Nov 2026",
  },
  {
    id: "a1",
    kind: "created",
    what: "Record created",
    who: "Chloe Moreau",
    when: "3 Nov 2026",
  },
];

/** The figures on the overview page, with twelve weeks of history each. */
const stats = [
  {
    id: "open",
    title: "Open records",
    value: "128",
    trend: [96, 101, 99, 107, 111, 108, 115, 118, 116, 122, 125, 128],
  },
  {
    id: "new",
    title: "New this month",
    value: "34",
    trend: [18, 22, 19, 25, 21, 27, 24, 30, 26, 29, 31, 34],
  },
  {
    id: "closed",
    title: "Closed this month",
    value: "21",
    trend: [12, 15, 11, 16, 18, 14, 19, 17, 20, 18, 22, 21],
  },
  {
    id: "days",
    title: "Average days to close",
    value: "9",
    trend: [14, 13, 13, 12, 12, 11, 12, 10, 11, 10, 9, 9],
  },
] as const;

const upcoming = [
  {
    id: "u1",
    title: "Quarterly activity report",
    detail: "Due for review",
    when: "Tue 1 Dec",
  },
  { id: "u2", title: "Monthly usage report", detail: "Due", when: "Fri 4 Dec" },
  {
    id: "u3",
    title: "Supplier agreement renewal",
    detail: "Due",
    when: "Fri 11 Dec",
  },
  {
    id: "u4",
    title: "Office lease variation",
    detail: "Due for review",
    when: "Fri 18 Dec",
  },
] as const;

/** Today, as the screens see it: fixed, so every capture shows the same dates. */
const today = "2026-11-24";

const dateFormat = new Intl.DateTimeFormat("en-AU", {
  day: "numeric",
  month: "short",
  year: "numeric",
});

/** An ISO date as people read it, like "11 Dec 2026". */
const formatDate = (iso: string) =>
  dateFormat.format(new Date(`${iso}T00:00:00`));

export {
  activity,
  categories,
  formatDate,
  me,
  people,
  records,
  stats,
  statuses,
  today,
  upcoming,
};
export type { ActivityKind, Category, Person, SampleRecord, StatusId };