A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
feat(web): share one page header across dashboard pages
Amruth Pillai83927f070f58
diff --git a/apps/web/src/components/layout/page-header.tsx b/apps/web/src/components/layout/page-header.tsxnew file mode 100644index 000000000..dd6661ae8--- /dev/null+++ b/apps/web/src/components/layout/page-header.tsx@@ -0,0 +1,30 @@+import type { ReactNode } from "react";++type PageHeaderProps = {+ title: ReactNode;+ /** One line under the title. */+ description?: ReactNode;+ /** A small back link above the title. */+ back?: ReactNode;+ /** Buttons on the right of the title row. */+ actions?: ReactNode;+ /** The toolbar row under the title: navigation or view tabs first, then search, filters and sort. */+ children?: ReactNode;+};++/** The one header every dashboard page uses. Renders as siblings, so the page's own gap spaces the rows. */+export function PageHeader({ title, description, back, actions, children }: PageHeaderProps) {+ return (+ <>+ <header className="flex flex-wrap items-center justify-between gap-3">+ <div className="grid min-w-0 gap-1">+ {back && <div className="mb-2">{back}</div>}+ <h1 className="font-display text-[30px] leading-9 font-medium">{title}</h1>+ {description && <p className="text-sm text-ink-2">{description}</p>}+ </div>+ {actions && <div className="flex items-center gap-2">{actions}</div>}+ </header>+ {children && <div className="flex flex-wrap items-center gap-3">{children}</div>}+ </>+ );+}diff --git a/apps/web/src/features/documents/documents-page.tsx b/apps/web/src/features/documents/documents-page.tsxindex 50ecfebce..8471a89ed 100644--- a/apps/web/src/features/documents/documents-page.tsx+++ b/apps/web/src/features/documents/documents-page.tsx@@ -27,6 +27,7 @@ import { DocumentCard, DocumentRow } from "./document-card";import { collectTags, filterDocuments } from "./filter";import { LibraryError } from "./library-error";import { useStartDocument } from "./new-document-dialog";+import { PageHeader } from "@/components/layout/page-header";import { useDialogStore } from "@/dialogs/store";import { isEditableElementFocused } from "@/features/resume/builder/draft";import { orpc } from "@/libs/orpc/client";@@ -89,6 +90,8 @@ export function DocumentsPage({ search, onSearchChange }: DocumentsPageProps) {});const all = documents ?? [];+ const failed = isError && !documents;+ const firstRun = !isPending && all.length === 0;const shown = filterDocuments(all, search);const tags = collectTags(all);const counts = {@@ -125,17 +128,9 @@ export function DocumentsPage({ search, onSearchChange }: DocumentsPageProps) {return (<div className="mx-auto grid w-full max-w-[1180px] content-start gap-5 px-8 py-8 max-sm:px-4 max-sm:py-5">- <h1 className="font-display text-[30px] leading-9 font-medium">- <Trans>Documents</Trans>- </h1>-- {isError && <LibraryError retrying={isFetching} onRetry={() => void refetch()} />}-- {isError && !documents ? null : !isPending && all.length === 0 ? (- <FirstRun onChooseFile={() => openDialog("document.new", undefined)} />- ) : (- <>- <div className="flex flex-wrap items-center gap-x-4 gap-y-3">+ <PageHeader title={<Trans>Documents</Trans>}>+ {!failed && !firstRun && (+ <><Tabs value={search.type} onValueChange={(type) => onSearchChange({ type: type as DocumentTypeFilter })}><TabsList variant="line" aria-label={t`Document type`}><TabsTrigger value="all">@@ -194,8 +189,16 @@ export function DocumentsPage({ search, onSearchChange }: DocumentsPageProps) {</SegmentedControlItem></SegmentedControl></div>- </div>+ </>+ )}+ </PageHeader>++ {isError && <LibraryError retrying={isFetching} onRetry={() => void refetch()} />}+ {failed ? null : firstRun ? (+ <FirstRun onChooseFile={() => openDialog("document.new", undefined)} />+ ) : (+ <>{(tags.length > 0 || hasPublic) && (<TagFiltertags={tags}diff --git a/apps/web/src/features/documents/trash-page.tsx b/apps/web/src/features/documents/trash-page.tsxindex 2d584fec2..a234463ad 100644--- a/apps/web/src/features/documents/trash-page.tsx+++ b/apps/web/src/features/documents/trash-page.tsx@@ -5,6 +5,7 @@ import { buttonVariants } from "@reactive-resume/ui/components/button";import { Icon } from "@reactive-resume/ui/components/icon";import { DocumentRow } from "./document-card";import { LibraryError } from "./library-error";+import { PageHeader } from "@/components/layout/page-header";import { orpc } from "@/libs/orpc/client";const noop = () => undefined;@@ -21,21 +22,19 @@ export function TrashPage() {return (<div className="mx-auto grid w-full max-w-[1180px] content-start gap-5 px-8 py-8 max-sm:px-4 max-sm:py-5">- <Link- to="/dashboard"- className={buttonVariants({ variant: "ghost", size: "sm", className: "-ms-2.5 w-fit gap-1.5 text-ink-2" })}- >- <Icon name="arrow-left" size={18} />- <Trans>Back to documents</Trans>- </Link>- <div className="grid gap-1">- <h1 className="font-display text-[30px] leading-9 font-medium">- <Trans>Trash</Trans>- </h1>- <p className="text-sm text-ink-2">- <Trans>Items are deleted permanently after 30 days.</Trans>- </p>- </div>+ <PageHeader+ back={+ <Link+ to="/dashboard"+ className={buttonVariants({ variant: "ghost", size: "sm", className: "-ms-2.5 w-fit gap-1.5 text-ink-2" })}+ >+ <Icon name="arrow-left" size={18} />+ <Trans>Back to documents</Trans>+ </Link>+ }+ title={<Trans>Trash</Trans>}+ description={<Trans>Items are deleted permanently after 30 days.</Trans>}+ />{isError && <LibraryError retrying={isFetching} onRetry={() => void refetch()} />}diff --git a/apps/web/src/features/settings/account/page.tsx b/apps/web/src/features/settings/account/page.tsxindex d523ff25a..1bc479eb9 100644--- a/apps/web/src/features/settings/account/page.tsx+++ b/apps/web/src/features/settings/account/page.tsx@@ -6,6 +6,7 @@ import { Icon } from "@reactive-resume/ui/components/icon";import { DataSection } from "./data";import { ProfileSection } from "./profile";import { SecuritySection } from "./security";+import { PageHeader } from "@/components/layout/page-header";import { authClient } from "@/libs/auth/client";export function AccountSettings() {@@ -14,6 +15,7 @@ export function AccountSettings() {return (<>+ <PageHeader title={<Trans>Account</Trans>} /><ProfileSection session={session} /><SecuritySection /><DataSection openDeletion={deleteAccount ?? false} />diff --git a/apps/web/src/features/settings/ai/page.tsx b/apps/web/src/features/settings/ai/page.tsxindex 6c2687f63..284d656ce 100644--- a/apps/web/src/features/settings/ai/page.tsx+++ b/apps/web/src/features/settings/ai/page.tsx@@ -4,19 +4,16 @@ import { ConnectedAppsSection } from "./connected-apps";import { McpSection } from "./mcp";import { ProvidersSection } from "./providers";import { WebAccessSection } from "./web-access";+import { PageHeader } from "@/components/layout/page-header";/** Providers and API keys together: both connect outside tools. */export function AiDeveloperSettings() {return (<>- <header className="grid gap-2">- <h1 className="font-display text-[30px] leading-9 font-medium">- <Trans>AI & developer</Trans>- </h1>- <p className="max-w-[56ch] text-sm leading-6 text-ink-2">- <Trans>Connect the tools you use for writing, job search and working with your resumes.</Trans>- </p>- </header>+ <PageHeader+ title={<Trans>AI & developer</Trans>}+ description={<Trans>Connect the tools you use for writing, job search and working with your resumes.</Trans>}+ /><ProvidersSection /><WebAccessSection /><ApiKeysSection />diff --git a/apps/web/src/features/settings/preferences.tsx b/apps/web/src/features/settings/preferences.tsxindex 14e3e4772..a407503f8 100644--- a/apps/web/src/features/settings/preferences.tsx+++ b/apps/web/src/features/settings/preferences.tsx@@ -11,6 +11,7 @@ import { Icon } from "@reactive-resume/ui/components/icon";import { toast } from "@reactive-resume/ui/components/toast";import { cn } from "@reactive-resume/utils/style";import { SettingsSection } from "./section";+import { PageHeader } from "@/components/layout/page-header";import { Combobox } from "@/components/ui/combobox";import { LocaleCombobox } from "@/features/locale/combobox";import { useTheme } from "@/features/theme/provider";@@ -31,6 +32,7 @@ export function PreferencesSettings() {return (<>+ <PageHeader title={<Trans>Preferences</Trans>} /><SettingsSection title={<Trans>Appearance</Trans>}><ThemeTiles /><p className="text-xs text-ink-3">diff --git a/apps/web/src/features/settings/root.tsx b/apps/web/src/features/settings/root.tsxindex 85d1a7134..77e0c38ef 100644--- a/apps/web/src/features/settings/root.tsx+++ b/apps/web/src/features/settings/root.tsx@@ -9,6 +9,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@reactive-resume/ui/componeimport { Icon } from "@reactive-resume/ui/components/icon";import { getInitials } from "@reactive-resume/utils/string";import { SignOutButton } from "./account/page";+import { PageHeader } from "@/components/layout/page-header";import { useTheme } from "@/features/theme/provider";import { orpc } from "@/libs/orpc/client";import { themeMap } from "@/libs/theme";@@ -45,9 +46,7 @@ export function SettingsRoot() {return (<div className="grid gap-4">- <h1 className="font-display text-[30px] leading-9 font-medium lg:hidden">- <Trans>Settings</Trans>- </h1>+ <PageHeader title={<Trans>Settings</Trans>} /><div className="flex items-center gap-3"><Avatar className="size-12"><AvatarImage src={session.user.image ?? undefined} alt="" />diff --git a/apps/web/src/routes/dashboard/-components/app-shell.tsx b/apps/web/src/routes/dashboard/-components/app-shell.tsxindex 47632b137..124e8b58c 100644--- a/apps/web/src/routes/dashboard/-components/app-shell.tsx+++ b/apps/web/src/routes/dashboard/-components/app-shell.tsx@@ -203,7 +203,7 @@ function NavLink({ item, current }: { item: NavItem; current: boolean }) {><Icon name={item.icon} filled={current} /><span className="flex-1">{item.label}</span>- {item.count !== undefined && <span className="font-mono text-xs text-ink-3">{item.count}</span>}+ {item.count ? <span className="font-mono text-xs text-ink-3">{item.count}</span> : null}</Link>);}diff --git a/apps/web/src/routes/dashboard/applications/index.tsx b/apps/web/src/routes/dashboard/applications/index.tsxindex be17ec660..84ca52913 100644--- a/apps/web/src/routes/dashboard/applications/index.tsx+++ b/apps/web/src/routes/dashboard/applications/index.tsx@@ -18,6 +18,7 @@ import { Skeleton } from "@reactive-resume/ui/components/skeleton";import { Tabs, TabsList, TabsTrigger } from "@reactive-resume/ui/components/tabs";import { useBreakpoint } from "@reactive-resume/ui/hooks/use-breakpoint";import { cn } from "@reactive-resume/utils/style";+import { PageHeader } from "@/components/layout/page-header";import { AddApplicationDialog } from "@/features/applications/components/add-application-dialog";import { ApplicationDetailSheet } from "@/features/applications/components/application-detail-sheet";import { ApplicationFormSheet } from "@/features/applications/components/application-form-sheet";@@ -112,54 +113,34 @@ function RouteComponent() {return (<div className="mx-auto grid w-full max-w-[1180px] content-start gap-5 px-8 py-8 max-sm:px-4 max-sm:py-5">- <header className="flex flex-wrap items-center justify-between gap-3">- <h1 className="font-display text-[30px] leading-9 font-medium">- <Trans>Applications</Trans>- </h1>- <div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger- render={<Button size="icon" variant="secondary" aria-label={t`Import or export CSV`} />}- >- <Icon name="arrows-down-up" />- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem onClick={() => setImporting(true)}>- <Trans>Import from CSV…</Trans>- </DropdownMenuItem>- <DropdownMenuItem disabled={empty || !applications} onClick={() => setExporting(true)}>- <Trans>Export to CSV…</Trans>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- <Button onClick={() => setAdding(true)}>- <Icon name="plus" />- <Trans>Save job</Trans>- </Button>- </div>- </header>-- {applications && <FollowUpNudge applications={applications} onOpen={setSelectedId} />}-- {isError && (- <div- role="alert"- className="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-line p-4"- >- <p className="text-sm text-danger-text">- <Trans>Couldn't load applications. Try again.</Trans>- </p>- <Button variant="secondary" disabled={isFetching} onClick={() => void refetch()}>- <Trans>Retry</Trans>- </Button>- </div>- )}-- {isError && !applications ? null : empty ? (- <EmptyState onAdd={() => setAdding(true)} onImport={() => setImporting(true)} />- ) : (- <>- <div className="flex flex-wrap items-center gap-2">+ <PageHeader+ title={<Trans>Applications</Trans>}+ actions={+ <>+ <DropdownMenu>+ <DropdownMenuTrigger+ render={<Button size="icon" variant="secondary" aria-label={t`Import or export CSV`} />}+ >+ <Icon name="arrows-down-up" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={() => setImporting(true)}>+ <Trans>Import from CSV…</Trans>+ </DropdownMenuItem>+ <DropdownMenuItem disabled={empty || !applications} onClick={() => setExporting(true)}>+ <Trans>Export to CSV…</Trans>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <Button onClick={() => setAdding(true)}>+ <Icon name="plus" />+ <Trans>Save job</Trans>+ </Button>+ </>+ }+ >+ {!(isError && !applications) && !empty && (+ <><Tabsvalue={shown}onValueChange={(value) => {@@ -218,8 +199,30 @@ function RouteComponent() {<Trans>Show closed</Trans></Button>)}- </div>+ </>+ )}+ </PageHeader>++ {applications && <FollowUpNudge applications={applications} onOpen={setSelectedId} />}++ {isError && (+ <div+ role="alert"+ className="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-line p-4"+ >+ <p className="text-sm text-danger-text">+ <Trans>Couldn't load applications. Try again.</Trans>+ </p>+ <Button variant="secondary" disabled={isFetching} onClick={() => void refetch()}>+ <Trans>Retry</Trans>+ </Button>+ </div>+ )}+ {isError && !applications ? null : empty ? (+ <EmptyState onAdd={() => setAdding(true)} onImport={() => setImporting(true)} />+ ) : (+ <>{isPending ? (<ViewSkeleton view={shown} />) : noMatches ? (diff --git a/apps/web/src/routes/dashboard/career/route.tsx b/apps/web/src/routes/dashboard/career/route.tsxindex 5a347c138..9b16991b7 100644--- a/apps/web/src/routes/dashboard/career/route.tsx+++ b/apps/web/src/routes/dashboard/career/route.tsx@@ -2,10 +2,9 @@ import type { IconName } from "@reactive-resume/ui/components/icon";import { t } from "@lingui/core/macro";import { Trans } from "@lingui/react/macro";import { createFileRoute, Link, Outlet, useMatchRoute } from "@tanstack/react-router";-import { m } from "motion/react";import { Icon } from "@reactive-resume/ui/components/icon";-import { cn } from "@reactive-resume/utils/style";-import { D2, EASE } from "@/libs/motion";+import { Tabs, TabsList, TabsTrigger } from "@reactive-resume/ui/components/tabs";+import { PageHeader } from "@/components/layout/page-header";export const Route = createFileRoute("/dashboard/career")({component: CareerLayout,@@ -22,7 +21,7 @@ type Place = {label: string;};-/** Career: Today, Coach, Knowledge and Offers under one header. The selected place's pill slides between them. */+/** Career: Today, Coach, Knowledge and Offers under one header. The selected place's underline slides between them. */function CareerLayout() {const matchRoute = useMatchRoute();const places: Place[] = [@@ -44,48 +43,30 @@ function CareerLayout() {const current = places.find((place) => matchRoute({ to: place.match, fuzzy: place.match !== "/dashboard/career/" }));return (- <div className="flex min-h-svh flex-col gap-6 px-4 py-5 md:px-10 md:py-7">- <header className="flex flex-wrap items-end justify-between gap-x-6 gap-y-4 [view-transition-name:career-header]">- <div className="grid min-w-0 gap-1">- <h1 className="font-display text-[30px] leading-9 font-medium">- <Trans>Career</Trans>- </h1>- <p className="text-sm text-ink-2">- <Trans>Plan your search, keep your evidence in one place, and decide between offers.</Trans>- </p>- </div>- <nav- aria-label={t`Career`}- className="-mx-4 flex max-w-[100vw] [scrollbar-width:none] overflow-x-auto px-4 md:mx-0 md:px-0"+ <div className="mx-auto flex min-h-svh w-full max-w-[1180px] flex-col gap-5 px-8 py-8 max-sm:px-4 max-sm:py-5">+ <PageHeader+ title={<Trans>Career</Trans>}+ description={<Trans>Plan your search, keep your evidence in one place, and decide between offers.</Trans>}+ >+ <Tabs+ value={current?.to ?? null}+ className="-mx-4 max-w-[100vw] [scrollbar-width:none] overflow-x-auto px-4 sm:mx-0 sm:px-0">- <div className="flex shrink-0 gap-0.5 rounded-[9px] bg-sunken p-[3px]">- {places.map((place) => {- const selected = place === current;- return (- <Link- key={place.to}- to={place.to}- aria-current={selected ? "page" : undefined}- className={cn(- "touch-target relative flex h-[30px] items-center gap-1.5 rounded-sm px-3 text-[13px] font-medium transition-colors duration-quick",- selected ? "text-ink" : "text-ink-2 hover:text-ink",- )}- >- {selected && (- <m.span- layoutId="career-place"- transition={{ duration: D2, ease: EASE }}- className="absolute inset-0 rounded-sm bg-raised shadow-e1"- />- )}- <Icon name={place.icon} size={18} className="relative" />- <span className="relative">{place.label}</span>- </Link>- );- })}- </div>- </nav>- </header>+ <TabsList variant="line" aria-label={t`Career`}>+ {places.map((place) => (+ <TabsTrigger+ key={place.to}+ value={place.to}+ nativeButton={false}+ render={<Link to={place.to} aria-current={place === current ? "page" : undefined} />}+ >+ <Icon name={place.icon} size={18} />+ {place.label}+ </TabsTrigger>+ ))}+ </TabsList>+ </Tabs>+ </PageHeader><Outlet /></div>);diff --git a/apps/web/src/routes/dashboard/settings/route.tsx b/apps/web/src/routes/dashboard/settings/route.tsxindex 779865564..f19a9275c 100644--- a/apps/web/src/routes/dashboard/settings/route.tsx+++ b/apps/web/src/routes/dashboard/settings/route.tsx@@ -40,9 +40,6 @@ function RouteComponent() {aria-label={t`Settings`}className="flex flex-col gap-1 border-line [view-transition-name:settings-nav] max-lg:border-b max-sm:hidden lg:min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:border-e lg:py-7 lg:ps-6 lg:pe-3">- <h1 className="ms-2 mb-3.5 font-display text-[26px] leading-8 font-medium max-lg:hidden">- <Trans>Settings</Trans>- </h1><div className="flex gap-1 max-lg:overflow-x-auto max-lg:px-6 max-lg:py-2 lg:flex-col">{SETTINGS_PAGES.map((page) => (<Link