@nukleus-sports/page-shells 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,9 @@ function MarketingDealsPanel({ adapter, className }) {
51
51
  onDeleteDeal,
52
52
  onOpenDocument,
53
53
  clientImageUrl,
54
- resolveImageUrl
54
+ resolveImageUrl,
55
+ getProjectDealAsideFooter,
56
+ getManualDealAsideFooter
55
57
  } = adapter;
56
58
  const [previewDeal, setPreviewDeal] = (0, import_react.useState)(null);
57
59
  const resolvedCompletedEmptyMessage = typeof completedEmptyMessage === "function" ? completedEmptyMessage(currentProjectDeals.length > 0) : completedEmptyMessage;
@@ -113,7 +115,8 @@ function MarketingDealsPanel({ adapter, className }) {
113
115
  collabMembership: getCollabMembership(deal.project_id),
114
116
  collabHref: getCollabHref(deal.project_id),
115
117
  onCollabClick: getOnCollabClick?.(deal.project_id),
116
- resolveImageUrl
118
+ resolveImageUrl,
119
+ asideFooter: getProjectDealAsideFooter?.(deal)
117
120
  },
118
121
  deal.project_id
119
122
  )) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_marketing.DealEmptyState, { message: currentEmptyMessage }) }),
@@ -126,7 +129,8 @@ function MarketingDealsPanel({ adapter, className }) {
126
129
  collabMembership: getCollabMembership(deal.project_id),
127
130
  collabHref: getCollabHref(deal.project_id),
128
131
  onCollabClick: getOnCollabClick?.(deal.project_id),
129
- resolveImageUrl
132
+ resolveImageUrl,
133
+ asideFooter: getProjectDealAsideFooter?.(deal)
130
134
  },
131
135
  deal.project_id
132
136
  )),
@@ -138,7 +142,8 @@ function MarketingDealsPanel({ adapter, className }) {
138
142
  onEdit: onEditDeal,
139
143
  onDelete: onDeleteDeal,
140
144
  onOpenDocument,
141
- resolveImageUrl
145
+ resolveImageUrl,
146
+ asideFooter: getManualDealAsideFooter?.(deal)
142
147
  },
143
148
  deal.id
