@nukleus-sports/page-shells 0.3.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.
@@ -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 { 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/**\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 /**\n * Rendered via `ProjectDealCard`/`ManualDealCard`'s own `asideFooter` slot\n * for the given deal — e.g. `clientapp`'s per-deal commission breakdown,\n * which `nukleus-app` has no equivalent for. This package has no opinion\n * on the content; omit either (or both) for nothing extra. `ManualDealCard`\n * only renders its slot on desktop today — see that component's module doc.\n */\n getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;\n getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;\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 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 // 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;AAEP,uBASO;AA2LD;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,g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Y,OAAM,aAAY,WAAU,QACtC,WAAC,sBACA,4CAAC,mCAAe,SAAS,+BAA+B,IAExD,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;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;AAA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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":[]}
@@ -3,79 +3,10 @@ import { ReactNode, MouseEvent } from 'react';
3
3
  import { EntityImageResolver } from '@nukleus-sports/ui-patterns';
4
4
  import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef } from '@nukleus-sports/ui-patterns/marketing';
5
5
 
6
- /**
7
- * Reconciled from both apps' real current pages:
8
- * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
9
- * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
10
- *
11
- * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
12
- * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
13
- * also appends `ManualDealCard`s), matching empty states, and a shared
14
- * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
15
- *
16
- * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
17
- * page-shells rule and the decisions already made for this feature)
18
- * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
19
- * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
20
- * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
21
- * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
22
- * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
23
- * app-local, rendered alongside this shell, not inside it).
24
- * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
25
- * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
26
- * `AgencyLinkBanner`). Both are a one-time "should the deals experience
27
- * render at all" decision made from each app's own permission shape
28
- * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
29
- * shell ever mounts — not something this component re-derives.
30
- * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
31
- * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
32
- * required `collabMembership` prop) — the actual membership check is an
33
- * app-level query, surfaced here through `getCollabMembership`.
34
- *
35
- * ## Genuine differences reconciled (not formatting)
36
- * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
37
- * can't have deals yet): `clientapp` has no such concept. Modeled as an
38
- * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
39
- * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
40
- * structure; omit it and both tabs behave normally (`clientapp`'s case).
41
- * - Loading skeleton: `clientapp` shows one before the tabs ever render;
42
- * `nukleus-app` has none (deals just populate once the query resolves).
43
- * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
44
- * an agency-vs-client distinction, so both can use it.
45
- * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
46
- * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
47
- * responsive hiding — the mobile layout is already a compact card stack
48
- * without a tabular header, so the label reads as redundant there.
49
- * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
50
- * there are current-tab project deals ("No past deals recorded yet." vs.
51
- * the fuller "no deals at all" message); `clientapp`'s is a single fixed
52
- * string. `completedEmptyMessage` accepts either a plain string or a
53
- * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
54
- * baking either app's copy into this package.
55
- * - Completed-tab year filter: `clientapp` lets a client filter years of
56
- * deal history via a dropdown; `nukleus-app` has no equivalent at all.
57
- * Modeled as an optional `completedYearFilter` — when supplied, this
58
- * package renders the dropdown (and nothing else; which deals actually
59
- * appear is still just `completedProjectDeals`/`manualDeals`, already
60
- * filtered by the adapter before this object is built). `nukleus-app`
61
- * simply omits it, same pattern as `gatedEmptyState`.
62
- */
63
- /**
64
- * The app-supplied bridge to its own data/backend — per
65
- * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
66
- * takes a single typed `adapter` prop rather than flat individual props, so
67
- * each app's own `use<Page>()` hook has one output shape to satisfy and
68
- * drifting apart becomes a compile error, not a silent runtime mismatch.
69
- */
70
6
  interface MarketingDealsAdapter {
71
- /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
72
7
  isLoading?: boolean;
73
- /** Shows an inline error message in place of the deal lists. */
74
8
  error?: boolean;
75
9
  errorMessage?: string;
76
- /** Shows a "Retry" button in the error state when supplied. Both apps'
77
- * real pages combine retrying whichever underlying query actually failed
78
- * behind one button — this stays a single callback for the same reason. */
79
10
  onRetry?: () => void;
80
11
  activeTab: "current" | "completed";
81
12
  onTabChange: (tab: "current" | "completed") => void;
@@ -83,22 +14,13 @@ interface MarketingDealsAdapter {
83
14
  completedProjectDeals: ProjectDeal[];
84
15
  manualDeals: ManualDeal[];
85
16
  currentEmptyMessage: string;
17
+ /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */
86
18
  completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
87
- /**
88
- * Replaces the Current tab's content and disables the Completed tab —
89
- * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
90
- * behavior.
91
- */
19
+ /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */
92
20
  gatedEmptyState?: ReactNode;
93
21
  /**
94
- * Year filter for the Completed tab's deal history (`clientapp`-only
95
- * today — `nukleus-app` has no equivalent, so it simply never supplies
96
- * this). This package renders only the dropdown; filtering which deals
97
- * actually appear in `completedProjectDeals`/`manualDeals` is the
98
- * adapter's own job, done before this object is built (same as
99
- * `clientapp`'s own hook already filtering before this retrofit).
100
- * `options` already includes any "All" entry the caller wants — this
101
- * 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.
102
24
  */
103
25
  completedYearFilter?: {
104
26
  options: {
@@ -108,36 +30,23 @@ interface MarketingDealsAdapter {
108
30
  value: string;
109
31
  onChange: (value: string) => void;
110
32
  };
111
- /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
33
+ /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */
112
34
  getCollabMembership: (projectId: string) => ProjectCollabMembership;
113
35
  getCollabHref: (projectId: string) => string;
114
- /** `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. */
115
37
  getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
116
- /** Presence of each enables that affordance on `ManualDealCard`/the preview
117
- * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
118
- * take, so this just passes through. */
119
38
  onEditDeal?: (deal: ManualDeal) => void;
120
39
  onDeleteDeal?: (deal: ManualDeal) => void;
121
40
  onOpenDocument: (doc: ManualDealDocumentRef) => void;
122
- /** Photo of the client whose page this panel is rendered on, shown beside
123
- * "Client Name" in the manual deal preview dialog. Omit to show just the
124
- * name (no avatar). */
41
+ /** Shown beside "Client Name" in the manual deal preview dialog; omit for no avatar. */
125
42
  clientImageUrl?: string | null;
126
43
  resolveImageUrl?: EntityImageResolver;
127
- /**
128
- * Rendered via `ProjectDealCard`/`ManualDealCard`'s own `asideFooter` slot
129
- * for the given deal — e.g. `clientapp`'s per-deal commission breakdown,
130
- * which `nukleus-app` has no equivalent for. This package has no opinion
131
- * on the content; omit either (or both) for nothing extra. `ManualDealCard`
132
- * only renders its slot on desktop today — see that component's module doc.
133
- */
44
+ /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */
134
45
  getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;
135
46
  getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;
136
47
  }
137
48
  interface MarketingDealsPanelProps {
138
49
  adapter: MarketingDealsAdapter;
139
- /** Pure styling override — not part of the adapter, since it's never
140
- * backend/data-shaped. */
141
50
  className?: string;
142
51
  }
143
52
  declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
@@ -3,79 +3,10 @@ import { ReactNode, MouseEvent } from 'react';
3
3
  import { EntityImageResolver } from '@nukleus-sports/ui-patterns';
4
4
  import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef } from '@nukleus-sports/ui-patterns/marketing';
5
5
 
6
- /**
7
- * Reconciled from both apps' real current pages:
8
- * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
9
- * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
10
- *
11
- * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
12
- * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
13
- * also appends `ManualDealCard`s), matching empty states, and a shared
14
- * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
15
- *
16
- * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
17
- * page-shells rule and the decisions already made for this feature)
18
- * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
19
- * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
20
- * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
21
- * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
22
- * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
23
- * app-local, rendered alongside this shell, not inside it).
24
- * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
25
- * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
26
- * `AgencyLinkBanner`). Both are a one-time "should the deals experience
27
- * render at all" decision made from each app's own permission shape
28
- * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
29
- * shell ever mounts — not something this component re-derives.
30
- * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
31
- * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
32
- * required `collabMembership` prop) — the actual membership check is an
33
- * app-level query, surfaced here through `getCollabMembership`.
34
- *
35
- * ## Genuine differences reconciled (not formatting)
36
- * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
37
- * can't have deals yet): `clientapp` has no such concept. Modeled as an
38
- * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
39
- * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
40
- * structure; omit it and both tabs behave normally (`clientapp`'s case).
41
- * - Loading skeleton: `clientapp` shows one before the tabs ever render;
42
- * `nukleus-app` has none (deals just populate once the query resolves).
43
- * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
44
- * an agency-vs-client distinction, so both can use it.
45
- * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
46
- * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
47
- * responsive hiding — the mobile layout is already a compact card stack
48
- * without a tabular header, so the label reads as redundant there.
49
- * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
50
- * there are current-tab project deals ("No past deals recorded yet." vs.
51
- * the fuller "no deals at all" message); `clientapp`'s is a single fixed
52
- * string. `completedEmptyMessage` accepts either a plain string or a
53
- * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
54
- * baking either app's copy into this package.
55
- * - Completed-tab year filter: `clientapp` lets a client filter years of
56
- * deal history via a dropdown; `nukleus-app` has no equivalent at all.
57
- * Modeled as an optional `completedYearFilter` — when supplied, this
58
- * package renders the dropdown (and nothing else; which deals actually
59
- * appear is still just `completedProjectDeals`/`manualDeals`, already
60
- * filtered by the adapter before this object is built). `nukleus-app`
61
- * simply omits it, same pattern as `gatedEmptyState`.
62
- */
63
- /**
64
- * The app-supplied bridge to its own data/backend — per
65
- * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
66
- * takes a single typed `adapter` prop rather than flat individual props, so
67
- * each app's own `use<Page>()` hook has one output shape to satisfy and
68
- * drifting apart becomes a compile error, not a silent runtime mismatch.
69
- */
70
6
  interface MarketingDealsAdapter {
71
- /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
72
7
  isLoading?: boolean;
73
- /** Shows an inline error message in place of the deal lists. */
74
8
  error?: boolean;
75
9
  errorMessage?: string;
76
- /** Shows a "Retry" button in the error state when supplied. Both apps'
77
- * real pages combine retrying whichever underlying query actually failed
78
- * behind one button — this stays a single callback for the same reason. */
79
10
  onRetry?: () => void;
80
11
  activeTab: "current" | "completed";
81
12
  onTabChange: (tab: "current" | "completed") => void;
@@ -83,22 +14,13 @@ interface MarketingDealsAdapter {
83
14
  completedProjectDeals: ProjectDeal[];
84
15
  manualDeals: ManualDeal[];
85
16
  currentEmptyMessage: string;
17
+ /** Accepts a function because nukleus-app's wording depends on whether current deals exist. */
86
18
  completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
87
- /**
88
- * Replaces the Current tab's content and disables the Completed tab —
89
- * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
90
- * behavior.
91
- */
19
+ /** Replaces the Current tab's content and disables the Completed tab (nukleus-app's gating). */
92
20
  gatedEmptyState?: ReactNode;
93
21
  /**
94
- * Year filter for the Completed tab's deal history (`clientapp`-only
95
- * today — `nukleus-app` has no equivalent, so it simply never supplies
96
- * this). This package renders only the dropdown; filtering which deals
97
- * actually appear in `completedProjectDeals`/`manualDeals` is the
98
- * adapter's own job, done before this object is built (same as
99
- * `clientapp`'s own hook already filtering before this retrofit).
100
- * `options` already includes any "All" entry the caller wants — this
101
- * 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.
102
24
  */
103
25
  completedYearFilter?: {
104
26
  options: {
@@ -108,36 +30,23 @@ interface MarketingDealsAdapter {
108
30
  value: string;
109
31
  onChange: (value: string) => void;
110
32
  };
111
- /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
33
+ /** Required because `ProjectDealCard` structurally enforces the collab-membership check. */
112
34
  getCollabMembership: (projectId: string) => ProjectCollabMembership;
113
35
  getCollabHref: (projectId: string) => string;
114
- /** `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. */
115
37
  getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
116
- /** Presence of each enables that affordance on `ManualDealCard`/the preview
117
- * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
118
- * take, so this just passes through. */
119
38
  onEditDeal?: (deal: ManualDeal) => void;
120
39
  onDeleteDeal?: (deal: ManualDeal) => void;
121
40
  onOpenDocument: (doc: ManualDealDocumentRef) => void;
122
- /** Photo of the client whose page this panel is rendered on, shown beside
123
- * "Client Name" in the manual deal preview dialog. Omit to show just the
124
- * name (no avatar). */
41
+ /** Shown beside "Client Name" in the manual deal preview dialog; omit for no avatar. */
125
42
  clientImageUrl?: string | null;
126
43
  resolveImageUrl?: EntityImageResolver;
127
- /**
128
- * Rendered via `ProjectDealCard`/`ManualDealCard`'s own `asideFooter` slot
129
- * for the given deal — e.g. `clientapp`'s per-deal commission breakdown,
130
- * which `nukleus-app` has no equivalent for. This package has no opinion
131
- * on the content; omit either (or both) for nothing extra. `ManualDealCard`
132
- * only renders its slot on desktop today — see that component's module doc.
133
- */
44
+ /** Rendered via `asideFooter`; `ManualDealCard` shows it on desktop only (see that component). */
134
45
  getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;
135
46
  getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;
136
47
  }
137
48
  interface MarketingDealsPanelProps {
138
49
  adapter: MarketingDealsAdapter;
139
- /** Pure styling override — not part of the adapter, since it's never
140
- * backend/data-shaped. */
141
50
  className?: string;
142
51
  }
143
52
  declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
@@ -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 { 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/**\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 /**\n * Rendered via `ProjectDealCard`/`ManualDealCard`'s own `asideFooter` slot\n * for the given deal — e.g. `clientapp`'s per-deal commission breakdown,\n * which `nukleus-app` has no equivalent for. This package has no opinion\n * on the content; omit either (or both) for nothing extra. `ManualDealCard`\n * only renders its slot on desktop today — see that component's module doc.\n */\n getProjectDealAsideFooter?: (deal: ProjectDeal) => ReactNode;\n getManualDealAsideFooter?: (deal: ManualDeal) => ReactNode;\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 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 // 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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ACZ;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;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;AA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AA;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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nukleus-sports/page-shells",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "react-dom": "^18 || ^19"
41
41
  },
42
42
  "dependencies": {
43
- "@nukleus-sports/ui-patterns": "^0.3.0",
43
+ "@nukleus-sports/ui-patterns": "^0.3.1",
44
44
  "@nukleus-sports/ui-web": "^0.1.1"
45
45
  },
46
46
  "devDependencies": {