@burdenoff/microfe-headshotmarketing 2026.1203.3 → 2026.1205.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.
@@ -330,7 +330,7 @@ var N = [
330
330
  key: "estimatedValue",
331
331
  header: "Est. Value",
332
332
  sortable: !0,
333
- className: "text-right",
333
+ className: "text-end",
334
334
  render: (e) => /* @__PURE__ */ O("span", {
335
335
  className: "text-sm font-medium tabular-nums text-text-primary",
336
336
  children: e.estimatedValue && e.estimatedValue > 0 ? t(e.estimatedValue) : "—"
@@ -353,7 +353,7 @@ var N = [
353
353
  {
354
354
  key: "actions",
355
355
  header: "",
356
- className: "w-36 text-right",
356
+ className: "w-36 text-end",
357
357
  render: (e) => {
358
358
  let t = `${e.firstName} ${e.lastName}`.trim() || e.title;
359
359
  return /* @__PURE__ */ k("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"LeadsPage.js","names":["EmptyState","EmptyState$1","SOURCE_FILTER_OPTIONS","selectClass","LeadsPage","useRecordSelection","useHeadshotmarketingBootstrap","refetch","useRefreshCrmSelection","useHeadshotMarketing","search","setSearch","useState","statusFilter","setStatusFilter","sourceFilter","setSourceFilter","newLeadOpen","setNewLeadOpen","scoreTarget","setScoreTarget","batchScoreOpen","setBatchScoreOpen","convertTarget","useMemo","pipelines","data","pipeline","p","firstStage","a","b","contactById","contacts","toContactModel","item","contact","rawLeads","rows","rawById","l","toLeadModel","raw","lead","totalLeads","avgScore","sum","acc","hotLeads","conversionRate","won","HeadshotmarketingLeadStatus","scoreBuckets","bucketScores","filtered","matchesSearch","matchesStatus","matchesSource","renderOwner","assignedTo","currentUser","name","LeadAvatar","PageLayout","Sparkles","Plus","LeadCreateModal","LeadScoreDecisionModal","LeadBatchScoringModal","PagePurpose","CrmSubNav","CrmRecordSelection","QueryStateBoundary","EmphasisPanel","StatCard","Users","Gauge","TrendingUp","Flame","ChartCard","LeadScoreHistogram","FilterBar","ThemedSelect","opt","DataTable","fullName","row","selectRecord","LeadSourceCell","cn","StatusBadge","formatCurrency","formatDate","ConvertLeadButton","LeadActionsMenu"],"sources":["../../../../src/headshotmarketing/pages/crm/LeadsPage.tsx"],"sourcesContent":["/**\n * Leads Page\n * @module headshotmarketing/pages/crm\n */\n\nimport { useMemo, useState, type FC } from \"react\";\nimport { Users, Gauge, TrendingUp, Flame, Plus, Sparkles } from \"lucide-react\";\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n FilterBar,\n EmptyState,\n ChartCard,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport {\n EmphasisPanel,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toLeadModel } from \"../../utils/crmMapper\";\nimport { HeadshotmarketingLeadStatus } from \"../../../generated/wspace-types\";\nimport type { HeadshotmarketingBootstrapDataQuery } from \"../../../generated/wspace-operations\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { CrmSubNav } from \"./CrmSubNav\";\nimport type { Contact, Lead } from \"../../types\";\nimport { LeadActionsMenu } from \"./CrmActions\";\nimport { LeadCreateModal } from \"./LeadCreateModal\";\nimport { useRecordSelection } from \"../../hooks/useRecordSelection\";\nimport { useRefreshCrmSelection } from \"../../hooks/useRefreshCrmSelection\";\nimport { CrmRecordSelection } from \"../../components/CrmRecordSelection\";\nimport { ConvertLeadButton, type ConvertTarget } from \"./ConvertLeadButton\";\nimport {\n LeadAvatar,\n LeadScoreHistogram,\n LeadSourceCell,\n bucketScores,\n} from \"./LeadsWidgets\";\nimport {\n LeadBatchScoringModal,\n LeadScoreDecisionModal,\n type LeadScoreTarget,\n} from \"./LeadAiDecisionPanel\";\n\n/** A mapped lead plus the extra display fields sourced from the raw bootstrap row. */\ninterface LeadRow extends Lead {\n estimatedValue: number | null;\n contactAvatar: string;\n}\n\nconst SOURCE_FILTER_OPTIONS: { value: string; label: string }[] = [\n { value: \"all\", label: \"All Sources\" },\n { value: \"website\", label: \"Website\" },\n { value: \"social_media\", label: \"Social media\" },\n { value: \"ad_campaign\", label: \"Ads\" },\n { value: \"email\", label: \"Email\" },\n { value: \"referral\", label: \"Referral\" },\n { value: \"event\", label: \"Event\" },\n { value: \"cold_outreach\", label: \"Cold outreach\" },\n { value: \"other\", label: \"Other\" },\n];\n\nconst selectClass =\n \"min-h-[44px] rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\n\nexport const LeadsPage: FC = () => {\n const { selectRecord } = useRecordSelection();\n const { data, loading, error } = useHeadshotmarketingBootstrap();\n const refetch = useRefreshCrmSelection(\"lead\");\n const { currentUser, navigate, basePath } = useHeadshotMarketing();\n const [search, setSearch] = useState(\"\");\n const [statusFilter, setStatusFilter] = useState(\"all\");\n const [sourceFilter, setSourceFilter] = useState(\"all\");\n const [newLeadOpen, setNewLeadOpen] = useState(false);\n const [scoreTarget, setScoreTarget] = useState<LeadScoreTarget | null>(null);\n const [batchScoreOpen, setBatchScoreOpen] = useState(false);\n\n // The pipeline + stage a converted lead lands in: prefer the workspace's\n // default pipeline, else the first one, and that pipeline's lowest-order\n // stage. Null when the workspace has no pipeline yet — the row action then\n // renders disabled instead of firing an invalid conversion.\n const convertTarget = useMemo<ConvertTarget | null>(() => {\n const pipelines: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingPipelines\"][\"items\"] =\n data?.headshotmarketingPipelines.items ?? [];\n if (pipelines.length === 0) return null;\n const pipeline = pipelines.find((p) => p.isDefault) ?? pipelines[0];\n const firstStage = [...pipeline.stages].sort(\n (a, b) => a.order - b.order,\n )[0];\n if (!firstStage) return null;\n return {\n pipelineId: pipeline.id,\n pipelineName: pipeline.name,\n stageId: firstStage.id,\n stageName: firstStage.name,\n };\n }, [data?.headshotmarketingPipelines.items]);\n\n const contactById = useMemo<Record<string, Contact>>(() => {\n const items = data?.headshotmarketingContacts.items ?? [];\n const contacts = items.map((item: Parameters<typeof toContactModel>[0]) =>\n toContactModel(item),\n );\n return Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n }, [data?.headshotmarketingContacts.items]);\n\n // Raw bootstrap rows retain fields the shared Lead mapper drops\n // (estimatedValue, precise status enum, contactId) — read them here so the\n // page can enrich its view without touching the shared mapper.\n const rawLeads = useMemo<\n (Parameters<typeof toLeadModel>[0] & { estimatedValue?: number | null })[]\n >(\n () => data?.headshotmarketingLeads.items ?? [],\n [data?.headshotmarketingLeads.items],\n );\n\n const rows = useMemo<LeadRow[]>(() => {\n const rawById = new Map(rawLeads.map((l) => [l.id, l] as const));\n const leads = rawLeads.map((item: Parameters<typeof toLeadModel>[0]) =>\n toLeadModel(item, contactById),\n );\n return leads.map((lead) => {\n const raw = rawById.get(lead.id);\n const contact = raw?.contactId ? contactById[raw.contactId] : undefined;\n return {\n ...lead,\n estimatedValue: raw?.estimatedValue ?? null,\n contactAvatar: contact?.avatar ?? \"\",\n };\n });\n }, [rawLeads, contactById]);\n\n // ---- KPIs (computed from the precise raw enum, not the lossy model) --------\n const totalLeads = rawLeads.length;\n const avgScore = useMemo(() => {\n if (totalLeads === 0) return 0;\n const sum = rawLeads.reduce((acc, l) => acc + (l.score ?? 0), 0);\n return Math.round(sum / totalLeads);\n }, [rawLeads, totalLeads]);\n const hotLeads = useMemo(\n () => rawLeads.filter((l) => (l.score ?? 0) >= 80).length,\n [rawLeads],\n );\n const conversionRate = useMemo(() => {\n if (totalLeads === 0) return 0;\n const won = rawLeads.filter(\n (l) =>\n l.status === HeadshotmarketingLeadStatus.Converted ||\n l.status === HeadshotmarketingLeadStatus.Qualified,\n ).length;\n return Math.round((won / totalLeads) * 100);\n }, [rawLeads, totalLeads]);\n const scoreBuckets = useMemo(\n () => bucketScores(rawLeads.map((l) => l.score ?? 0)),\n [rawLeads],\n );\n\n const filtered = rows.filter((l) => {\n const matchesSearch =\n !search ||\n `${l.firstName} ${l.lastName} ${l.email} ${l.company} ${l.title}`\n .toLowerCase()\n .includes(search.toLowerCase());\n const matchesStatus = statusFilter === \"all\" || l.status === statusFilter;\n const matchesSource = sourceFilter === \"all\" || l.source === sourceFilter;\n return matchesSearch && matchesStatus && matchesSource;\n });\n\n const renderOwner = (assignedTo: string) => {\n if (!assignedTo || assignedTo === \"Unassigned\") {\n return <span className=\"text-sm text-text-secondary\">Unassigned</span>;\n }\n if (currentUser && assignedTo === currentUser.id) {\n const name =\n currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \") ||\n currentUser.email;\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar name={name} src={currentUser.avatar} size={28} />\n <span className=\"text-sm font-medium text-text-primary\">You</span>\n </div>\n );\n }\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar size={28} />\n <span className=\"text-sm text-text-secondary\">Assigned</span>\n </div>\n );\n };\n\n const leadColumns: Column<LeadRow>[] = [\n {\n key: \"name\",\n header: \"Lead\",\n sortable: true,\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex min-w-[180px] items-center gap-3\">\n <LeadAvatar name={fullName} src={row.contactAvatar || undefined} />\n <div className=\"min-w-0\">\n <button\n type=\"button\"\n onClick={() => selectRecord(row.id)}\n className=\"truncate font-medium text-text-primary hover:underline text-start\"\n >\n {fullName}\n </button>\n <p className=\"truncate text-xs text-text-secondary\">\n {row.email || row.title}\n </p>\n </div>\n </div>\n );\n },\n },\n {\n key: \"company\",\n header: \"Company\",\n sortable: true,\n render: (row) => (\n <span className=\"text-sm text-text-primary\">{row.company || \"—\"}</span>\n ),\n },\n {\n key: \"source\",\n header: \"Source\",\n sortable: true,\n render: (row) => <LeadSourceCell source={row.source} />,\n },\n {\n key: \"score\",\n header: \"Lead Score\",\n sortable: true,\n render: (row) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-2 w-16 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n \"h-full rounded-full transition-all\",\n row.score >= 80\n ? \"bg-status-success-text\"\n : row.score >= 50\n ? \"bg-status-warning-text\"\n : \"bg-status-error-text\",\n )}\n style={{ width: `${Math.max(0, Math.min(100, row.score))}%` }}\n />\n </div>\n <span className=\"text-xs font-medium tabular-nums text-text-primary\">\n {row.score}\n </span>\n </div>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"estimatedValue\",\n header: \"Est. Value\",\n sortable: true,\n className: \"text-right\",\n render: (row) => (\n <span className=\"text-sm font-medium tabular-nums text-text-primary\">\n {row.estimatedValue && row.estimatedValue > 0\n ? formatCurrency(row.estimatedValue)\n : \"—\"}\n </span>\n ),\n },\n {\n key: \"assignedTo\",\n header: \"Owner\",\n render: (row) => renderOwner(row.assignedTo),\n },\n {\n key: \"createdAt\",\n header: \"Created\",\n sortable: true,\n render: (row) => (\n <span className=\"whitespace-nowrap text-sm text-text-secondary\">\n {formatDate(row.createdAt)}\n </span>\n ),\n },\n {\n key: \"actions\",\n header: \"\",\n className: \"w-36 text-right\",\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex items-center justify-end gap-1\">\n <button\n type=\"button\"\n onClick={() =>\n setScoreTarget({\n id: row.id,\n name: fullName,\n currentScore: row.score,\n })\n }\n title=\"Preview AI lead score\"\n className=\"inline-flex items-center gap-1 rounded-md border border-border-subtle px-2 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Sparkles className=\"h-3.5 w-3.5 text-action-primary-bg\" />\n AI Score\n </button>\n <ConvertLeadButton\n lead={{ id: row.id, title: row.title }}\n target={convertTarget}\n onConverted={refetch}\n />\n <LeadActionsMenu lead={row} onChanged={refetch} />\n </div>\n );\n },\n },\n ];\n\n return (\n <PageLayout\n title=\"Leads\"\n description=\"Track and manage your leads pipeline\"\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setBatchScoreOpen(true)}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-2 text-sm font-medium text-text-primary shadow-pop hover:bg-bg-sunken\"\n >\n <Sparkles className=\"h-4 w-4 text-action-primary-bg\" />\n Batch AI Score\n </button>\n <button\n type=\"button\"\n onClick={() => setNewLeadOpen(true)}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text shadow-pop hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Lead\n </button>\n </div>\n }\n >\n <LeadCreateModal\n open={newLeadOpen}\n onClose={() => setNewLeadOpen(false)}\n contacts={Object.values(contactById)}\n onCreated={refetch}\n />\n <LeadScoreDecisionModal\n lead={scoreTarget}\n onClose={() => setScoreTarget(null)}\n onApplied={refetch}\n />\n <LeadBatchScoringModal\n open={batchScoreOpen}\n totalAvailable={totalLeads}\n onClose={() => setBatchScoreOpen(false)}\n onCompleted={refetch}\n />\n\n <PagePurpose>\n Track every prospect from first touch to qualified. See where each lead\n sits — new, contacted, qualified or disqualified — sort by lead score,\n and focus your follow-ups on the people most likely to convert.\n </PagePurpose>\n\n <CrmSubNav active=\"leads\" basePath={basePath} navigate={navigate} />\n <CrmRecordSelection kind=\"lead\" />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Stats + score distribution — primary emphasis zone */}\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-3\">\n <div className=\"xl:col-span-2\">\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4\">\n <StatCard\n title=\"Total Leads\"\n value={totalLeads}\n icon={<Users className=\"h-5 w-5\" />}\n featured\n />\n <StatCard\n title=\"Avg Lead Score\"\n value={avgScore}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversion Rate\"\n value={`${conversionRate}%`}\n icon={<TrendingUp className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Hot Leads\"\n value={hotLeads}\n icon={<Flame className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n </div>\n\n <ChartCard\n title=\"Score distribution\"\n subtitle=\"Leads by score tier\"\n className=\"xl:col-span-1\"\n >\n <LeadScoreHistogram data={scoreBuckets} />\n </ChartCard>\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder=\"Search leads...\"\n filters={\n <div className=\"flex flex-nowrap items-center gap-2 overflow-x-auto\">\n <ThemedSelect\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by status\"\n >\n <option value=\"all\">All Statuses</option>\n <option value=\"new\">New</option>\n <option value=\"contacted\">Contacted</option>\n <option value=\"qualified\">Qualified</option>\n <option value=\"disqualified\">Disqualified</option>\n </ThemedSelect>\n <ThemedSelect\n value={sourceFilter}\n onChange={(e) => setSourceFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by source\"\n >\n {SOURCE_FILTER_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </ThemedSelect>\n </div>\n }\n />\n\n {/* Leads Table */}\n {filtered.length === 0 ? (\n <EmptyState\n illustration={rows.length === 0 ? \"empty-people\" : \"empty-search\"}\n title={\n rows.length === 0 ? \"No leads yet\" : \"No leads match your filters\"\n }\n description={\n rows.length === 0\n ? \"Leads will appear here as they come in from your campaigns and forms.\"\n : \"Try a different search term, status or source.\"\n }\n />\n ) : (\n <DataTable data={filtered} columns={leadColumns} pageSize={10} />\n )}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAME,IAA4D;CAChE;EAAE,O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A,EAAI;SACD,CAAA,CACH;;OAET;OACA;QACE,KAAK;QACL,QAAQ;QACR,SAAS,MAAQ,kBAACI,GAAD,EAAa,QAAQJ,EAAI,OAAS,CAAA;OACrD;OACA;QACE,KAAK;QACL,QAAQ;QACR,UAAU;QACV,WAAW;QACX,SAAS,MACP,kBAAC,QAAD;SAAM,WAAU;SACb,UAAAA,EAAI,kBAAkBA,EAAI,iBAAiB,IACxCK,EAAeL,EAAI,cAAc,IACjC;QACA,CAAA;OAEV;OACA;QACE,KAAK;QACL,QAAQ;QACR,SAAS,MAAQ5B,GAAY4B,EAAI,UAAU;OAC7C;OACA;QACE,KAAK;QACL,QAAQ;QACR,UAAU;QACV,SAAS,MACP,kBAAC,QAAD;SAAM,WAAU;SACb,UAAAM,EAAWN,EAAI,SAAS;QACrB,CAAA;OAEV;OACA;QACE,KAAK;QACL,QAAQ;QACR,WAAW;QACX,SAAS,MAAQ;SACf,IAAMD,IAAW,GAAGC,EAAI,UAAU,GAAGA,EAAI,WAAW,KAAK,KAAKA,EAAI;SAClE,OACE,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA;WACE,kBAAC,UAAD;YACE,MAAK;YACL,eACElE,EAAe;aACb,IAAIkE,EAAI;aACR,MAAMD;aACN,cAAcC,EAAI;YACpB,CAAC;YAEH,OAAM;YACN,WAAU;YAVZ,UAAA,CAYE,kBAACtB,GAAD,EAAU,WAAU,qCAAsC,CAAA,GAAC,UAErD;;WACR,kBAAC6B,IAAD;YACE,MAAM;aAAE,IAAIP,EAAI;aAAI,OAAOA,EAAI;YAAM;YACrC,QAAQ/D;YACR,aAAahB;WACd,CAAA;WACD,kBAACuF,GAAD;YAAiB,MAAMR;YAAK,WAAW/E;WAAU,CAAA;UAC9C;;QAET;OACF;MAqJ0C;MAAa,UAAU;KAAK,CAAA;IAEhD;;EACV;;AAEhB"}
1
+ {"version":3,"file":"LeadsPage.js","names":["EmptyState","EmptyState$1","SOURCE_FILTER_OPTIONS","selectClass","LeadsPage","useRecordSelection","useHeadshotmarketingBootstrap","refetch","useRefreshCrmSelection","useHeadshotMarketing","search","setSearch","useState","statusFilter","setStatusFilter","sourceFilter","setSourceFilter","newLeadOpen","setNewLeadOpen","scoreTarget","setScoreTarget","batchScoreOpen","setBatchScoreOpen","convertTarget","useMemo","pipelines","data","pipeline","p","firstStage","a","b","contactById","contacts","toContactModel","item","contact","rawLeads","rows","rawById","l","toLeadModel","raw","lead","totalLeads","avgScore","sum","acc","hotLeads","conversionRate","won","HeadshotmarketingLeadStatus","scoreBuckets","bucketScores","filtered","matchesSearch","matchesStatus","matchesSource","renderOwner","assignedTo","currentUser","name","LeadAvatar","PageLayout","Sparkles","Plus","LeadCreateModal","LeadScoreDecisionModal","LeadBatchScoringModal","PagePurpose","CrmSubNav","CrmRecordSelection","QueryStateBoundary","EmphasisPanel","StatCard","Users","Gauge","TrendingUp","Flame","ChartCard","LeadScoreHistogram","FilterBar","ThemedSelect","opt","DataTable","fullName","row","selectRecord","LeadSourceCell","cn","StatusBadge","formatCurrency","formatDate","ConvertLeadButton","LeadActionsMenu"],"sources":["../../../../src/headshotmarketing/pages/crm/LeadsPage.tsx"],"sourcesContent":["/**\n * Leads Page\n * @module headshotmarketing/pages/crm\n */\n\nimport { useMemo, useState, type FC } from \"react\";\nimport { Users, Gauge, TrendingUp, Flame, Plus, Sparkles } from \"lucide-react\";\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n FilterBar,\n EmptyState,\n ChartCard,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport {\n EmphasisPanel,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toLeadModel } from \"../../utils/crmMapper\";\nimport { HeadshotmarketingLeadStatus } from \"../../../generated/wspace-types\";\nimport type { HeadshotmarketingBootstrapDataQuery } from \"../../../generated/wspace-operations\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { CrmSubNav } from \"./CrmSubNav\";\nimport type { Contact, Lead } from \"../../types\";\nimport { LeadActionsMenu } from \"./CrmActions\";\nimport { LeadCreateModal } from \"./LeadCreateModal\";\nimport { useRecordSelection } from \"../../hooks/useRecordSelection\";\nimport { useRefreshCrmSelection } from \"../../hooks/useRefreshCrmSelection\";\nimport { CrmRecordSelection } from \"../../components/CrmRecordSelection\";\nimport { ConvertLeadButton, type ConvertTarget } from \"./ConvertLeadButton\";\nimport {\n LeadAvatar,\n LeadScoreHistogram,\n LeadSourceCell,\n bucketScores,\n} from \"./LeadsWidgets\";\nimport {\n LeadBatchScoringModal,\n LeadScoreDecisionModal,\n type LeadScoreTarget,\n} from \"./LeadAiDecisionPanel\";\n\n/** A mapped lead plus the extra display fields sourced from the raw bootstrap row. */\ninterface LeadRow extends Lead {\n estimatedValue: number | null;\n contactAvatar: string;\n}\n\nconst SOURCE_FILTER_OPTIONS: { value: string; label: string }[] = [\n { value: \"all\", label: \"All Sources\" },\n { value: \"website\", label: \"Website\" },\n { value: \"social_media\", label: \"Social media\" },\n { value: \"ad_campaign\", label: \"Ads\" },\n { value: \"email\", label: \"Email\" },\n { value: \"referral\", label: \"Referral\" },\n { value: \"event\", label: \"Event\" },\n { value: \"cold_outreach\", label: \"Cold outreach\" },\n { value: \"other\", label: \"Other\" },\n];\n\nconst selectClass =\n \"min-h-[44px] rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\n\nexport const LeadsPage: FC = () => {\n const { selectRecord } = useRecordSelection();\n const { data, loading, error } = useHeadshotmarketingBootstrap();\n const refetch = useRefreshCrmSelection(\"lead\");\n const { currentUser, navigate, basePath } = useHeadshotMarketing();\n const [search, setSearch] = useState(\"\");\n const [statusFilter, setStatusFilter] = useState(\"all\");\n const [sourceFilter, setSourceFilter] = useState(\"all\");\n const [newLeadOpen, setNewLeadOpen] = useState(false);\n const [scoreTarget, setScoreTarget] = useState<LeadScoreTarget | null>(null);\n const [batchScoreOpen, setBatchScoreOpen] = useState(false);\n\n // The pipeline + stage a converted lead lands in: prefer the workspace's\n // default pipeline, else the first one, and that pipeline's lowest-order\n // stage. Null when the workspace has no pipeline yet — the row action then\n // renders disabled instead of firing an invalid conversion.\n const convertTarget = useMemo<ConvertTarget | null>(() => {\n const pipelines: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingPipelines\"][\"items\"] =\n data?.headshotmarketingPipelines.items ?? [];\n if (pipelines.length === 0) return null;\n const pipeline = pipelines.find((p) => p.isDefault) ?? pipelines[0];\n const firstStage = [...pipeline.stages].sort(\n (a, b) => a.order - b.order,\n )[0];\n if (!firstStage) return null;\n return {\n pipelineId: pipeline.id,\n pipelineName: pipeline.name,\n stageId: firstStage.id,\n stageName: firstStage.name,\n };\n }, [data?.headshotmarketingPipelines.items]);\n\n const contactById = useMemo<Record<string, Contact>>(() => {\n const items = data?.headshotmarketingContacts.items ?? [];\n const contacts = items.map((item: Parameters<typeof toContactModel>[0]) =>\n toContactModel(item),\n );\n return Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n }, [data?.headshotmarketingContacts.items]);\n\n // Raw bootstrap rows retain fields the shared Lead mapper drops\n // (estimatedValue, precise status enum, contactId) — read them here so the\n // page can enrich its view without touching the shared mapper.\n const rawLeads = useMemo<\n (Parameters<typeof toLeadModel>[0] & { estimatedValue?: number | null })[]\n >(\n () => data?.headshotmarketingLeads.items ?? [],\n [data?.headshotmarketingLeads.items],\n );\n\n const rows = useMemo<LeadRow[]>(() => {\n const rawById = new Map(rawLeads.map((l) => [l.id, l] as const));\n const leads = rawLeads.map((item: Parameters<typeof toLeadModel>[0]) =>\n toLeadModel(item, contactById),\n );\n return leads.map((lead) => {\n const raw = rawById.get(lead.id);\n const contact = raw?.contactId ? contactById[raw.contactId] : undefined;\n return {\n ...lead,\n estimatedValue: raw?.estimatedValue ?? null,\n contactAvatar: contact?.avatar ?? \"\",\n };\n });\n }, [rawLeads, contactById]);\n\n // ---- KPIs (computed from the precise raw enum, not the lossy model) --------\n const totalLeads = rawLeads.length;\n const avgScore = useMemo(() => {\n if (totalLeads === 0) return 0;\n const sum = rawLeads.reduce((acc, l) => acc + (l.score ?? 0), 0);\n return Math.round(sum / totalLeads);\n }, [rawLeads, totalLeads]);\n const hotLeads = useMemo(\n () => rawLeads.filter((l) => (l.score ?? 0) >= 80).length,\n [rawLeads],\n );\n const conversionRate = useMemo(() => {\n if (totalLeads === 0) return 0;\n const won = rawLeads.filter(\n (l) =>\n l.status === HeadshotmarketingLeadStatus.Converted ||\n l.status === HeadshotmarketingLeadStatus.Qualified,\n ).length;\n return Math.round((won / totalLeads) * 100);\n }, [rawLeads, totalLeads]);\n const scoreBuckets = useMemo(\n () => bucketScores(rawLeads.map((l) => l.score ?? 0)),\n [rawLeads],\n );\n\n const filtered = rows.filter((l) => {\n const matchesSearch =\n !search ||\n `${l.firstName} ${l.lastName} ${l.email} ${l.company} ${l.title}`\n .toLowerCase()\n .includes(search.toLowerCase());\n const matchesStatus = statusFilter === \"all\" || l.status === statusFilter;\n const matchesSource = sourceFilter === \"all\" || l.source === sourceFilter;\n return matchesSearch && matchesStatus && matchesSource;\n });\n\n const renderOwner = (assignedTo: string) => {\n if (!assignedTo || assignedTo === \"Unassigned\") {\n return <span className=\"text-sm text-text-secondary\">Unassigned</span>;\n }\n if (currentUser && assignedTo === currentUser.id) {\n const name =\n currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \") ||\n currentUser.email;\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar name={name} src={currentUser.avatar} size={28} />\n <span className=\"text-sm font-medium text-text-primary\">You</span>\n </div>\n );\n }\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar size={28} />\n <span className=\"text-sm text-text-secondary\">Assigned</span>\n </div>\n );\n };\n\n const leadColumns: Column<LeadRow>[] = [\n {\n key: \"name\",\n header: \"Lead\",\n sortable: true,\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex min-w-[180px] items-center gap-3\">\n <LeadAvatar name={fullName} src={row.contactAvatar || undefined} />\n <div className=\"min-w-0\">\n <button\n type=\"button\"\n onClick={() => selectRecord(row.id)}\n className=\"truncate font-medium text-text-primary hover:underline text-start\"\n >\n {fullName}\n </button>\n <p className=\"truncate text-xs text-text-secondary\">\n {row.email || row.title}\n </p>\n </div>\n </div>\n );\n },\n },\n {\n key: \"company\",\n header: \"Company\",\n sortable: true,\n render: (row) => (\n <span className=\"text-sm text-text-primary\">{row.company || \"—\"}</span>\n ),\n },\n {\n key: \"source\",\n header: \"Source\",\n sortable: true,\n render: (row) => <LeadSourceCell source={row.source} />,\n },\n {\n key: \"score\",\n header: \"Lead Score\",\n sortable: true,\n render: (row) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-2 w-16 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n \"h-full rounded-full transition-all\",\n row.score >= 80\n ? \"bg-status-success-text\"\n : row.score >= 50\n ? \"bg-status-warning-text\"\n : \"bg-status-error-text\",\n )}\n style={{ width: `${Math.max(0, Math.min(100, row.score))}%` }}\n />\n </div>\n <span className=\"text-xs font-medium tabular-nums text-text-primary\">\n {row.score}\n </span>\n </div>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"estimatedValue\",\n header: \"Est. Value\",\n sortable: true,\n className: \"text-end\",\n render: (row) => (\n <span className=\"text-sm font-medium tabular-nums text-text-primary\">\n {row.estimatedValue && row.estimatedValue > 0\n ? formatCurrency(row.estimatedValue)\n : \"—\"}\n </span>\n ),\n },\n {\n key: \"assignedTo\",\n header: \"Owner\",\n render: (row) => renderOwner(row.assignedTo),\n },\n {\n key: \"createdAt\",\n header: \"Created\",\n sortable: true,\n render: (row) => (\n <span className=\"whitespace-nowrap text-sm text-text-secondary\">\n {formatDate(row.createdAt)}\n </span>\n ),\n },\n {\n key: \"actions\",\n header: \"\",\n className: \"w-36 text-end\",\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex items-center justify-end gap-1\">\n <button\n type=\"button\"\n onClick={() =>\n setScoreTarget({\n id: row.id,\n name: fullName,\n currentScore: row.score,\n })\n }\n title=\"Preview AI lead score\"\n className=\"inline-flex items-center gap-1 rounded-md border border-border-subtle px-2 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Sparkles className=\"h-3.5 w-3.5 text-action-primary-bg\" />\n AI Score\n </button>\n <ConvertLeadButton\n lead={{ id: row.id, title: row.title }}\n target={convertTarget}\n onConverted={refetch}\n />\n <LeadActionsMenu lead={row} onChanged={refetch} />\n </div>\n );\n },\n },\n ];\n\n return (\n <PageLayout\n title=\"Leads\"\n description=\"Track and manage your leads pipeline\"\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setBatchScoreOpen(true)}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-2 text-sm font-medium text-text-primary shadow-pop hover:bg-bg-sunken\"\n >\n <Sparkles className=\"h-4 w-4 text-action-primary-bg\" />\n Batch AI Score\n </button>\n <button\n type=\"button\"\n onClick={() => setNewLeadOpen(true)}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text shadow-pop hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Lead\n </button>\n </div>\n }\n >\n <LeadCreateModal\n open={newLeadOpen}\n onClose={() => setNewLeadOpen(false)}\n contacts={Object.values(contactById)}\n onCreated={refetch}\n />\n <LeadScoreDecisionModal\n lead={scoreTarget}\n onClose={() => setScoreTarget(null)}\n onApplied={refetch}\n />\n <LeadBatchScoringModal\n open={batchScoreOpen}\n totalAvailable={totalLeads}\n onClose={() => setBatchScoreOpen(false)}\n onCompleted={refetch}\n />\n\n <PagePurpose>\n Track every prospect from first touch to qualified. See where each lead\n sits — new, contacted, qualified or disqualified — sort by lead score,\n and focus your follow-ups on the people most likely to convert.\n </PagePurpose>\n\n <CrmSubNav active=\"leads\" basePath={basePath} navigate={navigate} />\n <CrmRecordSelection kind=\"lead\" />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Stats + score distribution — primary emphasis zone */}\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-3\">\n <div className=\"xl:col-span-2\">\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4\">\n <StatCard\n title=\"Total Leads\"\n value={totalLeads}\n icon={<Users className=\"h-5 w-5\" />}\n featured\n />\n <StatCard\n title=\"Avg Lead Score\"\n value={avgScore}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversion Rate\"\n value={`${conversionRate}%`}\n icon={<TrendingUp className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Hot Leads\"\n value={hotLeads}\n icon={<Flame className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n </div>\n\n <ChartCard\n title=\"Score distribution\"\n subtitle=\"Leads by score tier\"\n className=\"xl:col-span-1\"\n >\n <LeadScoreHistogram data={scoreBuckets} />\n </ChartCard>\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder=\"Search leads...\"\n filters={\n <div className=\"flex flex-nowrap items-center gap-2 overflow-x-auto\">\n <ThemedSelect\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by status\"\n >\n <option value=\"all\">All Statuses</option>\n <option value=\"new\">New</option>\n <option value=\"contacted\">Contacted</option>\n <option value=\"qualified\">Qualified</option>\n <option value=\"disqualified\">Disqualified</option>\n </ThemedSelect>\n <ThemedSelect\n value={sourceFilter}\n onChange={(e) => setSourceFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by source\"\n >\n {SOURCE_FILTER_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </ThemedSelect>\n </div>\n }\n />\n\n {/* Leads Table */}\n {filtered.length === 0 ? (\n <EmptyState\n illustration={rows.length === 0 ? \"empty-people\" : \"empty-search\"}\n title={\n rows.length === 0 ? \"No leads yet\" : \"No leads match your filters\"\n }\n description={\n rows.length === 0\n ? \"Leads will appear here as they come in from your campaigns and forms.\"\n : \"Try a different search term, status or source.\"\n }\n />\n ) : (\n <DataTable data={filtered} columns={leadColumns} pageSize={10} />\n )}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAME,IAA4D;CAChE;EAAE,OAAO;EAAO,OAAO;CAAc;CACrC;EAAE,OAAO;EAAW,OAAO;CAAU;CACrC;EAAE,OAAO;EAAgB,OAAO;CAAe;CAC/C;EAAE,OAAO;EAAe,OAAO;CAAM;CACrC;EAAE,OAAO;EAAS,OAAO;CAAQ;CACjC;EAAE,OAAO;EAAY,OAAO;CAAW;CACvC;EAAE,OAAO;EAAS,OAAO;CAAQ;CACjC;EAAE,OAAO;EAAiB,OAAO;CAAgB;CACjD;EAAE,OAAO;EAAS,OAAO;CAAQ;AACnC,GAEMC,IACJ,uLAEWC,UAAsB;CACjC,IAAM,EAAE,oBAAiBC,EAAmB,GACtC,EAAE,SAAM,YAAS,aAAUC,EAA8B,GACzDC,IAAUC,EAAuB,MAAM,GACvC,EAAE,gBAAa,cAAU,gBAAaC,EAAqB,GAC3D,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjC,CAACC,GAAcC,MAAmBF,EAAS,KAAK,GAChD,CAACG,GAAcC,MAAmBJ,EAAS,KAAK,GAChD,CAACK,IAAaC,KA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,EAAI;SAClE,OACE,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA;WACE,kBAAC,UAAD;YACE,MAAK;YACL,eACElE,EAAe;aACb,IAAIkE,EAAI;aACR,MAAMD;aACN,cAAcC,EAAI;YACpB,CAAC;YAEH,OAAM;YACN,WAAU;YAVZ,UAAA,CAYE,kBAACtB,GAAD,EAAU,WAAU,qCAAsC,CAAA,GAAC,UAErD;;WACR,kBAAC6B,IAAD;YACE,MAAM;aAAE,IAAIP,EAAI;aAAI,OAAOA,EAAI;YAAM;YACrC,QAAQ/D;YACR,aAAahB;WACd,CAAA;WACD,kBAACuF,GAAD;YAAiB,MAAMR;YAAK,WAAW/E;WAAU,CAAA;UAC9C;;QAET;OACF;MAqJ0C;MAAa,UAAU;KAAK,CAAA;IAEhD;;EACV;;AAEhB"}
@@ -143,14 +143,14 @@ var C = () => {
143
143
  children: /* @__PURE__ */ h("div", {
144
144
  className: "grid min-w-[560px] grid-cols-7",
145
145
  children: [b.map((e) => /* @__PURE__ */ m("div", {
146
- className: "border-b border-r border-border-subtle px-2 py-2 text-center text-xs font-medium text-text-secondary",
146
+ className: "border-b border-e border-border-subtle px-2 py-2 text-center text-xs font-medium text-text-secondary",
147
147
  children: e
148
148
  }, e)), $.map((t, n) => {
149
149
  let r = t ? `${F}-${String(I + 1).padStart(2, "0")}-${String(t).padStart(2, "0")}` : "", i = t ? Y(r) : [], a = r === X;
150
150
  return /* @__PURE__ */ m("div", {
151
151
  onClick: t ? () => C(w + "/social/compose") : void 0,
152
152
  title: t ? "Compose a post" : void 0,
153
- className: e("min-h-[80px] border-b border-r border-border-subtle p-1", !t && "bg-bg-sunken/30", a && "bg-status-info-bg/50", t && "cursor-pointer transition-colors hover:bg-bg-sunken/40"),
153
+ className: e("min-h-[80px] border-b border-e border-border-subtle p-1", !t && "bg-bg-sunken/30", a && "bg-status-info-bg/50", t && "cursor-pointer transition-colors hover:bg-bg-sunken/40"),
154
154
  children: t && /* @__PURE__ */ h(ie, { children: [/* @__PURE__ */ m("span", {
155
155
  className: e("text-xs font-medium", a ? "text-status-info-text font-bold" : "text-text-secondary"),
156
156
  children: t
@@ -181,7 +181,7 @@ var C = () => {
181
181
  r.setDate(r.getDate() + n);
182
182
  let i = y(r), a = Y(i), o = i === X;
183
183
  return /* @__PURE__ */ h("div", {
184
- className: e("border-r border-border-subtle p-3 min-h-[200px]", o && "bg-status-info-bg/50"),
184
+ className: e("border-e border-border-subtle p-3 min-h-[200px]", o && "bg-status-info-bg/50"),
185
185
  children: [/* @__PURE__ */ h("div", {
186
186
  className: "text-center mb-2",
187
187
  children: [/* @__PURE__ */ m("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"ContentCalendarPage.js","names":["_Fragment","platformColors","toDateKey","date","DAYS","getDaysInMonth","year","month","getFirstDayOfMonth","ContentCalendarPage","useHeadshotMarketing","useHeadshotmarketingBootstrap","viewMode","setViewMode","useState","currentDate","setCurrentDate","visiblePlatforms","setVisiblePlatforms","PLATFORM_META","p","daysInMonth","firstDay","monthName","navigateMonth","direction","navigateWeek","d","socialAccounts","useMemo","data","toSocialAccountModel","item","accountNameById","accountPlatformById","socialPosts","toSocialPostModel","platformFollowers","followersByPlatform","calendarPosts","toCalendarPosts","filteredPosts","getPostsForDate","dateStr","todayStr","todayPosts","upcomingPosts","a","b","publishedCount","scheduledCount","draftCount","weekStart","calendarCells","i","PageLayout","navigate","basePath","PagePurpose","NextSteps","QueryStateBoundary","refetch","ChevronLeft","ChevronRight","cn","day","dayPosts","isToday","Fragment","post","idx","CalendarPlatformFilter","CalendarDays","Clock","EmphasisPanel","BarChart3"],"sources":["../../../../src/headshotmarketing/pages/social-media/ContentCalendarPage.tsx"],"sourcesContent":["import { useState, useMemo, type FC } from \"react\";\nimport {\n ChevronLeft,\n ChevronRight,\n CalendarDays,\n Clock,\n BarChart3,\n} from \"lucide-react\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n toCalendarPosts,\n toSocialAccountModel,\n toSocialPostModel,\n} from \"../../utils/socialMapper\";\nimport { PageLayout, QueryStateBoundary } from \"../../components\";\nimport { PagePurpose, EmphasisPanel, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks\";\nimport type {\n SocialMediaAccount,\n SocialMediaPlatform,\n SocialMediaPost,\n} from \"../../types\";\nimport { followersByPlatform } from \"../../utils/socialAccountStats\";\nimport { CalendarPlatformFilter } from \"./CalendarPlatformFilter\";\nimport { PLATFORM_META } from \"./socialComposerMeta\";\n\nconst platformColors: Record<string, string> = {\n instagram: \"bg-action-primary-bg\",\n facebook: \"bg-status-info-text\",\n twitter: \"bg-status-info-text\",\n linkedin: \"bg-status-info-text\",\n youtube: \"bg-status-error-text\",\n tiktok: \"bg-bg-sunken\",\n};\n\ntype ViewMode = \"month\" | \"week\";\n\nfunction toDateKey(date: Date): string {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\nconst DAYS = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\nfunction getDaysInMonth(year: number, month: number) {\n return new Date(year, month + 1, 0).getDate();\n}\n\nfunction getFirstDayOfMonth(year: number, month: number) {\n return new Date(year, month, 1).getDay();\n}\n\nexport const ContentCalendarPage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const [viewMode, setViewMode] = useState<ViewMode>(\"month\");\n const [currentDate, setCurrentDate] = useState(() => new Date());\n const [visiblePlatforms, setVisiblePlatforms] = useState<\n Set<SocialMediaPlatform>\n >(() => new Set(PLATFORM_META.map((p) => p.key)));\n\n const year = currentDate.getFullYear();\n const month = currentDate.getMonth();\n const daysInMonth = getDaysInMonth(year, month);\n const firstDay = getFirstDayOfMonth(year, month);\n\n const monthName = currentDate.toLocaleDateString(\"en-US\", {\n month: \"long\",\n year: \"numeric\",\n });\n\n const navigateMonth = (direction: number) => {\n setCurrentDate(new Date(year, month + direction, 1));\n };\n\n const navigateWeek = (direction: number) => {\n const d = new Date(currentDate);\n d.setDate(d.getDate() + direction * 7);\n setCurrentDate(d);\n };\n\n const socialAccounts = useMemo<SocialMediaAccount[]>(() => {\n const items = data?.headshotmarketingSocialAccounts.items ?? [];\n return items.map((item: Parameters<typeof toSocialAccountModel>[0]) =>\n toSocialAccountModel(item),\n );\n }, [data?.headshotmarketingSocialAccounts.items]);\n\n const accountNameById = useMemo(\n () =>\n Object.fromEntries(\n (data?.headshotmarketingSocialAccounts.items ?? []).map(\n (item: { id: string; accountName: string }) => [\n item.id,\n item.accountName,\n ],\n ),\n ),\n [data?.headshotmarketingSocialAccounts.items],\n );\n\n const accountPlatformById = useMemo(\n () =>\n Object.fromEntries(\n socialAccounts.map((item) => [item.id, item.platform]),\n ),\n [socialAccounts],\n );\n\n const socialPosts = useMemo<SocialMediaPost[]>(() => {\n const items = data?.headshotmarketingSocialPosts.items ?? [];\n return items.map((item: Parameters<typeof toSocialPostModel>[0]) =>\n toSocialPostModel(item, accountNameById, accountPlatformById),\n );\n }, [\n data?.headshotmarketingSocialPosts.items,\n accountNameById,\n accountPlatformById,\n ]);\n\n const platformFollowers = useMemo(\n () => followersByPlatform(socialAccounts),\n [socialAccounts],\n );\n\n const calendarPosts = useMemo(\n () => toCalendarPosts(socialPosts),\n [socialPosts],\n );\n\n const filteredPosts = useMemo(\n () => calendarPosts.filter((p) => visiblePlatforms.has(p.platform)),\n [visiblePlatforms, calendarPosts],\n );\n\n const getPostsForDate = (dateStr: string) =>\n filteredPosts.filter((p) => p.date === dateStr);\n\n const todayStr = toDateKey(new Date());\n const todayPosts = filteredPosts.filter((p) => p.date === todayStr);\n const upcomingPosts = filteredPosts\n .filter((p) => p.date > todayStr && p.status === \"scheduled\")\n .sort((a, b) => a.date.localeCompare(b.date))\n .slice(0, 5);\n\n const publishedCount = filteredPosts.filter(\n (p) => p.status === \"published\",\n ).length;\n const scheduledCount = filteredPosts.filter(\n (p) => p.status === \"scheduled\",\n ).length;\n const draftCount = filteredPosts.filter((p) => p.status === \"draft\").length;\n\n // Week view range\n const weekStart = new Date(currentDate);\n weekStart.setDate(weekStart.getDate() - weekStart.getDay());\n\n const calendarCells: (number | null)[] = [];\n for (let i = 0; i < firstDay; i++) calendarCells.push(null);\n for (let d = 1; d <= daysInMonth; d++) calendarCells.push(d);\n while (calendarCells.length % 7 !== 0) calendarCells.push(null);\n\n return (\n <PageLayout\n title=\"Content Calendar\"\n description=\"Plan and visualize your content schedule\"\n actions={\n <button\n onClick={() => navigate(basePath + \"/social/compose\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90\"\n >\n + New Post\n </button>\n }\n >\n <PagePurpose>\n Plan your posting cadence at a glance. See everything scheduled across\n channels on a month or week view, spot gaps and clashes, and jump\n straight into composing for any day — so your content goes out\n consistently.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"headshotmarketing-content-calendar\"\n steps={[\n {\n id: \"compose\",\n label: \"Compose a post\",\n description: \"Draft and schedule a post for any channel.\",\n onClick: () => navigate(basePath + \"/social/compose\"),\n },\n {\n id: \"accounts\",\n label: \"Connect accounts\",\n description: \"Link the social accounts you publish to.\",\n onClick: () => navigate(basePath + \"/social/accounts\"),\n },\n {\n id: \"posts\",\n label: \"Review all posts\",\n description: \"See every draft, scheduled and published post.\",\n onClick: () => navigate(basePath + \"/social/posts\"),\n },\n ]}\n />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-[240px_minmax(0,1fr)]\">\n {/* Calendar - Main area (second on desktop, after the filter sidebar) */}\n <div className=\"min-w-0 space-y-4 lg:order-2\">\n {/* Controls */}\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() =>\n viewMode === \"month\" ? navigateMonth(-1) : navigateWeek(-1)\n }\n className=\"rounded-md border border-border-subtle p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n <h2 className=\"text-lg font-semibold text-text-primary min-w-[180px] text-center\">\n {monthName}\n </h2>\n <button\n onClick={() =>\n viewMode === \"month\" ? navigateMonth(1) : navigateWeek(1)\n }\n className=\"rounded-md border border-border-subtle p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex rounded-md border border-border-subtle\">\n <button\n onClick={() => setViewMode(\"month\")}\n className={cn(\n \"px-3 py-2 text-sm\",\n viewMode === \"month\"\n ? \"bg-foreground text-background\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n Month\n </button>\n <button\n onClick={() => setViewMode(\"week\")}\n className={cn(\n \"px-3 py-2 text-sm\",\n viewMode === \"week\"\n ? \"bg-foreground text-background\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n Week\n </button>\n </div>\n </div>\n </div>\n\n {/* Month Grid */}\n {viewMode === \"month\" && (\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-x-auto\">\n <div className=\"grid min-w-[560px] grid-cols-7\">\n {DAYS.map((d) => (\n <div\n key={d}\n className=\"border-b border-r border-border-subtle px-2 py-2 text-center text-xs font-medium text-text-secondary\"\n >\n {d}\n </div>\n ))}\n {calendarCells.map((day, idx) => {\n const dateStr = day\n ? `${year}-${String(month + 1).padStart(2, \"0\")}-${String(day).padStart(2, \"0\")}`\n : \"\";\n const dayPosts = day ? getPostsForDate(dateStr) : [];\n const isToday = dateStr === todayStr;\n return (\n <div\n key={idx}\n onClick={\n day\n ? () => navigate(basePath + \"/social/compose\")\n : undefined\n }\n title={day ? \"Compose a post\" : undefined}\n className={cn(\n \"min-h-[80px] border-b border-r border-border-subtle p-1\",\n !day && \"bg-bg-sunken/30\",\n isToday && \"bg-status-info-bg/50\",\n day &&\n \"cursor-pointer transition-colors hover:bg-bg-sunken/40\",\n )}\n >\n {day && (\n <>\n <span\n className={cn(\n \"text-xs font-medium\",\n isToday\n ? \"text-status-info-text font-bold\"\n : \"text-text-secondary\",\n )}\n >\n {day}\n </span>\n <div className=\"mt-0.5 space-y-0.5\">\n {dayPosts.slice(0, 3).map((post) => (\n <div\n key={post.id}\n className={cn(\n \"rounded px-1 py-0.5 text-[10px] text-white truncate\",\n platformColors[post.platform],\n )}\n >\n {post.title}\n </div>\n ))}\n {dayPosts.length > 3 && (\n <span className=\"text-[10px] text-text-secondary\">\n +{dayPosts.length - 3} more\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n )}\n\n {/* Week View */}\n {viewMode === \"week\" && (\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-x-auto\">\n <div className=\"grid min-w-[560px] grid-cols-7\">\n {Array.from({ length: 7 }).map((_, i) => {\n const d = new Date(weekStart);\n d.setDate(d.getDate() + i);\n const dateStr = toDateKey(d);\n const dayPosts = getPostsForDate(dateStr);\n const isToday = dateStr === todayStr;\n return (\n <div\n key={i}\n className={cn(\n \"border-r border-border-subtle p-3 min-h-[200px]\",\n isToday && \"bg-status-info-bg/50\",\n )}\n >\n <div className=\"text-center mb-2\">\n <div className=\"text-xs text-text-secondary\">\n {DAYS[i]}\n </div>\n <div\n className={cn(\n \"text-sm font-medium\",\n isToday\n ? \"text-status-info-text\"\n : \"text-text-primary\",\n )}\n >\n {d.getDate()}\n </div>\n </div>\n <div className=\"space-y-1\">\n {dayPosts.map((post) => (\n <div\n key={post.id}\n className={cn(\n \"rounded px-2 py-1 text-xs text-white\",\n platformColors[post.platform],\n )}\n >\n <div className=\"font-medium truncate\">\n {post.title}\n </div>\n <div className=\"text-[10px] opacity-80 capitalize\">\n {post.status}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n )}\n </div>\n\n {/* Sidebar: platform filter (mockup 05) + day/queue/month summaries */}\n <div className=\"space-y-4 lg:order-1\">\n <CalendarPlatformFilter\n selected={visiblePlatforms}\n followers={platformFollowers}\n onChange={setVisiblePlatforms}\n />\n\n {/* Today's Posts */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <CalendarDays className=\"h-4 w-4\" />\n Today\n </h3>\n {todayPosts.length > 0 ? (\n <div className=\"space-y-2\">\n {todayPosts.map((p) => (\n <div key={p.id} className=\"flex items-center gap-2 text-sm\">\n <span\n className={cn(\n \"h-2 w-2 rounded-full\",\n platformColors[p.platform],\n )}\n />\n <span className=\"text-text-primary\">{p.title}</span>\n </div>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n No posts scheduled for today\n </p>\n )}\n </div>\n\n {/* Upcoming Queue */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <Clock className=\"h-4 w-4\" />\n Upcoming Queue\n </h3>\n <div className=\"space-y-2\">\n {upcomingPosts.map((p) => (\n <div\n key={p.id}\n className=\"flex items-center justify-between text-sm\"\n >\n <div className=\"flex items-center gap-2\">\n <span\n className={cn(\n \"h-2 w-2 rounded-full\",\n platformColors[p.platform],\n )}\n />\n <span className=\"text-text-primary truncate\">\n {p.title}\n </span>\n </div>\n <span className=\"text-xs text-text-secondary whitespace-nowrap ms-2\">\n {new Date(p.date).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n })}\n </span>\n </div>\n ))}\n </div>\n </div>\n\n {/* Quick Stats — primary emphasis zone */}\n <EmphasisPanel className=\"p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <BarChart3 className=\"h-4 w-4\" />\n This Month\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Published</span>\n <span className=\"font-medium text-status-success-text\">\n {publishedCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Scheduled</span>\n <span className=\"font-medium text-action-primary-bg\">\n {scheduledCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Drafts</span>\n <span className=\"font-medium text-text-secondary\">\n {draftCount}\n </span>\n </div>\n </div>\n </EmphasisPanel>\n </div>\n </div>\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAMC,IAAyC;CAC7C,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;AACV;AAIA,SAASC,EAAU,GAAoB;CAIrC,OAAO,GAHMC,EAAK,YAGR,EAAK,GAFD,OAAOA,EAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAEpC,EAAM,GADZ,OAAOA,EAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAG,GACpB;AAC7B;AAEA,IAAMC,IAAO;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAE7D,SAASC,EAAe,GAAc,GAAe;CACnD,OAAO,IAAI,KAAKC,GAAMC,IAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ;AAC9C;AAEA,SAASC,EAAmB,GAAc,GAAe;CACvD,OAAO,IAAI,KAAKF,GAAMC,GAAO,CAAC,CAAC,CAAC,OAAO;AACzC;AAEA,IAAaE,UAAgC;CAC3C,IAAM,EAAE,aAAU,gBAAaC,GAAqB,GAC9C,EAAE,SAAM,YAAS,UAAO,eAAYC,EAA8B,GAClE,CAACC,GAAUC,KAAeC,EAAmB,OAAO,GACpD,CAACC,GAAaC,KA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YAAsB,UAAA;WAAe,CAAA,GACrD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAA1B;WACG,CAAA,CACH;;UACL,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,QAAD;YAAM,WAAU;YAAsB,UAAA;WAAe,CAAA,GACrD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAC;WACG,CAAA,CACH;;UACL,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,QAAD;YAAM,WAAU;YAAsB,UAAA;WAAY,CAAA,GAClD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAC;WACG,CAAA,CACH;;SACF;QACQ,CAAA,CAAA;;MACZ;KACF,CAAA,CAAA;;GACa,CAAA;EACV;;AAEhB"}
1
+ {"version":3,"file":"ContentCalendarPage.js","names":["_Fragment","platformColors","toDateKey","date","DAYS","getDaysInMonth","year","month","getFirstDayOfMonth","ContentCalendarPage","useHeadshotMarketing","useHeadshotmarketingBootstrap","viewMode","setViewMode","useState","currentDate","setCurrentDate","visiblePlatforms","setVisiblePlatforms","PLATFORM_META","p","daysInMonth","firstDay","monthName","navigateMonth","direction","navigateWeek","d","socialAccounts","useMemo","data","toSocialAccountModel","item","accountNameById","accountPlatformById","socialPosts","toSocialPostModel","platformFollowers","followersByPlatform","calendarPosts","toCalendarPosts","filteredPosts","getPostsForDate","dateStr","todayStr","todayPosts","upcomingPosts","a","b","publishedCount","scheduledCount","draftCount","weekStart","calendarCells","i","PageLayout","navigate","basePath","PagePurpose","NextSteps","QueryStateBoundary","refetch","ChevronLeft","ChevronRight","cn","day","dayPosts","isToday","Fragment","post","idx","CalendarPlatformFilter","CalendarDays","Clock","EmphasisPanel","BarChart3"],"sources":["../../../../src/headshotmarketing/pages/social-media/ContentCalendarPage.tsx"],"sourcesContent":["import { useState, useMemo, type FC } from \"react\";\nimport {\n ChevronLeft,\n ChevronRight,\n CalendarDays,\n Clock,\n BarChart3,\n} from \"lucide-react\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n toCalendarPosts,\n toSocialAccountModel,\n toSocialPostModel,\n} from \"../../utils/socialMapper\";\nimport { PageLayout, QueryStateBoundary } from \"../../components\";\nimport { PagePurpose, EmphasisPanel, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks\";\nimport type {\n SocialMediaAccount,\n SocialMediaPlatform,\n SocialMediaPost,\n} from \"../../types\";\nimport { followersByPlatform } from \"../../utils/socialAccountStats\";\nimport { CalendarPlatformFilter } from \"./CalendarPlatformFilter\";\nimport { PLATFORM_META } from \"./socialComposerMeta\";\n\nconst platformColors: Record<string, string> = {\n instagram: \"bg-action-primary-bg\",\n facebook: \"bg-status-info-text\",\n twitter: \"bg-status-info-text\",\n linkedin: \"bg-status-info-text\",\n youtube: \"bg-status-error-text\",\n tiktok: \"bg-bg-sunken\",\n};\n\ntype ViewMode = \"month\" | \"week\";\n\nfunction toDateKey(date: Date): string {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\nconst DAYS = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\nfunction getDaysInMonth(year: number, month: number) {\n return new Date(year, month + 1, 0).getDate();\n}\n\nfunction getFirstDayOfMonth(year: number, month: number) {\n return new Date(year, month, 1).getDay();\n}\n\nexport const ContentCalendarPage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const [viewMode, setViewMode] = useState<ViewMode>(\"month\");\n const [currentDate, setCurrentDate] = useState(() => new Date());\n const [visiblePlatforms, setVisiblePlatforms] = useState<\n Set<SocialMediaPlatform>\n >(() => new Set(PLATFORM_META.map((p) => p.key)));\n\n const year = currentDate.getFullYear();\n const month = currentDate.getMonth();\n const daysInMonth = getDaysInMonth(year, month);\n const firstDay = getFirstDayOfMonth(year, month);\n\n const monthName = currentDate.toLocaleDateString(\"en-US\", {\n month: \"long\",\n year: \"numeric\",\n });\n\n const navigateMonth = (direction: number) => {\n setCurrentDate(new Date(year, month + direction, 1));\n };\n\n const navigateWeek = (direction: number) => {\n const d = new Date(currentDate);\n d.setDate(d.getDate() + direction * 7);\n setCurrentDate(d);\n };\n\n const socialAccounts = useMemo<SocialMediaAccount[]>(() => {\n const items = data?.headshotmarketingSocialAccounts.items ?? [];\n return items.map((item: Parameters<typeof toSocialAccountModel>[0]) =>\n toSocialAccountModel(item),\n );\n }, [data?.headshotmarketingSocialAccounts.items]);\n\n const accountNameById = useMemo(\n () =>\n Object.fromEntries(\n (data?.headshotmarketingSocialAccounts.items ?? []).map(\n (item: { id: string; accountName: string }) => [\n item.id,\n item.accountName,\n ],\n ),\n ),\n [data?.headshotmarketingSocialAccounts.items],\n );\n\n const accountPlatformById = useMemo(\n () =>\n Object.fromEntries(\n socialAccounts.map((item) => [item.id, item.platform]),\n ),\n [socialAccounts],\n );\n\n const socialPosts = useMemo<SocialMediaPost[]>(() => {\n const items = data?.headshotmarketingSocialPosts.items ?? [];\n return items.map((item: Parameters<typeof toSocialPostModel>[0]) =>\n toSocialPostModel(item, accountNameById, accountPlatformById),\n );\n }, [\n data?.headshotmarketingSocialPosts.items,\n accountNameById,\n accountPlatformById,\n ]);\n\n const platformFollowers = useMemo(\n () => followersByPlatform(socialAccounts),\n [socialAccounts],\n );\n\n const calendarPosts = useMemo(\n () => toCalendarPosts(socialPosts),\n [socialPosts],\n );\n\n const filteredPosts = useMemo(\n () => calendarPosts.filter((p) => visiblePlatforms.has(p.platform)),\n [visiblePlatforms, calendarPosts],\n );\n\n const getPostsForDate = (dateStr: string) =>\n filteredPosts.filter((p) => p.date === dateStr);\n\n const todayStr = toDateKey(new Date());\n const todayPosts = filteredPosts.filter((p) => p.date === todayStr);\n const upcomingPosts = filteredPosts\n .filter((p) => p.date > todayStr && p.status === \"scheduled\")\n .sort((a, b) => a.date.localeCompare(b.date))\n .slice(0, 5);\n\n const publishedCount = filteredPosts.filter(\n (p) => p.status === \"published\",\n ).length;\n const scheduledCount = filteredPosts.filter(\n (p) => p.status === \"scheduled\",\n ).length;\n const draftCount = filteredPosts.filter((p) => p.status === \"draft\").length;\n\n // Week view range\n const weekStart = new Date(currentDate);\n weekStart.setDate(weekStart.getDate() - weekStart.getDay());\n\n const calendarCells: (number | null)[] = [];\n for (let i = 0; i < firstDay; i++) calendarCells.push(null);\n for (let d = 1; d <= daysInMonth; d++) calendarCells.push(d);\n while (calendarCells.length % 7 !== 0) calendarCells.push(null);\n\n return (\n <PageLayout\n title=\"Content Calendar\"\n description=\"Plan and visualize your content schedule\"\n actions={\n <button\n onClick={() => navigate(basePath + \"/social/compose\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90\"\n >\n + New Post\n </button>\n }\n >\n <PagePurpose>\n Plan your posting cadence at a glance. See everything scheduled across\n channels on a month or week view, spot gaps and clashes, and jump\n straight into composing for any day — so your content goes out\n consistently.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"headshotmarketing-content-calendar\"\n steps={[\n {\n id: \"compose\",\n label: \"Compose a post\",\n description: \"Draft and schedule a post for any channel.\",\n onClick: () => navigate(basePath + \"/social/compose\"),\n },\n {\n id: \"accounts\",\n label: \"Connect accounts\",\n description: \"Link the social accounts you publish to.\",\n onClick: () => navigate(basePath + \"/social/accounts\"),\n },\n {\n id: \"posts\",\n label: \"Review all posts\",\n description: \"See every draft, scheduled and published post.\",\n onClick: () => navigate(basePath + \"/social/posts\"),\n },\n ]}\n />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-[240px_minmax(0,1fr)]\">\n {/* Calendar - Main area (second on desktop, after the filter sidebar) */}\n <div className=\"min-w-0 space-y-4 lg:order-2\">\n {/* Controls */}\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() =>\n viewMode === \"month\" ? navigateMonth(-1) : navigateWeek(-1)\n }\n className=\"rounded-md border border-border-subtle p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n <h2 className=\"text-lg font-semibold text-text-primary min-w-[180px] text-center\">\n {monthName}\n </h2>\n <button\n onClick={() =>\n viewMode === \"month\" ? navigateMonth(1) : navigateWeek(1)\n }\n className=\"rounded-md border border-border-subtle p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex rounded-md border border-border-subtle\">\n <button\n onClick={() => setViewMode(\"month\")}\n className={cn(\n \"px-3 py-2 text-sm\",\n viewMode === \"month\"\n ? \"bg-foreground text-background\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n Month\n </button>\n <button\n onClick={() => setViewMode(\"week\")}\n className={cn(\n \"px-3 py-2 text-sm\",\n viewMode === \"week\"\n ? \"bg-foreground text-background\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n Week\n </button>\n </div>\n </div>\n </div>\n\n {/* Month Grid */}\n {viewMode === \"month\" && (\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-x-auto\">\n <div className=\"grid min-w-[560px] grid-cols-7\">\n {DAYS.map((d) => (\n <div\n key={d}\n className=\"border-b border-e border-border-subtle px-2 py-2 text-center text-xs font-medium text-text-secondary\"\n >\n {d}\n </div>\n ))}\n {calendarCells.map((day, idx) => {\n const dateStr = day\n ? `${year}-${String(month + 1).padStart(2, \"0\")}-${String(day).padStart(2, \"0\")}`\n : \"\";\n const dayPosts = day ? getPostsForDate(dateStr) : [];\n const isToday = dateStr === todayStr;\n return (\n <div\n key={idx}\n onClick={\n day\n ? () => navigate(basePath + \"/social/compose\")\n : undefined\n }\n title={day ? \"Compose a post\" : undefined}\n className={cn(\n \"min-h-[80px] border-b border-e border-border-subtle p-1\",\n !day && \"bg-bg-sunken/30\",\n isToday && \"bg-status-info-bg/50\",\n day &&\n \"cursor-pointer transition-colors hover:bg-bg-sunken/40\",\n )}\n >\n {day && (\n <>\n <span\n className={cn(\n \"text-xs font-medium\",\n isToday\n ? \"text-status-info-text font-bold\"\n : \"text-text-secondary\",\n )}\n >\n {day}\n </span>\n <div className=\"mt-0.5 space-y-0.5\">\n {dayPosts.slice(0, 3).map((post) => (\n <div\n key={post.id}\n className={cn(\n \"rounded px-1 py-0.5 text-[10px] text-white truncate\",\n platformColors[post.platform],\n )}\n >\n {post.title}\n </div>\n ))}\n {dayPosts.length > 3 && (\n <span className=\"text-[10px] text-text-secondary\">\n +{dayPosts.length - 3} more\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n )}\n\n {/* Week View */}\n {viewMode === \"week\" && (\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-x-auto\">\n <div className=\"grid min-w-[560px] grid-cols-7\">\n {Array.from({ length: 7 }).map((_, i) => {\n const d = new Date(weekStart);\n d.setDate(d.getDate() + i);\n const dateStr = toDateKey(d);\n const dayPosts = getPostsForDate(dateStr);\n const isToday = dateStr === todayStr;\n return (\n <div\n key={i}\n className={cn(\n \"border-e border-border-subtle p-3 min-h-[200px]\",\n isToday && \"bg-status-info-bg/50\",\n )}\n >\n <div className=\"text-center mb-2\">\n <div className=\"text-xs text-text-secondary\">\n {DAYS[i]}\n </div>\n <div\n className={cn(\n \"text-sm font-medium\",\n isToday\n ? \"text-status-info-text\"\n : \"text-text-primary\",\n )}\n >\n {d.getDate()}\n </div>\n </div>\n <div className=\"space-y-1\">\n {dayPosts.map((post) => (\n <div\n key={post.id}\n className={cn(\n \"rounded px-2 py-1 text-xs text-white\",\n platformColors[post.platform],\n )}\n >\n <div className=\"font-medium truncate\">\n {post.title}\n </div>\n <div className=\"text-[10px] opacity-80 capitalize\">\n {post.status}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n )}\n </div>\n\n {/* Sidebar: platform filter (mockup 05) + day/queue/month summaries */}\n <div className=\"space-y-4 lg:order-1\">\n <CalendarPlatformFilter\n selected={visiblePlatforms}\n followers={platformFollowers}\n onChange={setVisiblePlatforms}\n />\n\n {/* Today's Posts */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <CalendarDays className=\"h-4 w-4\" />\n Today\n </h3>\n {todayPosts.length > 0 ? (\n <div className=\"space-y-2\">\n {todayPosts.map((p) => (\n <div key={p.id} className=\"flex items-center gap-2 text-sm\">\n <span\n className={cn(\n \"h-2 w-2 rounded-full\",\n platformColors[p.platform],\n )}\n />\n <span className=\"text-text-primary\">{p.title}</span>\n </div>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n No posts scheduled for today\n </p>\n )}\n </div>\n\n {/* Upcoming Queue */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <Clock className=\"h-4 w-4\" />\n Upcoming Queue\n </h3>\n <div className=\"space-y-2\">\n {upcomingPosts.map((p) => (\n <div\n key={p.id}\n className=\"flex items-center justify-between text-sm\"\n >\n <div className=\"flex items-center gap-2\">\n <span\n className={cn(\n \"h-2 w-2 rounded-full\",\n platformColors[p.platform],\n )}\n />\n <span className=\"text-text-primary truncate\">\n {p.title}\n </span>\n </div>\n <span className=\"text-xs text-text-secondary whitespace-nowrap ms-2\">\n {new Date(p.date).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n })}\n </span>\n </div>\n ))}\n </div>\n </div>\n\n {/* Quick Stats — primary emphasis zone */}\n <EmphasisPanel className=\"p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary mb-3 flex items-center gap-2\">\n <BarChart3 className=\"h-4 w-4\" />\n This Month\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Published</span>\n <span className=\"font-medium text-status-success-text\">\n {publishedCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Scheduled</span>\n <span className=\"font-medium text-action-primary-bg\">\n {scheduledCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Drafts</span>\n <span className=\"font-medium text-text-secondary\">\n {draftCount}\n </span>\n </div>\n </div>\n </EmphasisPanel>\n </div>\n </div>\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAMC,IAAyC;CAC7C,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;AACV;AAIA,SAASC,EAAU,GAAoB;CAIrC,OAAO,GAHMC,EAAK,YAGR,EAAK,GAFD,OAAOA,EAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAEpC,EAAM,GADZ,OAAOA,EAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAG,GACpB;AAC7B;AAEA,IAAMC,IAAO;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAE7D,SAASC,EAAe,GAAc,GAAe;CACnD,OAAO,IAAI,KAAKC,GAAMC,IAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ;AAC9C;AAEA,SAASC,EAAmB,GAAc,GAAe;CACvD,OAAO,IAAI,KAAKF,GAAMC,GAAO,CAAC,CAAC,CAAC,OAAO;AACzC;AAEA,IAAaE,UAAgC;CAC3C,IAAM,EAAE,aAAU,gBAAaC,GAAqB,GAC9C,EAAE,SAAM,YAAS,UAAO,eAAYC,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,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,QAAD;YAAM,WAAU;YAAsB,UAAA;WAAe,CAAA,GACrD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAA1B;WACG,CAAA,CACH;;UACL,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,QAAD;YAAM,WAAU;YAAsB,UAAA;WAAe,CAAA,GACrD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAC;WACG,CAAA,CACH;;UACL,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,QAAD;YAAM,WAAU;YAAsB,UAAA;WAAY,CAAA,GAClD,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAC;WACG,CAAA,CACH;;SACF;QACQ,CAAA,CAAA;;MACZ;KACF,CAAA,CAAA;;GACa,CAAA;EACV;;AAEhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-headshotmarketing",
3
- "version": "2026.1203.3",
3
+ "version": "2026.1205.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Algoshred/microfe-headshotmarketing.git"
@@ -53,7 +53,8 @@
53
53
  "switch:local": "boff deps-mode local",
54
54
  "switch:remote": "boff deps-mode remote",
55
55
  "switch:status": "boff deps-mode status",
56
- "test:storybook": "test-storybook"
56
+ "test:storybook": "test-storybook",
57
+ "check:logical-direction": "bun scripts/check-logical-direction.ts"
57
58
  },
58
59
  "dependencies": {
59
60
  "@apollo/client": "^4.3.7",
@@ -144,6 +145,9 @@
144
145
  "sanity": {
145
146
  "formatPaths": [
146
147
  "src"
148
+ ],
149
+ "extra": [
150
+ "check:logical-direction"
147
151
  ]
148
152
  }
149
153
  }