144
149
  ))
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marketing/index.ts","../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["export {\n MarketingDealsPanel,\n type MarketingDealsAdapter,\n type MarketingDealsPanelProps,\n} from \"./marketing-deals-panel\";\n","import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n * - Completed-tab year filter: `clientapp` lets a client filter years of\n * deal history via a dropdown; `nukleus-app` has no equivalent at all.\n * Modeled as an optional `completedYearFilter` — when supplied, this\n * package renders the dropdown (and nothing else; which deals actually\n * appear is still just `completedProjectDeals`/`manualDeals`, already\n * filtered by the adapter before this object is built). `nukleus-app`\n * simply omits it, same pattern as `gatedEmptyState`.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /**\n * Year filter for the Completed tab's deal history (`clientapp`-only\n * today — `nukleus-app` has no equivalent, so it simply never supplies\n * this). This package renders only the dropdown; filtering which deals\n * actually appear in `completedProjectDeals`/`manualDeals` is the\n * adapter's own job, done before this object is built (same as\n * `clientapp`'s own hook already filtering before this retrofit).\n * `options` already includes any \"All\" entry the caller wants — this\n * package has no opinion on that sentinel value or its label.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Photo of the client whose page this panel is rendered on, shown beside\n * \"Client Name\" in the manual deal preview dialog. Omit to show just the\n * name (no avatar). */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0D;AAE1D,oBAaO;AACP,uBAUO;AA+KD;AAnCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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,QACC,MAAM;AAAA,QACN,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AACtB,cAAI,CAAC,KAAM,gBAAe,IAAI;AAAA,QAChC;AAAA,QACA,QACE,aACI,CAAC,SAAS;AAGR,yBAAe,IAAI;AACnB,qBAAW,IAAI;AAAA,QACjB,IACA;AAAA,QAEN;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/marketing/index.ts","../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["export {\n MarketingDealsPanel,\n type MarketingDealsAdapter,\n type MarketingDealsPanelProps,\n} from \"./marketing-deals-panel\";\n","import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport { type EntityImageResolver } from \"@nukleus-sports/ui-patterns\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n// Reconciled from both apps -- see RECONCILIATION.md#marketing-deals-panel\n\nexport interface MarketingDealsAdapter {\n isLoading?: boolean;\n error?: boolean;\n errorMessage?: string;\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */\n gatedEmptyState?: ReactNode;\n\n /**\n * `options` must include any \"All\" entry the caller wants — this package renders only the\n * dropdown, not the filtering logic.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** nukleus-app's demo-mode upsell toast swaps the collab link for a button here. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Shown beside \"Client Name\" in the manual deal preview dialog; omit for no avatar. */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n\n /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */\n getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;\n getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n getProjectDealAsideFooter,\n getManualDealAsideFooter,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getProjectDealAsideFooter?.(deal)}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getProjectDealAsideFooter?.(deal)}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getManualDealAsideFooter?.(deal)}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0D;AAE1D,oBAaO;AAEP,uBASO;AAiGD;AArCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAA4B,IAAI;AAEtE,QAAM,gCACJ,OAAO,0BAA0B,aAC7B,sBAAsB,oBAAoB,SAAS,CAAC,IACpD;AACN,QAAM,sBAAsB,sBAAsB,SAAS,KAAK,YAAY,SAAS;AAErF,MAAI,WAAW;AACb,WACE,6CAAC,SAAI,eAAW,kBAAG,uBAAuB,SAAS,GACjD;AAAA,kDAAC,0BAAS,WAAU,6BAA4B;AAAA,MAChD,4CAAC,0BAAS,WAAU,mCAAkC;AAAA,OACxD;AAAA,EAEJ;AAEA,SACE,6CAAC,SAAI,WACH;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,eAAe,CAAC,UAAU,YAAY,KAAgC;AAAA,QACtE,WAAU;AAAA,QAEV;AAAA,uDAAC,0BAAS,WAAU,4GAClB;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAM;AAAA,gBACN,WAAU;AAAA,gBACX;AAAA;AAAA,YAED;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAM;AA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D,6CAAC,SAAI,WAAU,gCACZ;AAAA,oCAAsB,IAAI,CAAC,SAC1B;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA,aAAa;AAAA,kBACb,kBAAkB,oBAAoB,KAAK,UAAU;AAAA,kBACrD,YAAY,cAAc,KAAK,UAAU;AAAA,kBACzC,eAAe,mBAAmB,KAAK,UAAU;AAAA,kBACjD;AAAA,kBACA,aAAa,4BAA4B,IAAI;AAAA;AAAA,gBAPxC,KAAK;AAAA,cAQZ,CACD;AAAA,cACA,YAAY,IAAI,CAAC,SAChB;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA,WAAW;AAAA,kBACX,QAAQ;AAAA,kBACR,UAAU;AAAA,kBACV;AAAA,kBACA;AAAA,kBACA,aAAa,2BAA2B,IAAI;AAAA;AAAA,gBAPvC,KAAK;AAAA,cAQZ,CACD;AAAA,eACH,GAEJ;AAAA,aACF;AAAA;AAAA;AAAA,IAEJ;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AACtB,cAAI,CAAC,KAAM,gBAAe,IAAI;AAAA,QAChC;AAAA,QACA,QACE,aACI,CAAC,SAAS;AAER,yBAAe,IAAI;AACnB,qBAAW,IAAI;AAAA,QACjB,IACA;AAAA,QAEN;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,80 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
- import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef, EntityImageResolver } from '@nukleus-sports/ui-patterns/marketing';
3
+ import { EntityImageResolver } from '@nukleus-sports/ui-patterns';
4
+ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef } from '@nukleus-sports/ui-patterns/marketing';
4
5
 
5
- /**
6
- * Reconciled from both apps' real current pages:
7
- * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
8
- * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
9
- *
10
- * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
11
- * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
12
- * also appends `ManualDealCard`s), matching empty states, and a shared
13
- * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
14
- *
15
- * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
16
- * page-shells rule and the decisions already made for this feature)
17
- * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
18
- * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
19
- * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
20
- * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
21
- * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
22
- * app-local, rendered alongside this shell, not inside it).
23
- * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
24
- * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
25
- * `AgencyLinkBanner`). Both are a one-time "should the deals experience
26
- * render at all" decision made from each app's own permission shape
27
- * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
28
- * shell ever mounts — not something this component re-derives.
29
- * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
30
- * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
31
- * required `collabMembership` prop) — the actual membership check is an
32
- * app-level query, surfaced here through `getCollabMembership`.
33
- *
34
- * ## Genuine differences reconciled (not formatting)
35
- * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
36
- * can't have deals yet): `clientapp` has no such concept. Modeled as an
37
- * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
38
- * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
39
- * structure; omit it and both tabs behave normally (`clientapp`'s case).
40
- * - Loading skeleton: `clientapp` shows one before the tabs ever render;
41
- * `nukleus-app` has none (deals just populate once the query resolves).
42
- * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
43
- * an agency-vs-client distinction, so both can use it.
44
- * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
45
- * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
46
- * responsive hiding — the mobile layout is already a compact card stack
47
- * without a tabular header, so the label reads as redundant there.
48
- * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
49
- * there are current-tab project deals ("No past deals recorded yet." vs.
50
- * the fuller "no deals at all" message); `clientapp`'s is a single fixed
51
- * string. `completedEmptyMessage` accepts either a plain string or a
52
- * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
53
- * baking either app's copy into this package.
54
- * - Completed-tab year filter: `clientapp` lets a client filter years of
55
- * deal history via a dropdown; `nukleus-app` has no equivalent at all.
56
- * Modeled as an optional `completedYearFilter` — when supplied, this
57
- * package renders the dropdown (and nothing else; which deals actually
58
- * appear is still just `completedProjectDeals`/`manualDeals`, already
59
- * filtered by the adapter before this object is built). `nukleus-app`
60
- * simply omits it, same pattern as `gatedEmptyState`.
61
- */
62
- /**
63
- * The app-supplied bridge to its own data/backend — per
64
- * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
65
- * takes a single typed `adapter` prop rather than flat individual props, so
66
- * each app's own `use<Page>()` hook has one output shape to satisfy and
67
- * drifting apart becomes a compile error, not a silent runtime mismatch.
68
- */
69
6
  interface MarketingDealsAdapter {
70
- /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
71
7
  isLoading?: boolean;
72
- /** Shows an inline error message in place of the deal lists. */
73
8
  error?: boolean;
74
9
  errorMessage?: string;
75
- /** Shows a "Retry" button in the error state when supplied. Both apps'
76
- * real pages combine retrying whichever underlying query actually failed
77
- * behind one button — this stays a single callback for the same reason. */
78
10
  onRetry?: () => void;
79
11
  activeTab: "current" | "completed";
80
12
  onTabChange: (tab: "current" | "completed") => void;
@@ -82,22 +14,13 @@ interface MarketingDealsAdapter {
82
14
  completedProjectDeals: ProjectDeal[];
83
15
  manualDeals: ManualDeal[];
84
16
  currentEmptyMessage: string;
17
+ /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */
85
18
  completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
86
- /**
87
- * Replaces the Current tab's content and disables the Completed tab —
88
- * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
89
- * behavior.
90
- */
19
+ /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */
91
20
  gatedEmptyState?: ReactNode;
92
21
  /**
93
- * Year filter for the Completed tab's deal history (`clientapp`-only
94
- * today — `nukleus-app` has no equivalent, so it simply never supplies
95
- * this). This package renders only the dropdown; filtering which deals
96
- * actually appear in `completedProjectDeals`/`manualDeals` is the
97
- * adapter's own job, done before this object is built (same as
98
- * `clientapp`'s own hook already filtering before this retrofit).
99
- * `options` already includes any "All" entry the caller wants — this
100
- * package has no opinion on that sentinel value or its label.
22
+ * `options` must include any "All" entry the caller wants — this package renders only the
23
+ * dropdown, not the filtering logic.
101
24
  */
102
25
  completedYearFilter?: {
103
26
  options: {
@@ -107,27 +30,23 @@ interface MarketingDealsAdapter {
107
30
  value: string;
108
31
  onChange: (value: string) => void;
109
32
  };
110
- /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
33
+ /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */
111
34
  getCollabMembership: (projectId: string) => ProjectCollabMembership;
112
35
  getCollabHref: (projectId: string) => string;
113
- /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */
36
+ /** nukleus-app's demo-mode upsell toast swaps the collab link for a button here. */
114
37
  getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
115
- /** Presence of each enables that affordance on `ManualDealCard`/the preview
116
- * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
117
- * take, so this just passes through. */
118
38
  onEditDeal?: (deal: ManualDeal) => void;
119
39
  onDeleteDeal?: (deal: ManualDeal) => void;
120
40
  onOpenDocument: (doc: ManualDealDocumentRef) => void;
121
- /** Photo of the client whose page this panel is rendered on, shown beside
122
- * "Client Name" in the manual deal preview dialog. Omit to show just the
123
- * name (no avatar). */
41
+ /** Shown beside "Client Name" in the manual deal preview dialog; omit for no avatar. */
124
42
  clientImageUrl?: string | null;
125
43
  resolveImageUrl?: EntityImageResolver;
44
+ /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */
45
+ getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;
46
+ getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;
126
47
  }
127
48
  interface MarketingDealsPanelProps {
128
49
  adapter: MarketingDealsAdapter;
129
- /** Pure styling override — not part of the adapter, since it's never
130
- * backend/data-shaped. */
131
50
  className?: string;
132
51
  }
133
52
  declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
@@ -1,80 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
- import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef, EntityImageResolver } from '@nukleus-sports/ui-patterns/marketing';
3
+ import { EntityImageResolver } from '@nukleus-sports/ui-patterns';
4
+ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef } from '@nukleus-sports/ui-patterns/marketing';
4
5
 
5
- /**
6
- * Reconciled from both apps' real current pages:
7
- * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
8
- * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
9
- *
10
- * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
11
- * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
12
- * also appends `ManualDealCard`s), matching empty states, and a shared
13
- * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
14
- *
15
- * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
16
- * page-shells rule and the decisions already made for this feature)
17
- * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
18
- * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
19
- * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
20
- * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
21
- * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
22
- * app-local, rendered alongside this shell, not inside it).
23
- * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
24
- * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
25
- * `AgencyLinkBanner`). Both are a one-time "should the deals experience
26
- * render at all" decision made from each app's own permission shape
27
- * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
28
- * shell ever mounts — not something this component re-derives.
29
- * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
30
- * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
31
- * required `collabMembership` prop) — the actual membership check is an
32
- * app-level query, surfaced here through `getCollabMembership`.
33
- *
34
- * ## Genuine differences reconciled (not formatting)
35
- * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
36
- * can't have deals yet): `clientapp` has no such concept. Modeled as an
37
- * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
38
- * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
39
- * structure; omit it and both tabs behave normally (`clientapp`'s case).
40
- * - Loading skeleton: `clientapp` shows one before the tabs ever render;
41
- * `nukleus-app` has none (deals just populate once the query resolves).
42
- * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
43
- * an agency-vs-client distinction, so both can use it.
44
- * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
45
- * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
46
- * responsive hiding — the mobile layout is already a compact card stack
47
- * without a tabular header, so the label reads as redundant there.
48
- * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
49
- * there are current-tab project deals ("No past deals recorded yet." vs.
50
- * the fuller "no deals at all" message); `clientapp`'s is a single fixed
51
- * string. `completedEmptyMessage` accepts either a plain string or a
52
- * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
53
- * baking either app's copy into this package.
54
- * - Completed-tab year filter: `clientapp` lets a client filter years of
55
- * deal history via a dropdown; `nukleus-app` has no equivalent at all.
56
- * Modeled as an optional `completedYearFilter` — when supplied, this
57
- * package renders the dropdown (and nothing else; which deals actually
58
- * appear is still just `completedProjectDeals`/`manualDeals`, already
59
- * filtered by the adapter before this object is built). `nukleus-app`
60
- * simply omits it, same pattern as `gatedEmptyState`.
61
- */
62
- /**
63
- * The app-supplied bridge to its own data/backend — per
64
- * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
65
- * takes a single typed `adapter` prop rather than flat individual props, so
66
- * each app's own `use<Page>()` hook has one output shape to satisfy and
67
- * drifting apart becomes a compile error, not a silent runtime mismatch.
68
- */
69
6
  interface MarketingDealsAdapter {
70
- /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
71
7
  isLoading?: boolean;
72
- /** Shows an inline error message in place of the deal lists. */
73
8
  error?: boolean;
74
9
  errorMessage?: string;
75
- /** Shows a "Retry" button in the error state when supplied. Both apps'
76
- * real pages combine retrying whichever underlying query actually failed
77
- * behind one button — this stays a single callback for the same reason. */
78
10
  onRetry?: () => void;
79
11
  activeTab: "current" | "completed";
80
12
  onTabChange: (tab: "current" | "completed") => void;
@@ -82,22 +14,13 @@ interface MarketingDealsAdapter {
82
14
  completedProjectDeals: ProjectDeal[];
83
15
  manualDeals: ManualDeal[];
84
16
  currentEmptyMessage: string;
17
+ /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */
85
18
  completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
86
- /**
87
- * Replaces the Current tab's content and disables the Completed tab —
88
- * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
89
- * behavior.
90
- */
19
+ /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */
91
20
  gatedEmptyState?: ReactNode;
92
21
  /**
93
- * Year filter for the Completed tab's deal history (`clientapp`-only
94
- * today — `nukleus-app` has no equivalent, so it simply never supplies
95
- * this). This package renders only the dropdown; filtering which deals
96
- * actually appear in `completedProjectDeals`/`manualDeals` is the
97
- * adapter's own job, done before this object is built (same as
98
- * `clientapp`'s own hook already filtering before this retrofit).
99
- * `options` already includes any "All" entry the caller wants — this
100
- * package has no opinion on that sentinel value or its label.
22
+ * `options` must include any "All" entry the caller wants — this package renders only the
23
+ * dropdown, not the filtering logic.
101
24
  */
102
25
  completedYearFilter?: {
103
26
  options: {
@@ -107,27 +30,23 @@ interface MarketingDealsAdapter {
107
30
  value: string;
108
31
  onChange: (value: string) => void;
109
32
  };
110
- /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
33
+ /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */
111
34
  getCollabMembership: (projectId: string) => ProjectCollabMembership;
112
35
  getCollabHref: (projectId: string) => string;
113
- /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */
36
+ /** nukleus-app's demo-mode upsell toast swaps the collab link for a button here. */
114
37
  getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
115
- /** Presence of each enables that affordance on `ManualDealCard`/the preview
116
- * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
117
- * take, so this just passes through. */
118
38
  onEditDeal?: (deal: ManualDeal) => void;
119
39
  onDeleteDeal?: (deal: ManualDeal) => void;
120
40
  onOpenDocument: (doc: ManualDealDocumentRef) => void;
121
- /** Photo of the client whose page this panel is rendered on, shown beside
122
- * "Client Name" in the manual deal preview dialog. Omit to show just the
123
- * name (no avatar). */
41
+ /** Shown beside "Client Name" in the manual deal preview dialog; omit for no avatar. */
124
42
  clientImageUrl?: string | null;
125
43
  resolveImageUrl?: EntityImageResolver;
44
+ /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */
45
+ getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;
46
+ getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;
126
47
  }
127
48
  interface MarketingDealsPanelProps {
128
49
  adapter: MarketingDealsAdapter;
129
- /** Pure styling override — not part of the adapter, since it's never
130
- * backend/data-shaped. */
131
50
  className?: string;
132
51
  }
133
52
  declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
package/dist/marketing.js CHANGED
@@ -43,7 +43,9 @@ function MarketingDealsPanel({ adapter, className }) {
43
43
  onDeleteDeal,
44
44
  onOpenDocument,
45
45
  clientImageUrl,
46
- resolveImageUrl
46
+ resolveImageUrl,
47
+ getProjectDealAsideFooter,
48
+ getManualDealAsideFooter
47
49
  } = adapter;
48
50
  const [previewDeal, setPreviewDeal] = useState(null);
49
51
  const resolvedCompletedEmptyMessage = typeof completedEmptyMessage === "function" ? completedEmptyMessage(currentProjectDeals.length > 0) : completedEmptyMessage;
@@ -105,7 +107,8 @@ function MarketingDealsPanel({ adapter, className }) {
105
107
  collabMembership: getCollabMembership(deal.project_id),
106
108
  collabHref: getCollabHref(deal.project_id),
107
109
  onCollabClick: getOnCollabClick?.(deal.project_id),
108
- resolveImageUrl
110
+ resolveImageUrl,
111
+ asideFooter: getProjectDealAsideFooter?.(deal)
109
112
  },
110
113
  deal.project_id
111
114
  )) }) : /* @__PURE__ */ jsx(DealEmptyState, { message: currentEmptyMessage }) }),
@@ -118,7 +121,8 @@ function MarketingDealsPanel({ adapter, className }) {
118
121
  collabMembership: getCollabMembership(deal.project_id),
119
122
  collabHref: getCollabHref(deal.project_id),
120
123
  onCollabClick: getOnCollabClick?.(deal.project_id),
121
- resolveImageUrl
124
+ resolveImageUrl,
125
+ asideFooter: getProjectDealAsideFooter?.(deal)
122
126
  },
123
127
  deal.project_id
124
128
  )),
@@ -130,7 +134,8 @@ function MarketingDealsPanel({ adapter, className }) {
130
134
  onEdit: onEditDeal,
131
135
  onDelete: onDeleteDeal,
132
136
  onOpenDocument,
133
- resolveImageUrl
137
+ resolveImageUrl,
138
+ asideFooter: getManualDealAsideFooter?.(deal)
134
139
  },
135
140
  deal.id
136
141
  ))
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n * - Completed-tab year filter: `clientapp` lets a client filter years of\n * deal history via a dropdown; `nukleus-app` has no equivalent at all.\n * Modeled as an optional `completedYearFilter` — when supplied, this\n * package renders the dropdown (and nothing else; which deals actually\n * appear is still just `completedProjectDeals`/`manualDeals`, already\n * filtered by the adapter before this object is built). `nukleus-app`\n * simply omits it, same pattern as `gatedEmptyState`.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /**\n * Year filter for the Completed tab's deal history (`clientapp`-only\n * today — `nukleus-app` has no equivalent, so it simply never supplies\n * this). This package renders only the dropdown; filtering which deals\n * actually appear in `completedProjectDeals`/`manualDeals` is the\n * adapter's own job, done before this object is built (same as\n * `clientapp`'s own hook already filtering before this retrofit).\n * `options` already includes any \"All\" entry the caller wants — this\n * package has no opinion on that sentinel value or its label.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Photo of the client whose page this panel is rendered on, shown beside\n * \"Client Name\" in the manual deal preview dialog. Omit to show just the\n * name (no avatar). */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";AAAA,SAAS,gBAAiD;AAE1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AA+KD,SAwCI,UAvCF,KADF;AAnCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;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,kBAEC;AAAA,kBACA,WAAW;AAAA,kBACX,QAAQ;AAAA,kBACR,UAAU;AAAA,kBACV;AAAA,kBACA;AAAA;AAAA,gBANK,KAAK;AAAA,cAOZ,CACD;AAAA,eACH,GAEJ;AAAA,aACF;AAAA;AAAA;AAAA,IAEJ;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AACtB,cAAI,CAAC,KAAM,gBAAe,IAAI;AAAA,QAChC;AAAA,QACA,QACE,aACI,CAAC,SAAS;AAGR,yBAAe,IAAI;AACnB,qBAAW,IAAI;AAAA,QACjB,IACA;AAAA,QAEN;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport { type EntityImageResolver } from \"@nukleus-sports/ui-patterns\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n// Reconciled from both apps -- see RECONCILIATION.md#marketing-deals-panel\n\nexport interface MarketingDealsAdapter {\n isLoading?: boolean;\n error?: boolean;\n errorMessage?: string;\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */\n gatedEmptyState?: ReactNode;\n\n /**\n * `options` must include any \"All\" entry the caller wants — this package renders only the\n * dropdown, not the filtering logic.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** nukleus-app's demo-mode upsell toast swaps the collab link for a button here. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Shown beside \"Client Name\" in the manual deal preview dialog; omit for no avatar. */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n\n /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */\n getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;\n getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n getProjectDealAsideFooter,\n getManualDealAsideFooter,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getProjectDealAsideFooter?.(deal)}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getProjectDealAsideFooter?.(deal)}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n asideFooter={getManualDealAsideFooter?.(deal)}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";AAAA,SAAS,gBAAiD;AAE1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAiGD,SAwCI,UAvCF,KADF;AArCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAA4B,IAAI;AAEtE,QAAM,gCACJ,OAAO,0BAA0B,aAC7B,sBAAsB,oBAAoB,SAAS,CAAC,IACpD;AACN,QAAM,sBAAsB,sBAAsB,SAAS,KAAK,YAAY,SAAS;AAErF,MAAI,WAAW;AACb,WACE,qBAAC,SAAI,WAAW,GAAG,uBAAuB,SAAS,GACjD;AAAA,0BAAC,YAAS,WAAU,6BAA4B;AAAA,MAChD,oBAAC,YAAS,WAAU,mCAAkC;AAAA,OACxD;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAI,WACH;AAAA;AAAA,M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"@nukleus-sports/page-shells",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "build": "tsup",
27
27
  "dev": "tsup --watch",
28
28
  "test": "vitest run",
29
- "lint": "eslint \"src/**/*.ts\" \"src/**/*.tsx\" \"tests/**/*.ts\"",
29
+ "lint": "eslint \"src/**/*.ts\" \"src/**/*.tsx\" \"tests/**/*.ts\" \"tests/**/*.tsx\"",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "prepublishOnly": "bun run build"
32
32
  },
@@ -40,15 +40,17 @@
40
40
  "react-dom": "^18 || ^19"
41
41
  },
42
42
  "dependencies": {
43
- "@nukleus-sports/ui-patterns": "^0.2.0",
44
- "@nukleus-sports/ui-web": "^0.1.0"
43
+ "@nukleus-sports/ui-patterns": "^0.3.1",
44
+ "@nukleus-sports/ui-web": "^0.1.1"
45
45
  },
46
46
  "devDependencies": {
47
+ "@testing-library/jest-dom": "^6.9.1",
48
+ "@testing-library/react": "^16.3.2",
47
49
  "@types/node": "^26.6.1",
48
50
  "@types/react": "^18.3.3",
49
51
  "@types/react-dom": "^18.3.0",
50
- "react": "^18.3.1",
51
- "react-dom": "^18.3.1",
52
+ "react": "^19.3.1",
53
+ "react-dom": "^19.3.1",
52
54
  "tsup": "^8.4.0",
53
55
  "typescript": "^5.8.2",
54
56
  "vitest": "^5.0.1"