@burdenoff/microfe-theculturepost 2026.1203.1 → 2026.1203.3
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.
- package/dist/theculturepost/TheCulturePostRoutes.js +12 -4
- package/dist/theculturepost/TheCulturePostRoutes.js.map +1 -1
- package/dist/theculturepost/components/AiContextPanel.js +25 -7
- package/dist/theculturepost/components/AiContextPanel.js.map +1 -1
- package/dist/theculturepost/components/ArchiveItemCard.js +2 -2
- package/dist/theculturepost/components/ArchiveItemCard.js.map +1 -1
- package/dist/theculturepost/components/AudioRecorderControl.js +2 -2
- package/dist/theculturepost/components/AudioRecorderControl.js.map +1 -1
- package/dist/theculturepost/components/CollectionCard.js +2 -2
- package/dist/theculturepost/components/CollectionCard.js.map +1 -1
- package/dist/theculturepost/components/CommunityNorms.js +1 -1
- package/dist/theculturepost/components/CommunityNorms.js.map +1 -1
- package/dist/theculturepost/components/CreateStoryDialog.js +5 -5
- package/dist/theculturepost/components/CreateStoryDialog.js.map +1 -1
- package/dist/theculturepost/components/DiscussionCard.js +1 -1
- package/dist/theculturepost/components/DiscussionCard.js.map +1 -1
- package/dist/theculturepost/components/FileUploadField.js +1 -1
- package/dist/theculturepost/components/FileUploadField.js.map +1 -1
- package/dist/theculturepost/components/FilterTabs.js +1 -1
- package/dist/theculturepost/components/FilterTabs.js.map +1 -1
- package/dist/theculturepost/components/FollowButton.d.ts +8 -0
- package/dist/theculturepost/components/FollowButton.js +41 -0
- package/dist/theculturepost/components/FollowButton.js.map +1 -0
- package/dist/theculturepost/components/FramingPrompts.js +1 -1
- package/dist/theculturepost/components/FramingPrompts.js.map +1 -1
- package/dist/theculturepost/components/HistoryTimeline.js +3 -3
- package/dist/theculturepost/components/HistoryTimeline.js.map +1 -1
- package/dist/theculturepost/components/OpenDiscussionDialog.js +1 -1
- package/dist/theculturepost/components/OpenDiscussionDialog.js.map +1 -1
- package/dist/theculturepost/components/OverlayBadge.js +4 -4
- package/dist/theculturepost/components/OverlayBadge.js.map +1 -1
- package/dist/theculturepost/components/Pagination.js +2 -2
- package/dist/theculturepost/components/Pagination.js.map +1 -1
- package/dist/theculturepost/components/PendingOralHistoryPanel.js +2 -2
- package/dist/theculturepost/components/PendingOralHistoryPanel.js.map +1 -1
- package/dist/theculturepost/components/ReaderContextDrawer.d.ts +15 -0
- package/dist/theculturepost/components/ReaderContextDrawer.js +223 -0
- package/dist/theculturepost/components/ReaderContextDrawer.js.map +1 -0
- package/dist/theculturepost/components/RecordOralHistoryDialog.js +2 -2
- package/dist/theculturepost/components/RecordOralHistoryDialog.js.map +1 -1
- package/dist/theculturepost/components/ReplyThread.js +2 -2
- package/dist/theculturepost/components/ReplyThread.js.map +1 -1
- package/dist/theculturepost/components/SourceHealthAndReputation.d.ts +10 -0
- package/dist/theculturepost/components/SourceHealthAndReputation.js +41 -0
- package/dist/theculturepost/components/SourceHealthAndReputation.js.map +1 -0
- package/dist/theculturepost/components/StoryCard.js +3 -3
- package/dist/theculturepost/components/StoryCard.js.map +1 -1
- package/dist/theculturepost/components/TopicCard.js +2 -2
- package/dist/theculturepost/components/TopicCard.js.map +1 -1
- package/dist/theculturepost/components/TopicTimelineWidget.js +1 -1
- package/dist/theculturepost/components/TopicTimelineWidget.js.map +1 -1
- package/dist/theculturepost/components/index.js +3 -3
- package/dist/theculturepost/hooks/index.js +7 -7
- package/dist/theculturepost/hooks/useTcpApi.d.ts +63 -1
- package/dist/theculturepost/hooks/useTcpApi.js +298 -49
- package/dist/theculturepost/hooks/useTcpApi.js.map +1 -1
- package/dist/theculturepost/pages/HomePage.js +6 -6
- package/dist/theculturepost/pages/HomePage.js.map +1 -1
- package/dist/theculturepost/pages/archive/ArchiveItemDetailPage.js +163 -143
- package/dist/theculturepost/pages/archive/ArchiveItemDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/archive/ArchivePage.js +173 -137
- package/dist/theculturepost/pages/archive/ArchivePage.js.map +1 -1
- package/dist/theculturepost/pages/archive/CollectionDetailPage.js +6 -6
- package/dist/theculturepost/pages/archive/CollectionDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/curriculum/CurriculumPage.d.ts +10 -0
- package/dist/theculturepost/pages/curriculum/CurriculumPage.js +401 -0
- package/dist/theculturepost/pages/curriculum/CurriculumPage.js.map +1 -0
- package/dist/theculturepost/pages/discussions/DiscussionDetailPage.js +3 -3
- package/dist/theculturepost/pages/discussions/DiscussionDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/discussions/DiscussionsPage.js +2 -2
- package/dist/theculturepost/pages/discussions/DiscussionsPage.js.map +1 -1
- package/dist/theculturepost/pages/governance/AiOpsPanel.d.ts +13 -0
- package/dist/theculturepost/pages/governance/AiOpsPanel.js +369 -0
- package/dist/theculturepost/pages/governance/AiOpsPanel.js.map +1 -0
- package/dist/theculturepost/pages/governance/GovernancePage.d.ts +1 -1
- package/dist/theculturepost/pages/governance/GovernancePage.js +107 -95
- package/dist/theculturepost/pages/governance/GovernancePage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoriesPage.js +113 -74
- package/dist/theculturepost/pages/stories/StoriesPage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoryCitationsPage.js +5 -5
- package/dist/theculturepost/pages/stories/StoryCitationsPage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoryDetailPage.js +291 -275
- package/dist/theculturepost/pages/stories/StoryDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/studio/ContributorStudioPage.d.ts +12 -0
- package/dist/theculturepost/pages/studio/ContributorStudioPage.js +463 -0
- package/dist/theculturepost/pages/studio/ContributorStudioPage.js.map +1 -0
- package/dist/theculturepost/pages/timeline/TimelinePage.js +2 -2
- package/dist/theculturepost/pages/timeline/TimelinePage.js.map +1 -1
- package/dist/theculturepost/pages/topics/TopicDetailPage.js +66 -55
- package/dist/theculturepost/pages/topics/TopicDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/topics/TopicsPage.js +1 -1
- package/dist/theculturepost/pages/topics/TopicsPage.js.map +1 -1
- package/dist/theculturepost/types/index.d.ts +227 -2
- package/package.json +6 -4
|
@@ -38,17 +38,17 @@ function h(e, t) {
|
|
|
38
38
|
children: e
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
var g = i(() => import("./pages/stories/StoriesPage.js").then((e) => ({ default: e.StoriesPage }))), _ = i(() => import("./pages/stories/StoryDetailPage.js").then((e) => ({ default: e.StoryDetailPage }))), v = i(() => import("./pages/stories/StoryCitationsPage.js").then((e) => ({ default: e.StoryCitationsPage }))), y = i(() => import("./pages/stories/SavedStoriesPage.js").then((e) => ({ default: e.SavedStoriesPage }))), b = i(() => import("./pages/topics/TopicsPage.js").then((e) => ({ default: e.TopicsPage }))), x = i(() => import("./pages/topics/TopicDetailPage.js").then((e) => ({ default: e.TopicDetailPage }))), S = i(() => import("./pages/discussions/DiscussionsPage.js").then((e) => ({ default: e.DiscussionsPage }))), C = i(() => import("./pages/discussions/DiscussionDetailPage.js").then((e) => ({ default: e.DiscussionDetailPage }))), w = i(() => import("./pages/timeline/TimelinePage.js").then((e) => ({ default: e.TimelinePage }))), T = i(() => import("./pages/governance/GovernancePage.js").then((e) => ({ default: e.GovernancePage }))), E = i(() => import("./pages/archive/ArchivePage.js").then((e) => ({ default: e.ArchivePage }))), D = i(() => import("./pages/archive/CollectionDetailPage.js").then((e) => ({ default: e.CollectionDetailPage }))), O = i(() => import("./pages/archive/ArchiveItemDetailPage.js").then((e) => ({ default: e.ArchiveItemDetailPage }))), k = () => /* @__PURE__ */ u("div", {
|
|
41
|
+
var g = i(() => import("./pages/stories/StoriesPage.js").then((e) => ({ default: e.StoriesPage }))), _ = i(() => import("./pages/stories/StoryDetailPage.js").then((e) => ({ default: e.StoryDetailPage }))), v = i(() => import("./pages/stories/StoryCitationsPage.js").then((e) => ({ default: e.StoryCitationsPage }))), y = i(() => import("./pages/stories/SavedStoriesPage.js").then((e) => ({ default: e.SavedStoriesPage }))), b = i(() => import("./pages/topics/TopicsPage.js").then((e) => ({ default: e.TopicsPage }))), x = i(() => import("./pages/topics/TopicDetailPage.js").then((e) => ({ default: e.TopicDetailPage }))), S = i(() => import("./pages/discussions/DiscussionsPage.js").then((e) => ({ default: e.DiscussionsPage }))), C = i(() => import("./pages/discussions/DiscussionDetailPage.js").then((e) => ({ default: e.DiscussionDetailPage }))), w = i(() => import("./pages/timeline/TimelinePage.js").then((e) => ({ default: e.TimelinePage }))), T = i(() => import("./pages/governance/GovernancePage.js").then((e) => ({ default: e.GovernancePage }))), E = i(() => import("./pages/archive/ArchivePage.js").then((e) => ({ default: e.ArchivePage }))), D = i(() => import("./pages/archive/CollectionDetailPage.js").then((e) => ({ default: e.CollectionDetailPage }))), O = i(() => import("./pages/archive/ArchiveItemDetailPage.js").then((e) => ({ default: e.ArchiveItemDetailPage }))), k = i(() => import("./pages/studio/ContributorStudioPage.js").then((e) => ({ default: e.ContributorStudioPage }))), A = i(() => import("./pages/curriculum/CurriculumPage.js").then((e) => ({ default: e.CurriculumPage }))), j = () => /* @__PURE__ */ u("div", {
|
|
42
42
|
className: "flex min-h-[400px] items-center justify-center",
|
|
43
43
|
children: /* @__PURE__ */ u(f, { size: "lg" })
|
|
44
|
-
}),
|
|
44
|
+
}), M = () => {
|
|
45
45
|
let { basePath: i, isStandalone: a } = e(), f = l();
|
|
46
46
|
t();
|
|
47
47
|
let m = i === "/" ? "" : (i ?? "").replace(/\/$/, "");
|
|
48
48
|
return m && !a && !(f.pathname === m || f.pathname.startsWith(m + "/")) ? null : /* @__PURE__ */ u("div", {
|
|
49
49
|
className: "flex min-h-full flex-col",
|
|
50
50
|
children: /* @__PURE__ */ u(r, {
|
|
51
|
-
fallback: /* @__PURE__ */ u(
|
|
51
|
+
fallback: /* @__PURE__ */ u(j, {}),
|
|
52
52
|
children: /* @__PURE__ */ d(c, { children: [
|
|
53
53
|
/* @__PURE__ */ u(s, {
|
|
54
54
|
index: !0,
|
|
@@ -118,6 +118,14 @@ var g = i(() => import("./pages/stories/StoriesPage.js").then((e) => ({ default:
|
|
|
118
118
|
path: "archive/items/:id",
|
|
119
119
|
element: h(/* @__PURE__ */ u(O, {}), p.archive)
|
|
120
120
|
}),
|
|
121
|
+
/* @__PURE__ */ u(s, {
|
|
122
|
+
path: "studio",
|
|
123
|
+
element: h(/* @__PURE__ */ u(k, {}), p.stories)
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ u(s, {
|
|
126
|
+
path: "curriculum",
|
|
127
|
+
element: h(/* @__PURE__ */ u(A, {}), p.archive)
|
|
128
|
+
}),
|
|
121
129
|
/* @__PURE__ */ u(s, {
|
|
122
130
|
path: "*",
|
|
123
131
|
element: /* @__PURE__ */ u(o, {
|
|
@@ -129,6 +137,6 @@ var g = i(() => import("./pages/stories/StoriesPage.js").then((e) => ({ default:
|
|
|
129
137
|
})
|
|
130
138
|
});
|
|
131
139
|
};
|
|
132
|
-
export {
|
|
140
|
+
export { M as TheCulturePostRoutes };
|
|
133
141
|
|
|
134
142
|
//# sourceMappingURL=TheCulturePostRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TheCulturePostRoutes.js","names":["FEATURE","FeatureDisabledFallback","gated","FeatureGate","element","StoriesPage","lazy","m","StoryDetailPage","StoryCitationsPage","SavedStoriesPage","TopicsPage","TopicDetailPage","DiscussionsPage","DiscussionDetailPage","TimelinePage","GovernancePage","ArchivePage","CollectionDetailPage","ArchiveItemDetailPage","PageLoader","Spinner","TheCulturePostRoutes","useTheCulturePost","location","useLocation","normalizedBasePath","basePath","isStandalone","Suspense","Routes","Route","HomePage","Navigate"],"sources":["../../src/theculturepost/TheCulturePostRoutes.tsx"],"sourcesContent":["/**\n * TheCulturePost Routes\n * @module theculturepost\n *\n * Domain routes. The editorial home page is eager-loaded (primary landing); all\n * other pages are lazy-loaded. Every route maps to a real `tcp*` backend\n * capability.\n */\n\nimport { type FC, lazy, Suspense, type ReactElement } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useTheCulturePost } from './context/TheCulturePostContext';\nimport { usePageAnalytics } from './hooks/usePageAnalytics';\n\nconst FEATURE = {\n home: 'theculturepost.home',\n overview: 'theculturepost.overview',\n admin: 'theculturepost.admin',\n stories: 'theculturepost.stories',\n topics: 'theculturepost.topics',\n timeline: 'theculturepost.timeline',\n discussions: 'theculturepost.discussions',\n archive: 'theculturepost.archive',\n saved: 'theculturepost.saved',\n} as const;\n\nfunction FeatureDisabledFallback(): ReactElement {\n return (\n <div className=\"flex min-h-[400px] flex-col items-center justify-center gap-3 text-text-secondary\">\n <span className=\"text-lg font-semibold text-text-primary\">Feature unavailable</span>\n <span className=\"text-sm\">This page is disabled in your workspace.</span>\n </div>\n );\n}\n\nfunction gated(element: ReactElement, flag: string): ReactElement {\n return (\n <FeatureGate flag={flag} defaultValue fallback={<FeatureDisabledFallback />}>\n {element}\n </FeatureGate>\n );\n}\n\n// Eager — primary landing\nimport { HomePage } from './pages/HomePage';\n\n// Stories\nconst StoriesPage = lazy(() =>\n import('./pages/stories/StoriesPage').then((m) => ({ default: m.StoriesPage }))\n);\nconst StoryDetailPage = lazy(() =>\n import('./pages/stories/StoryDetailPage').then((m) => ({ default: m.StoryDetailPage }))\n);\nconst StoryCitationsPage = lazy(() =>\n import('./pages/stories/StoryCitationsPage').then((m) => ({ default: m.StoryCitationsPage }))\n);\nconst SavedStoriesPage = lazy(() =>\n import('./pages/stories/SavedStoriesPage').then((m) => ({ default: m.SavedStoriesPage }))\n);\n\n// Topics\nconst TopicsPage = lazy(() =>\n import('./pages/topics/TopicsPage').then((m) => ({ default: m.TopicsPage }))\n);\nconst TopicDetailPage = lazy(() =>\n import('./pages/topics/TopicDetailPage').then((m) => ({ default: m.TopicDetailPage }))\n);\n\n// Discussions\nconst DiscussionsPage = lazy(() =>\n import('./pages/discussions/DiscussionsPage').then((m) => ({ default: m.DiscussionsPage }))\n);\nconst DiscussionDetailPage = lazy(() =>\n import('./pages/discussions/DiscussionDetailPage').then((m) => ({\n default: m.DiscussionDetailPage,\n }))\n);\n\n// Timeline\nconst TimelinePage = lazy(() =>\n import('./pages/timeline/TimelinePage').then((m) => ({ default: m.TimelinePage }))\n);\n\n// Governance / Overview\nconst GovernancePage = lazy(() =>\n import('./pages/governance/GovernancePage').then((m) => ({ default: m.GovernancePage }))\n);\n\n// Archive\nconst ArchivePage = lazy(() =>\n import('./pages/archive/ArchivePage').then((m) => ({ default: m.ArchivePage }))\n);\nconst CollectionDetailPage = lazy(() =>\n import('./pages/archive/CollectionDetailPage').then((m) => ({ default: m.CollectionDetailPage }))\n);\nconst ArchiveItemDetailPage = lazy(() =>\n import('./pages/archive/ArchiveItemDetailPage').then((m) => ({\n default: m.ArchiveItemDetailPage,\n }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nexport const TheCulturePostRoutes: FC = () => {\n const { basePath, isStandalone } = useTheCulturePost();\n const location = useLocation();\n\n usePageAnalytics();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated(<HomePage />, FEATURE.home)} />\n\n <Route path=\"overview\" element={gated(<GovernancePage />, FEATURE.overview)} />\n <Route path=\"overview/:tab\" element={gated(<GovernancePage />, FEATURE.overview)} />\n <Route\n path=\"admin\"\n element={gated(<GovernancePage defaultTab=\"review\" />, FEATURE.admin)}\n />\n <Route path=\"admin/:tab\" element={gated(<GovernancePage />, FEATURE.admin)} />\n\n <Route path=\"stories\" element={gated(<StoriesPage />, FEATURE.stories)} />\n <Route path=\"stories/:id\" element={gated(<StoryDetailPage />, FEATURE.stories)} />\n <Route\n path=\"stories/:id/citations\"\n element={gated(<StoryCitationsPage />, FEATURE.stories)}\n />\n\n <Route path=\"saved\" element={gated(<SavedStoriesPage />, FEATURE.saved)} />\n\n <Route path=\"topics\" element={gated(<TopicsPage />, FEATURE.topics)} />\n <Route path=\"topics/:id\" element={gated(<TopicDetailPage />, FEATURE.topics)} />\n\n <Route path=\"timeline\" element={gated(<TimelinePage />, FEATURE.timeline)} />\n\n <Route path=\"discussions\" element={gated(<DiscussionsPage />, FEATURE.discussions)} />\n <Route\n path=\"discussions/:id\"\n element={gated(<DiscussionDetailPage />, FEATURE.discussions)}\n />\n\n <Route path=\"archive\" element={gated(<ArchivePage />, FEATURE.archive)} />\n <Route\n path=\"archive/collections/:id\"\n element={gated(<CollectionDetailPage />, FEATURE.archive)}\n />\n <Route\n path=\"archive/items/:id\"\n element={gated(<ArchiveItemDetailPage />, FEATURE.archive)}\n />\n\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAMA,IAAU;CACd,MAAM;CACN,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,UAAU;CACV,aAAa;CACb,SAAS;CACT,OAAO;AACT;AAEA,SAASC,IAAwC;CAC/C,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,QAAD;GAAM,WAAU;GAA0C,UAAA;EAAyB,CAAA,GACnF,kBAAC,QAAD;GAAM,WAAU;GAAU,UAAA;EAA8C,CAAA,CACrE;;AAET;AAEA,SAASC,EAAM,GAAuB,GAA4B;CAChE,OACE,kBAACC,GAAD;EAAmB;EAAM,cAAA;EAAa,UAAU,kBAACF,GAAD,CAA0B,CAAA;EACvE,UAAAG;CACU,CAAA;AAEjB;AAMA,IAAMC,IAAcC,QAClB,OAA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AAA;IAAI,CAAA;GAChD,EAAA,CAAA;EACA,CAAA;CACP,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"TheCulturePostRoutes.js","names":["FEATURE","FeatureDisabledFallback","gated","FeatureGate","element","StoriesPage","lazy","m","StoryDetailPage","StoryCitationsPage","SavedStoriesPage","TopicsPage","TopicDetailPage","DiscussionsPage","DiscussionDetailPage","TimelinePage","GovernancePage","ArchivePage","CollectionDetailPage","ArchiveItemDetailPage","ContributorStudioPage","CurriculumPage","PageLoader","Spinner","TheCulturePostRoutes","useTheCulturePost","location","useLocation","normalizedBasePath","basePath","isStandalone","Suspense","Routes","Route","HomePage","Navigate"],"sources":["../../src/theculturepost/TheCulturePostRoutes.tsx"],"sourcesContent":["/**\n * TheCulturePost Routes\n * @module theculturepost\n *\n * Domain routes. The editorial home page is eager-loaded (primary landing); all\n * other pages are lazy-loaded. Every route maps to a real `tcp*` backend\n * capability.\n */\n\nimport { type FC, lazy, Suspense, type ReactElement } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useTheCulturePost } from './context/TheCulturePostContext';\nimport { usePageAnalytics } from './hooks/usePageAnalytics';\n\nconst FEATURE = {\n home: 'theculturepost.home',\n overview: 'theculturepost.overview',\n admin: 'theculturepost.admin',\n stories: 'theculturepost.stories',\n topics: 'theculturepost.topics',\n timeline: 'theculturepost.timeline',\n discussions: 'theculturepost.discussions',\n archive: 'theculturepost.archive',\n saved: 'theculturepost.saved',\n} as const;\n\nfunction FeatureDisabledFallback(): ReactElement {\n return (\n <div className=\"flex min-h-[400px] flex-col items-center justify-center gap-3 text-text-secondary\">\n <span className=\"text-lg font-semibold text-text-primary\">Feature unavailable</span>\n <span className=\"text-sm\">This page is disabled in your workspace.</span>\n </div>\n );\n}\n\nfunction gated(element: ReactElement, flag: string): ReactElement {\n return (\n <FeatureGate flag={flag} defaultValue fallback={<FeatureDisabledFallback />}>\n {element}\n </FeatureGate>\n );\n}\n\n// Eager — primary landing\nimport { HomePage } from './pages/HomePage';\n\n// Stories\nconst StoriesPage = lazy(() =>\n import('./pages/stories/StoriesPage').then((m) => ({ default: m.StoriesPage }))\n);\nconst StoryDetailPage = lazy(() =>\n import('./pages/stories/StoryDetailPage').then((m) => ({ default: m.StoryDetailPage }))\n);\nconst StoryCitationsPage = lazy(() =>\n import('./pages/stories/StoryCitationsPage').then((m) => ({ default: m.StoryCitationsPage }))\n);\nconst SavedStoriesPage = lazy(() =>\n import('./pages/stories/SavedStoriesPage').then((m) => ({ default: m.SavedStoriesPage }))\n);\n\n// Topics\nconst TopicsPage = lazy(() =>\n import('./pages/topics/TopicsPage').then((m) => ({ default: m.TopicsPage }))\n);\nconst TopicDetailPage = lazy(() =>\n import('./pages/topics/TopicDetailPage').then((m) => ({ default: m.TopicDetailPage }))\n);\n\n// Discussions\nconst DiscussionsPage = lazy(() =>\n import('./pages/discussions/DiscussionsPage').then((m) => ({ default: m.DiscussionsPage }))\n);\nconst DiscussionDetailPage = lazy(() =>\n import('./pages/discussions/DiscussionDetailPage').then((m) => ({\n default: m.DiscussionDetailPage,\n }))\n);\n\n// Timeline\nconst TimelinePage = lazy(() =>\n import('./pages/timeline/TimelinePage').then((m) => ({ default: m.TimelinePage }))\n);\n\n// Governance / Overview\nconst GovernancePage = lazy(() =>\n import('./pages/governance/GovernancePage').then((m) => ({ default: m.GovernancePage }))\n);\n\n// Archive\nconst ArchivePage = lazy(() =>\n import('./pages/archive/ArchivePage').then((m) => ({ default: m.ArchivePage }))\n);\nconst CollectionDetailPage = lazy(() =>\n import('./pages/archive/CollectionDetailPage').then((m) => ({ default: m.CollectionDetailPage }))\n);\nconst ArchiveItemDetailPage = lazy(() =>\n import('./pages/archive/ArchiveItemDetailPage').then((m) => ({\n default: m.ArchiveItemDetailPage,\n }))\n);\n\n// Contributor Studio (BOFF-5844) & Classroom / Curriculum (BOFF-5845)\nconst ContributorStudioPage = lazy(() =>\n import('./pages/studio/ContributorStudioPage').then((m) => ({\n default: m.ContributorStudioPage,\n }))\n);\nconst CurriculumPage = lazy(() =>\n import('./pages/curriculum/CurriculumPage').then((m) => ({\n default: m.CurriculumPage,\n }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nexport const TheCulturePostRoutes: FC = () => {\n const { basePath, isStandalone } = useTheCulturePost();\n const location = useLocation();\n\n usePageAnalytics();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated(<HomePage />, FEATURE.home)} />\n\n <Route path=\"overview\" element={gated(<GovernancePage />, FEATURE.overview)} />\n <Route path=\"overview/:tab\" element={gated(<GovernancePage />, FEATURE.overview)} />\n <Route\n path=\"admin\"\n element={gated(<GovernancePage defaultTab=\"review\" />, FEATURE.admin)}\n />\n <Route path=\"admin/:tab\" element={gated(<GovernancePage />, FEATURE.admin)} />\n\n <Route path=\"stories\" element={gated(<StoriesPage />, FEATURE.stories)} />\n <Route path=\"stories/:id\" element={gated(<StoryDetailPage />, FEATURE.stories)} />\n <Route\n path=\"stories/:id/citations\"\n element={gated(<StoryCitationsPage />, FEATURE.stories)}\n />\n\n <Route path=\"saved\" element={gated(<SavedStoriesPage />, FEATURE.saved)} />\n\n <Route path=\"topics\" element={gated(<TopicsPage />, FEATURE.topics)} />\n <Route path=\"topics/:id\" element={gated(<TopicDetailPage />, FEATURE.topics)} />\n\n <Route path=\"timeline\" element={gated(<TimelinePage />, FEATURE.timeline)} />\n\n <Route path=\"discussions\" element={gated(<DiscussionsPage />, FEATURE.discussions)} />\n <Route\n path=\"discussions/:id\"\n element={gated(<DiscussionDetailPage />, FEATURE.discussions)}\n />\n\n <Route path=\"archive\" element={gated(<ArchivePage />, FEATURE.archive)} />\n <Route\n path=\"archive/collections/:id\"\n element={gated(<CollectionDetailPage />, FEATURE.archive)}\n />\n <Route\n path=\"archive/items/:id\"\n element={gated(<ArchiveItemDetailPage />, FEATURE.archive)}\n />\n\n <Route path=\"studio\" element={gated(<ContributorStudioPage />, FEATURE.stories)} />\n <Route path=\"curriculum\" element={gated(<CurriculumPage />, FEATURE.archive)} />\n\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAMA,IAAU;CACd,MAAM;CACN,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,UAAU;CACV,aAAa;CACb,SAAS;CACT,OAAO;AACT;AAEA,SAASC,IAAwC;CAC/C,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,QAAD;GAAM,WAAU;GAA0C,UAAA;EAAyB,CAAA,GACnF,kBAAC,QAAD;GAAM,WAAU;GAAU,UAAA;EAA8C,CAAA,CACrE;;AAET;AAEA,SAASC,EAAM,GAAuB,GAA4B;CAChE,OACE,kBAACC,GAAD;EAAmB;EAAM,cAAA;EAAa,UAAU,kBAACF,GAAD,CAA0B,CAAA;EACvE,UAAAG;CACU,CAAA;AAEjB;AAMA,IAAMC,IAAcC,QAClB,OAAO,iCAA8B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,YAAY,EAAE,CAChF,GACMC,IAAkBF,QACtB,OAAO,qCAAkC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,gBAAgB,EAAE,CACxF,GACME,IAAqBH,QACzB,OAAO,wCAAqC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,mBAAmB,EAAE,CAC9F,GACMG,IAAmBJ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AA,GAAGrB,EAAQ,OAAO;IAAI,CAAA;IAE/E,kBAACiC,GAAD;KAAO,MAAK;KAAI,SAAS,kBAACE,GAAD;MAAU,IAAG;MAAG,SAAA;KAAS,CAAA;IAAI,CAAA;GAChD,EAAA,CAAA;EACA,CAAA;CACP,CAAA;AAET"}
|
|
@@ -19,12 +19,30 @@ var N = {
|
|
|
19
19
|
SUMMARIZE_EVIDENCE: "Summarise evidence",
|
|
20
20
|
DRAFT_FRAMING_PROMPT: "Draft framing",
|
|
21
21
|
SUGGEST_RELATED_TRADITIONS: "Find related traditions",
|
|
22
|
-
TRANSCRIBE_ORAL_HISTORY: "Clean up transcript"
|
|
22
|
+
TRANSCRIBE_ORAL_HISTORY: "Clean up transcript",
|
|
23
|
+
VERIFY_CITATION: "Verify citation proposal",
|
|
24
|
+
ASSESS_SOURCE_HEALTH: "Assess source health",
|
|
25
|
+
SENSITIVITY_FRAMING: "Sensitivity framing review",
|
|
26
|
+
EXPLAIN_TERM: "Explain term",
|
|
27
|
+
TRANSLATE_STORY: "Translate story draft",
|
|
28
|
+
EDITORIAL_SWEEP: "Editorial sweep",
|
|
29
|
+
ANALYZE_ARCHIVE_IMAGE: "Analyze archive image",
|
|
30
|
+
GENERATE_SUBTITLES: "Generate subtitles",
|
|
31
|
+
SPEECH_TO_TEXT: "Speech-to-text transcript"
|
|
23
32
|
}, P = {
|
|
24
33
|
SUMMARIZE_EVIDENCE: "What do the cited sources say about this story’s central claims?",
|
|
25
34
|
DRAFT_FRAMING_PROMPT: "Draft a short framing question that an editor could put to the cited sources.",
|
|
26
35
|
SUGGEST_RELATED_TRADITIONS: "Which traditions or practices in this collection relate to each other, and why?",
|
|
27
|
-
TRANSCRIBE_ORAL_HISTORY: "Clean up and format this transcript: fix punctuation and paragraph breaks, and mark speaker turns — do not add any content that is not in the original."
|
|
36
|
+
TRANSCRIBE_ORAL_HISTORY: "Clean up and format this transcript: fix punctuation and paragraph breaks, and mark speaker turns — do not add any content that is not in the original.",
|
|
37
|
+
VERIFY_CITATION: "Propose a verification status grounded strictly in this citation and excerpt.",
|
|
38
|
+
ASSESS_SOURCE_HEALTH: "Assess reachability and strength of all citations on this story.",
|
|
39
|
+
SENSITIVITY_FRAMING: "Flag any framing concerns with respectful reframing suggestions.",
|
|
40
|
+
EXPLAIN_TERM: "Explain this term using only eligible workspace sources, or abstain.",
|
|
41
|
+
TRANSLATE_STORY: "Draft a reviewable translation of this story into the requested locale.",
|
|
42
|
+
EDITORIAL_SWEEP: "Run scheduled source-health, review-queue, and embargo watch sweep.",
|
|
43
|
+
ANALYZE_ARCHIVE_IMAGE: "Propose respectful archival description and candidate tags for this image.",
|
|
44
|
+
GENERATE_SUBTITLES: "Draft WebVTT subtitles from consented oral history testimony.",
|
|
45
|
+
SPEECH_TO_TEXT: "Draft speech-to-text transcript proposal for editorial review."
|
|
28
46
|
}, F = {
|
|
29
47
|
CITATION: "Citation",
|
|
30
48
|
ARCHIVE_ITEM: "Artifact",
|
|
@@ -98,7 +116,7 @@ function I({ open: e, onOpenChange: t, useCase: n, storyId: r, collectionId: i,
|
|
|
98
116
|
onClick: C,
|
|
99
117
|
disabled: d.isPending || !f.trim(),
|
|
100
118
|
children: [/* @__PURE__ */ b(_, {
|
|
101
|
-
className: "
|
|
119
|
+
className: "me-1.5 h-4 w-4",
|
|
102
120
|
"aria-hidden": "true"
|
|
103
121
|
}), d.isPending ? "Generating…" : "Generate"]
|
|
104
122
|
})] }) })
|
|
@@ -138,7 +156,7 @@ function R({ run: e, canReview: n = !0, defaultExpanded: r = !1, onReviewed: i }
|
|
|
138
156
|
children: ["Uncertainty: ", f(e.uncertainty)]
|
|
139
157
|
}),
|
|
140
158
|
/* @__PURE__ */ b("span", {
|
|
141
|
-
className: "
|
|
159
|
+
className: "ms-auto text-xs text-text-tertiary",
|
|
142
160
|
children: p(e.createdAt)
|
|
143
161
|
})
|
|
144
162
|
]
|
|
@@ -207,7 +225,7 @@ function R({ run: e, canReview: n = !0, defaultExpanded: r = !1, onReviewed: i }
|
|
|
207
225
|
disabled: a.isPending,
|
|
208
226
|
"aria-label": "Approve AI answer",
|
|
209
227
|
children: [/* @__PURE__ */ b(g, {
|
|
210
|
-
className: "
|
|
228
|
+
className: "me-1.5 h-4 w-4",
|
|
211
229
|
"aria-hidden": "true"
|
|
212
230
|
}), " Approve"]
|
|
213
231
|
}), /* @__PURE__ */ x(S, {
|
|
@@ -217,7 +235,7 @@ function R({ run: e, canReview: n = !0, defaultExpanded: r = !1, onReviewed: i }
|
|
|
217
235
|
disabled: a.isPending,
|
|
218
236
|
"aria-label": "Reject AI answer",
|
|
219
237
|
children: [/* @__PURE__ */ b(v, {
|
|
220
|
-
className: "
|
|
238
|
+
className: "me-1.5 h-4 w-4",
|
|
221
239
|
"aria-hidden": "true"
|
|
222
240
|
}), " Reject"]
|
|
223
241
|
})]
|
|
@@ -268,7 +286,7 @@ function z({ storyId: t, collectionId: o, oralHistoryId: s, useCases: c, title:
|
|
|
268
286
|
variant: "outline",
|
|
269
287
|
onClick: () => D(e),
|
|
270
288
|
children: [/* @__PURE__ */ b(_, {
|
|
271
|
-
className: "
|
|
289
|
+
className: "me-1.5 h-4 w-4",
|
|
272
290
|
"aria-hidden": "true"
|
|
273
291
|
}), N[e]]
|
|
274
292
|
}, e))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiContextPanel.js","names":["_Fragment","Fragment$1","AI_USE_CASE_LABELS","DEFAULT_PROMPTS","GROUNDING_KIND_LABELS","GenerateAiContextDialog","generate","useTcpGenerateAiContext","prompt","setPrompt","useState","useCase","run","setRun","reset","nextOpen","onOpenChange","submit","input","storyId","collectionId","oralHistoryId","created","onGenerated","error","describeError","statusNote","ResponsiveDialog","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","AiRunCard","Label","Textarea","event","ResponsiveDialogFooter","Button","Sparkles","UNCERTAINTY_BADGE","review","useTcpReviewAiContext","notes","setNotes","expanded","setExpanded","defaultExpanded","decide","updated","onReviewed","notify","approved","GlassCard","StatusBadge","formatEnumLabel","formatRelativeTime","value","ref","canReview","isReviewableAiRun","Check","X","AiContextSection","useTheCulturePost","permissions","useSafePermissions","resolveAiContextPermissions","workspaceId","activeUseCase","setActiveUseCase","listable","canRead","runsQuery","useTcpAiContextRuns","canCreate","runs","pendingCount","FeatureGate","className","title","description","useCases","LoadingView","ErrorView","EmptyState","open","AiReviewQueue","AiReviewQueueContent","items"],"sources":["../../../src/theculturepost/components/AiContextPanel.tsx"],"sourcesContent":["/**\n * AiContextPanel — in-app UI for the citation-grounded AI context layer.\n * @module theculturepost/components\n *\n * Surfaces the `tcpGenerateAiContext` / `tcpReviewAiContext` / `tcpAiContextRuns`\n * operations (BOFF-4127) so editors can generate, review and adopt\n * citation-grounded answers without leaving the story, collection or oral\n * history screen (BOFF-5805).\n *\n * Floors stay server-side: generation is feature-flagged, grounding only ever\n * reads PUBLIC/COMMUNITY sources, and every run lands PENDING until a human\n * approves or rejects it. This UI only calls those operations and renders\n * their results — RBAC and access-tier denials surface as errors.\n */\n\nimport { useState } from 'react';\nimport { Check, Sparkles, X } from 'lucide-react';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n GlassCard,\n Label,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from './StatusBadge';\nimport { EmptyState } from './EmptyState';\nimport { LoadingView, ErrorView } from './StateViews';\nimport { useTheCulturePost } from '../context';\nimport { useTcpAiContextRuns, useTcpGenerateAiContext, useTcpReviewAiContext } from '../hooks';\nimport { notify, describeError } from '../lib/toast';\nimport { isReviewableAiRun, resolveAiContextPermissions } from '../utils/aiContextPermissions';\nimport { formatEnumLabel, formatRelativeTime } from '../utils/formatters';\nimport type {\n TcpAgentRun,\n TcpAiGroundingKind,\n TcpAiUseCase,\n TcpGenerateAiContextInput,\n} from '../types';\n\n// ============================================================================\n// Per-use-case presentation metadata (labels + default prompts)\n// ============================================================================\n\nexport const AI_USE_CASE_LABELS: Record<TcpAiUseCase, string> = {\n SUMMARIZE_EVIDENCE: 'Summarise evidence',\n DRAFT_FRAMING_PROMPT: 'Draft framing',\n SUGGEST_RELATED_TRADITIONS: 'Find related traditions',\n TRANSCRIBE_ORAL_HISTORY: 'Clean up transcript',\n};\n\nconst DEFAULT_PROMPTS: Record<TcpAiUseCase, string> = {\n SUMMARIZE_EVIDENCE: 'What do the cited sources say about this story’s central claims?',\n DRAFT_FRAMING_PROMPT:\n 'Draft a short framing question that an editor could put to the cited sources.',\n SUGGEST_RELATED_TRADITIONS:\n 'Which traditions or practices in this collection relate to each other, and why?',\n TRANSCRIBE_ORAL_HISTORY:\n 'Clean up and format this transcript: fix punctuation and paragraph breaks, and mark speaker turns — do not add any content that is not in the original.',\n};\n\nconst GROUNDING_KIND_LABELS: Record<TcpAiGroundingKind, string> = {\n CITATION: 'Citation',\n ARCHIVE_ITEM: 'Artifact',\n ORAL_HISTORY: 'Oral history',\n};\n\n// ============================================================================\n// Generate dialog\n// ============================================================================\n\nexport interface GenerateAiContextDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Preselected use case. Locked to this single action. */\n useCase: TcpAiUseCase;\n /** Exactly one grounding scope, matching the svc input contract. */\n storyId?: string;\n collectionId?: string;\n oralHistoryId?: string;\n /** Whether the caller holds `theculturepost-ai-context:update` to review inline. */\n canReview?: boolean;\n onGenerated?: (run: TcpAgentRun) => void;\n}\n\nexport function GenerateAiContextDialog({\n open,\n onOpenChange,\n useCase,\n storyId,\n collectionId,\n oralHistoryId,\n canReview = true,\n onGenerated,\n}: GenerateAiContextDialogProps) {\n const generate = useTcpGenerateAiContext();\n const [prompt, setPrompt] = useState(() => DEFAULT_PROMPTS[useCase]);\n const [run, setRun] = useState<TcpAgentRun | null>(null);\n\n const reset = (nextOpen: boolean) => {\n if (!nextOpen) {\n setPrompt(DEFAULT_PROMPTS[useCase]);\n setRun(null);\n generate.reset();\n }\n onOpenChange(nextOpen);\n };\n\n const submit = async () => {\n const input: TcpGenerateAiContextInput = {\n useCase,\n prompt: prompt.trim(),\n storyId: storyId ?? null,\n collectionId: collectionId ?? null,\n oralHistoryId: oralHistoryId ?? null,\n };\n try {\n const created = await generate.mutateAsync(input);\n setRun(created);\n onGenerated?.(created);\n } catch (error) {\n notify.error('Generation failed', describeError(error));\n }\n };\n\n const statusNote =\n run?.reviewStatus === 'APPROVED'\n ? 'Run approved — recorded in the editorial log.'\n : run?.reviewStatus === 'REJECTED'\n ? 'Run rejected — kept on record.'\n : 'Run created — it is awaiting editorial review.';\n\n return (\n <ResponsiveDialog open={open} onOpenChange={reset}>\n <ResponsiveDialogContent className=\"sm:max-w-xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>{AI_USE_CASE_LABELS[useCase]}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Runs on this product’s AI answer only from sources you can read (PUBLIC/COMMUNITY).\n Every run starts as pending editorial review — nothing is adopted automatically.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n {run ? (\n <div className=\"flex flex-col gap-4\">\n <p className=\"text-sm text-text-secondary\">{statusNote}</p>\n <AiRunCard run={run} canReview={canReview} defaultExpanded onReviewed={setRun} />\n </div>\n ) : (\n <div className=\"flex flex-col gap-2\">\n <Label htmlFor=\"ai-context-prompt\">Your question or instruction</Label>\n <Textarea\n id=\"ai-context-prompt\"\n value={prompt}\n onChange={(event) => setPrompt(event.target.value)}\n rows={4}\n disabled={generate.isPending}\n />\n <p className=\"text-xs text-text-tertiary\">\n Combined server-side with the grounded sources — never sent to the model alone.\n </p>\n </div>\n )}\n\n <ResponsiveDialogFooter>\n {run ? (\n <Button onClick={() => reset(false)}>Done</Button>\n ) : (\n <>\n <Button variant=\"outline\" onClick={() => reset(false)} disabled={generate.isPending}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={generate.isPending || !prompt.trim()}>\n <Sparkles className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {generate.isPending ? 'Generating…' : 'Generate'}\n </Button>\n </>\n )}\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\n// ============================================================================\n// Run card (list item + inline review)\n// ============================================================================\n\nconst UNCERTAINTY_BADGE: Record<string, 'success' | 'warning' | 'destructive'> = {\n LOW: 'success',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n};\n\nexport interface AiRunCardProps {\n run: TcpAgentRun;\n canReview?: boolean;\n defaultExpanded?: boolean;\n onReviewed?: (updated: TcpAgentRun) => void;\n}\n\nexport function AiRunCard({\n run,\n canReview = true,\n defaultExpanded = false,\n onReviewed,\n}: AiRunCardProps) {\n const review = useTcpReviewAiContext();\n const [notes, setNotes] = useState('');\n const [expanded, setExpanded] = useState(defaultExpanded);\n\n const decide = async (approved: boolean) => {\n try {\n const updated = await review.mutateAsync({\n id: run.id,\n approved,\n reviewNotes: notes.trim() || undefined,\n });\n onReviewed?.(updated);\n notify.success(\n approved ? 'AI answer approved' : 'AI answer rejected',\n approved ? 'It is now marked as reviewed.' : 'The run stays on record as rejected.'\n );\n } catch (error) {\n notify.error('Review failed', describeError(error));\n }\n };\n\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col gap-3 p-4\">\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <StatusBadge status={run.useCase} />\n {run.status === 'FAILED' ? (\n <StatusBadge status=\"FAILED\" />\n ) : (\n <StatusBadge status={run.reviewStatus} />\n )}\n {run.uncertainty && (\n <span\n className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${\n UNCERTAINTY_BADGE[run.uncertainty] === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text'\n : UNCERTAINTY_BADGE[run.uncertainty] === 'destructive'\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-status-warning-bg-subtle text-status-warning-text'\n }`}\n >\n Uncertainty: {formatEnumLabel(run.uncertainty)}\n </span>\n )}\n <span className=\"ml-auto text-xs text-text-tertiary\">\n {formatRelativeTime(run.createdAt)}\n </span>\n </div>\n\n <p className=\"text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Prompt: </span>\n {run.promptSummary}\n </p>\n\n {run.error && (\n <p className=\"rounded-lg bg-status-error-bg-subtle p-2 text-xs text-status-error-text\">\n {run.error}\n </p>\n )}\n\n {run.content && (\n <div>\n <button\n type=\"button\"\n onClick={() => setExpanded((value) => !value)}\n className=\"text-xs font-medium text-text-secondary underline-offset-2 hover:underline\"\n >\n {expanded ? 'Hide answer' : 'Show answer'}\n </button>\n {expanded && (\n <p className=\"mt-2 whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm text-text-primary\">\n {run.content}\n </p>\n )}\n </div>\n )}\n\n {run.groundingRefs.length > 0 && (\n <div className=\"flex flex-col gap-1.5\">\n <p className=\"text-xs font-medium text-text-tertiary\">\n Grounded in ({run.groundingRefs.length} sources)\n </p>\n <ul className=\"flex flex-wrap gap-1.5\">\n {run.groundingRefs.map((ref) => (\n <li\n key={`${ref.kind}-${ref.refId}`}\n className=\"inline-flex max-w-full items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary\"\n title={ref.title}\n >\n <span className=\"shrink-0 font-medium\">\n {GROUNDING_KIND_LABELS[ref.kind] ?? formatEnumLabel(ref.kind)}\n </span>\n <span className=\"truncate\">{ref.title}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {run.reviewStatus !== 'PENDING' && (run.reviewNotes || run.reviewedAt) && (\n <p className=\"text-xs text-text-tertiary\">\n {run.reviewStatus === 'APPROVED' ? 'Approved' : 'Rejected'}\n {run.reviewNotes ? ` — ${run.reviewNotes}` : ''}\n </p>\n )}\n\n {canReview && isReviewableAiRun(run) && (\n <div className=\"flex flex-col gap-2 border-t border-border-seam pt-3\">\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n rows={2}\n placeholder=\"Review notes (optional)\"\n disabled={review.isPending}\n />\n <div className=\"flex gap-2\">\n <Button\n size=\"sm\"\n onClick={() => decide(true)}\n disabled={review.isPending}\n aria-label=\"Approve AI answer\"\n >\n <Check className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Approve\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => decide(false)}\n disabled={review.isPending}\n aria-label=\"Reject AI answer\"\n >\n <X className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Reject\n </Button>\n </div>\n </div>\n )}\n </GlassCard>\n );\n}\n\n// ============================================================================\n// Section: action buttons + run list for one grounding scope\n// ============================================================================\n\nexport interface AiContextSectionProps {\n /** Story-scoped use cases (SUMMARIZE_EVIDENCE, DRAFT_FRAMING_PROMPT). */\n storyId?: string;\n /** Collection-scoped use cases (SUGGEST_RELATED_TRADITIONS). */\n collectionId?: string;\n /** Oral-history use case (TRANSCRIBE_ORAL_HISTORY) — action only, no run list\n * filter exists for oral histories server-side. */\n oralHistoryId?: string;\n useCases: TcpAiUseCase[];\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport function AiContextSection({\n storyId,\n collectionId,\n oralHistoryId,\n useCases,\n title = 'AI assistant',\n description = 'Citation-grounded answers from sources you can read. Every answer waits for editorial review before adoption.',\n className,\n}: AiContextSectionProps) {\n const { workspaceId } = useTheCulturePost();\n const permissions = useSafePermissions();\n const { canRead, canCreate, canReview } = resolveAiContextPermissions(permissions, workspaceId);\n const [activeUseCase, setActiveUseCase] = useState<TcpAiUseCase | null>(null);\n // Runs are listable per story or collection; the svc has no oralHistoryId filter.\n const listable = Boolean(storyId || collectionId) && canRead;\n const runsQuery = useTcpAiContextRuns({\n storyId,\n collectionId,\n pagination: { limit: 10 },\n enabled: listable,\n });\n\n if (!canRead && !canCreate) {\n return null;\n }\n\n const runs = listable ? (runsQuery.data?.items ?? []) : [];\n const pendingCount = runs.filter(isReviewableAiRun).length;\n\n return (\n <FeatureGate flag=\"theculturepost.ai-context\" defaultValue fallback={null}>\n <GlassCard treatment=\"plain\" className={`flex flex-col gap-4 p-5 sm:p-6 ${className ?? ''}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <h2 className=\"flex items-center gap-2 font-display text-xl font-semibold text-text-primary\">\n <Sparkles className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> {title}\n {pendingCount > 0 && (\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {pendingCount} pending\n </span>\n )}\n </h2>\n <p className=\"mt-1 text-sm text-text-secondary\">{description}</p>\n </div>\n {canCreate && (\n <div className=\"flex flex-wrap gap-2\">\n {useCases.map((useCase) => (\n <Button key={useCase} variant=\"outline\" onClick={() => setActiveUseCase(useCase)}>\n <Sparkles className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {AI_USE_CASE_LABELS[useCase]}\n </Button>\n ))}\n </div>\n )}\n </div>\n\n {listable &&\n (runsQuery.isLoading ? (\n <LoadingView label=\"Loading AI runs…\" />\n ) : runsQuery.isError ? (\n <ErrorView title=\"Could not load AI runs\" onRetry={() => runsQuery.refetch()} />\n ) : runs.length === 0 ? (\n <EmptyState\n icon={<Sparkles className=\"h-9 w-9\" />}\n title=\"No AI runs yet\"\n description={\n canCreate\n ? 'Run one of the actions above to draft a citation-grounded answer.'\n : 'No citation-grounded AI runs have been created for this scope yet.'\n }\n />\n ) : (\n <div className=\"flex flex-col gap-3\">\n {runs.map((run) => (\n <AiRunCard key={run.id} run={run} canReview={canReview} />\n ))}\n </div>\n ))}\n\n {activeUseCase && (\n <GenerateAiContextDialog\n open\n onOpenChange={(open) => {\n if (!open) setActiveUseCase(null);\n }}\n useCase={activeUseCase}\n storyId={storyId}\n collectionId={collectionId}\n oralHistoryId={oralHistoryId}\n canReview={canReview}\n />\n )}\n </GlassCard>\n </FeatureGate>\n );\n}\n\n// ============================================================================\n// Editorial review queue (workspace-wide, StoriesPage overview)\n// ============================================================================\n\nexport function AiReviewQueue({ className }: { className?: string }) {\n const { workspaceId } = useTheCulturePost();\n const permissions = useSafePermissions();\n const { canRead, canReview } = resolveAiContextPermissions(permissions, workspaceId);\n\n if (!canRead) {\n return null;\n }\n\n return (\n <FeatureGate flag=\"theculturepost.ai-context\" defaultValue fallback={null}>\n <AiReviewQueueContent className={className} canReview={canReview} />\n </FeatureGate>\n );\n}\n\nfunction AiReviewQueueContent({\n className,\n canReview,\n}: {\n className?: string;\n canReview: boolean;\n}) {\n const runsQuery = useTcpAiContextRuns({ pagination: { limit: 50 } });\n const items = (runsQuery.data?.items ?? []).filter(isReviewableAiRun);\n\n if (runsQuery.isLoading) {\n return <LoadingView label=\"Loading AI review queue…\" />;\n }\n if (runsQuery.isError) {\n return (\n <ErrorView title=\"Could not load the AI review queue\" onRetry={() => runsQuery.refetch()} />\n );\n }\n if (items.length === 0) {\n return null;\n }\n\n return (\n <GlassCard treatment=\"plain\" className={`flex flex-col gap-3 p-5 sm:p-6 ${className ?? ''}`}>\n <h2 className=\"flex items-center gap-2 font-display text-xl font-semibold text-text-primary\">\n <Sparkles className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> AI review queue\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {items.length} pending\n </span>\n </h2>\n <p className=\"text-sm text-text-secondary\">\n Generated answers awaiting an editorial decision, newest first. Approve or reject them here,\n or in place on the story or collection they belong to.\n </p>\n <div className=\"flex flex-col gap-3\">\n {items.slice(0, 5).map((run) => (\n <AiRunCard key={run.id} run={run} canReview={canReview} />\n ))}\n {items.length > 5 && (\n <p className=\"text-xs text-text-tertiary\">\n {items.length - 5} more pending — open the story or collection they belong to review\n them in place.\n </p>\n )}\n </div>\n </GlassCard>\n );\n}\n"],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AAG,OAAOb,CAAiB;CAcpE,OAZIa,EAAU,YACL,kBAACU,GAAD,EAAa,OAAM,2BAA4B,CAAA,IAEpDV,EAAU,UAEV,kBAACW,GAAD;EAAW,OAAM;EAAqC,eAAeX,EAAU,QAAQ;CAAI,CAAA,IAG3FgB,EAAM,WAAW,IACZ,OAIP,kBAACpC,GAAD;EAAW,WAAU;EAAQ,WAAW,kCAAkC0B,KAAa;EAAvF,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAAd,UAAA;KACE,kBAACxC,GAAD;MAAU,WAAU;MAAsB,eAAY;KAAQ,CAAA;KAAC;KAC/D,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACGkD,EAAM,QAAO,UACV;;IACJ;;GACJ,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAGxC,CAAA;GACH,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACGA,EAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,MACtB,kBAACxD,GAAD;KAA6B;KAAgB;IAAY,GAAzCpB,EAAI,EAAqC,CAC1D,GACA4E,EAAM,SAAS,KACd,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA,CACGA,EAAM,SAAS,GAAE,mFAEjB;IAEF,CAAA,CAAA;;EACI;;AAEf"}
|
|
1
|
+
{"version":3,"file":"AiContextPanel.js","names":["_Fragment","Fragment$1","AI_USE_CASE_LABELS","DEFAULT_PROMPTS","GROUNDING_KIND_LABELS","GenerateAiContextDialog","generate","useTcpGenerateAiContext","prompt","setPrompt","useState","useCase","run","setRun","reset","nextOpen","onOpenChange","submit","input","storyId","collectionId","oralHistoryId","created","onGenerated","error","describeError","statusNote","ResponsiveDialog","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","AiRunCard","Label","Textarea","event","ResponsiveDialogFooter","Button","Sparkles","UNCERTAINTY_BADGE","review","useTcpReviewAiContext","notes","setNotes","expanded","setExpanded","defaultExpanded","decide","updated","onReviewed","notify","approved","GlassCard","StatusBadge","formatEnumLabel","formatRelativeTime","value","ref","canReview","isReviewableAiRun","Check","X","AiContextSection","useTheCulturePost","permissions","useSafePermissions","resolveAiContextPermissions","workspaceId","activeUseCase","setActiveUseCase","listable","canRead","runsQuery","useTcpAiContextRuns","canCreate","runs","pendingCount","FeatureGate","className","title","description","useCases","LoadingView","ErrorView","EmptyState","open","AiReviewQueue","AiReviewQueueContent","items"],"sources":["../../../src/theculturepost/components/AiContextPanel.tsx"],"sourcesContent":["/**\n * AiContextPanel — in-app UI for the citation-grounded AI context layer.\n * @module theculturepost/components\n *\n * Surfaces the `tcpGenerateAiContext` / `tcpReviewAiContext` / `tcpAiContextRuns`\n * operations (BOFF-4127) so editors can generate, review and adopt\n * citation-grounded answers without leaving the story, collection or oral\n * history screen (BOFF-5805).\n *\n * Floors stay server-side: generation is feature-flagged, grounding only ever\n * reads PUBLIC/COMMUNITY sources, and every run lands PENDING until a human\n * approves or rejects it. This UI only calls those operations and renders\n * their results — RBAC and access-tier denials surface as errors.\n */\n\nimport { useState } from 'react';\nimport { Check, Sparkles, X } from 'lucide-react';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n GlassCard,\n Label,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from './StatusBadge';\nimport { EmptyState } from './EmptyState';\nimport { LoadingView, ErrorView } from './StateViews';\nimport { useTheCulturePost } from '../context';\nimport { useTcpAiContextRuns, useTcpGenerateAiContext, useTcpReviewAiContext } from '../hooks';\nimport { notify, describeError } from '../lib/toast';\nimport { isReviewableAiRun, resolveAiContextPermissions } from '../utils/aiContextPermissions';\nimport { formatEnumLabel, formatRelativeTime } from '../utils/formatters';\nimport type {\n TcpAgentRun,\n TcpAiGroundingKind,\n TcpAiUseCase,\n TcpGenerateAiContextInput,\n} from '../types';\n\n// ============================================================================\n// Per-use-case presentation metadata (labels + default prompts)\n// ============================================================================\n\nexport const AI_USE_CASE_LABELS: Record<TcpAiUseCase, string> = {\n SUMMARIZE_EVIDENCE: 'Summarise evidence',\n DRAFT_FRAMING_PROMPT: 'Draft framing',\n SUGGEST_RELATED_TRADITIONS: 'Find related traditions',\n TRANSCRIBE_ORAL_HISTORY: 'Clean up transcript',\n VERIFY_CITATION: 'Verify citation proposal',\n ASSESS_SOURCE_HEALTH: 'Assess source health',\n SENSITIVITY_FRAMING: 'Sensitivity framing review',\n EXPLAIN_TERM: 'Explain term',\n TRANSLATE_STORY: 'Translate story draft',\n EDITORIAL_SWEEP: 'Editorial sweep',\n ANALYZE_ARCHIVE_IMAGE: 'Analyze archive image',\n GENERATE_SUBTITLES: 'Generate subtitles',\n SPEECH_TO_TEXT: 'Speech-to-text transcript',\n};\n\nconst DEFAULT_PROMPTS: Record<TcpAiUseCase, string> = {\n SUMMARIZE_EVIDENCE: 'What do the cited sources say about this story’s central claims?',\n DRAFT_FRAMING_PROMPT:\n 'Draft a short framing question that an editor could put to the cited sources.',\n SUGGEST_RELATED_TRADITIONS:\n 'Which traditions or practices in this collection relate to each other, and why?',\n TRANSCRIBE_ORAL_HISTORY:\n 'Clean up and format this transcript: fix punctuation and paragraph breaks, and mark speaker turns — do not add any content that is not in the original.',\n VERIFY_CITATION: 'Propose a verification status grounded strictly in this citation and excerpt.',\n ASSESS_SOURCE_HEALTH: 'Assess reachability and strength of all citations on this story.',\n SENSITIVITY_FRAMING: 'Flag any framing concerns with respectful reframing suggestions.',\n EXPLAIN_TERM: 'Explain this term using only eligible workspace sources, or abstain.',\n TRANSLATE_STORY: 'Draft a reviewable translation of this story into the requested locale.',\n EDITORIAL_SWEEP: 'Run scheduled source-health, review-queue, and embargo watch sweep.',\n ANALYZE_ARCHIVE_IMAGE:\n 'Propose respectful archival description and candidate tags for this image.',\n GENERATE_SUBTITLES: 'Draft WebVTT subtitles from consented oral history testimony.',\n SPEECH_TO_TEXT: 'Draft speech-to-text transcript proposal for editorial review.',\n};\n\nconst GROUNDING_KIND_LABELS: Record<TcpAiGroundingKind, string> = {\n CITATION: 'Citation',\n ARCHIVE_ITEM: 'Artifact',\n ORAL_HISTORY: 'Oral history',\n};\n\n// ============================================================================\n// Generate dialog\n// ============================================================================\n\nexport interface GenerateAiContextDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Preselected use case. Locked to this single action. */\n useCase: TcpAiUseCase;\n /** Exactly one grounding scope, matching the svc input contract. */\n storyId?: string;\n collectionId?: string;\n oralHistoryId?: string;\n /** Whether the caller holds `theculturepost-ai-context:update` to review inline. */\n canReview?: boolean;\n onGenerated?: (run: TcpAgentRun) => void;\n}\n\nexport function GenerateAiContextDialog({\n open,\n onOpenChange,\n useCase,\n storyId,\n collectionId,\n oralHistoryId,\n canReview = true,\n onGenerated,\n}: GenerateAiContextDialogProps) {\n const generate = useTcpGenerateAiContext();\n const [prompt, setPrompt] = useState(() => DEFAULT_PROMPTS[useCase]);\n const [run, setRun] = useState<TcpAgentRun | null>(null);\n\n const reset = (nextOpen: boolean) => {\n if (!nextOpen) {\n setPrompt(DEFAULT_PROMPTS[useCase]);\n setRun(null);\n generate.reset();\n }\n onOpenChange(nextOpen);\n };\n\n const submit = async () => {\n const input: TcpGenerateAiContextInput = {\n useCase,\n prompt: prompt.trim(),\n storyId: storyId ?? null,\n collectionId: collectionId ?? null,\n oralHistoryId: oralHistoryId ?? null,\n };\n try {\n const created = await generate.mutateAsync(input);\n setRun(created);\n onGenerated?.(created);\n } catch (error) {\n notify.error('Generation failed', describeError(error));\n }\n };\n\n const statusNote =\n run?.reviewStatus === 'APPROVED'\n ? 'Run approved — recorded in the editorial log.'\n : run?.reviewStatus === 'REJECTED'\n ? 'Run rejected — kept on record.'\n : 'Run created — it is awaiting editorial review.';\n\n return (\n <ResponsiveDialog open={open} onOpenChange={reset}>\n <ResponsiveDialogContent className=\"sm:max-w-xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>{AI_USE_CASE_LABELS[useCase]}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Runs on this product’s AI answer only from sources you can read (PUBLIC/COMMUNITY).\n Every run starts as pending editorial review — nothing is adopted automatically.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n {run ? (\n <div className=\"flex flex-col gap-4\">\n <p className=\"text-sm text-text-secondary\">{statusNote}</p>\n <AiRunCard run={run} canReview={canReview} defaultExpanded onReviewed={setRun} />\n </div>\n ) : (\n <div className=\"flex flex-col gap-2\">\n <Label htmlFor=\"ai-context-prompt\">Your question or instruction</Label>\n <Textarea\n id=\"ai-context-prompt\"\n value={prompt}\n onChange={(event) => setPrompt(event.target.value)}\n rows={4}\n disabled={generate.isPending}\n />\n <p className=\"text-xs text-text-tertiary\">\n Combined server-side with the grounded sources — never sent to the model alone.\n </p>\n </div>\n )}\n\n <ResponsiveDialogFooter>\n {run ? (\n <Button onClick={() => reset(false)}>Done</Button>\n ) : (\n <>\n <Button variant=\"outline\" onClick={() => reset(false)} disabled={generate.isPending}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={generate.isPending || !prompt.trim()}>\n <Sparkles className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {generate.isPending ? 'Generating…' : 'Generate'}\n </Button>\n </>\n )}\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\n// ============================================================================\n// Run card (list item + inline review)\n// ============================================================================\n\nconst UNCERTAINTY_BADGE: Record<string, 'success' | 'warning' | 'destructive'> = {\n LOW: 'success',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n};\n\nexport interface AiRunCardProps {\n run: TcpAgentRun;\n canReview?: boolean;\n defaultExpanded?: boolean;\n onReviewed?: (updated: TcpAgentRun) => void;\n}\n\nexport function AiRunCard({\n run,\n canReview = true,\n defaultExpanded = false,\n onReviewed,\n}: AiRunCardProps) {\n const review = useTcpReviewAiContext();\n const [notes, setNotes] = useState('');\n const [expanded, setExpanded] = useState(defaultExpanded);\n\n const decide = async (approved: boolean) => {\n try {\n const updated = await review.mutateAsync({\n id: run.id,\n approved,\n reviewNotes: notes.trim() || undefined,\n });\n onReviewed?.(updated);\n notify.success(\n approved ? 'AI answer approved' : 'AI answer rejected',\n approved ? 'It is now marked as reviewed.' : 'The run stays on record as rejected.'\n );\n } catch (error) {\n notify.error('Review failed', describeError(error));\n }\n };\n\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col gap-3 p-4\">\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <StatusBadge status={run.useCase} />\n {run.status === 'FAILED' ? (\n <StatusBadge status=\"FAILED\" />\n ) : (\n <StatusBadge status={run.reviewStatus} />\n )}\n {run.uncertainty && (\n <span\n className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${\n UNCERTAINTY_BADGE[run.uncertainty] === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text'\n : UNCERTAINTY_BADGE[run.uncertainty] === 'destructive'\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-status-warning-bg-subtle text-status-warning-text'\n }`}\n >\n Uncertainty: {formatEnumLabel(run.uncertainty)}\n </span>\n )}\n <span className=\"ms-auto text-xs text-text-tertiary\">\n {formatRelativeTime(run.createdAt)}\n </span>\n </div>\n\n <p className=\"text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Prompt: </span>\n {run.promptSummary}\n </p>\n\n {run.error && (\n <p className=\"rounded-lg bg-status-error-bg-subtle p-2 text-xs text-status-error-text\">\n {run.error}\n </p>\n )}\n\n {run.content && (\n <div>\n <button\n type=\"button\"\n onClick={() => setExpanded((value) => !value)}\n className=\"text-xs font-medium text-text-secondary underline-offset-2 hover:underline\"\n >\n {expanded ? 'Hide answer' : 'Show answer'}\n </button>\n {expanded && (\n <p className=\"mt-2 whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm text-text-primary\">\n {run.content}\n </p>\n )}\n </div>\n )}\n\n {run.groundingRefs.length > 0 && (\n <div className=\"flex flex-col gap-1.5\">\n <p className=\"text-xs font-medium text-text-tertiary\">\n Grounded in ({run.groundingRefs.length} sources)\n </p>\n <ul className=\"flex flex-wrap gap-1.5\">\n {run.groundingRefs.map((ref) => (\n <li\n key={`${ref.kind}-${ref.refId}`}\n className=\"inline-flex max-w-full items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary\"\n title={ref.title}\n >\n <span className=\"shrink-0 font-medium\">\n {GROUNDING_KIND_LABELS[ref.kind] ?? formatEnumLabel(ref.kind)}\n </span>\n <span className=\"truncate\">{ref.title}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {run.reviewStatus !== 'PENDING' && (run.reviewNotes || run.reviewedAt) && (\n <p className=\"text-xs text-text-tertiary\">\n {run.reviewStatus === 'APPROVED' ? 'Approved' : 'Rejected'}\n {run.reviewNotes ? ` — ${run.reviewNotes}` : ''}\n </p>\n )}\n\n {canReview && isReviewableAiRun(run) && (\n <div className=\"flex flex-col gap-2 border-t border-border-seam pt-3\">\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n rows={2}\n placeholder=\"Review notes (optional)\"\n disabled={review.isPending}\n />\n <div className=\"flex gap-2\">\n <Button\n size=\"sm\"\n onClick={() => decide(true)}\n disabled={review.isPending}\n aria-label=\"Approve AI answer\"\n >\n <Check className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" /> Approve\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => decide(false)}\n disabled={review.isPending}\n aria-label=\"Reject AI answer\"\n >\n <X className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" /> Reject\n </Button>\n </div>\n </div>\n )}\n </GlassCard>\n );\n}\n\n// ============================================================================\n// Section: action buttons + run list for one grounding scope\n// ============================================================================\n\nexport interface AiContextSectionProps {\n /** Story-scoped use cases (SUMMARIZE_EVIDENCE, DRAFT_FRAMING_PROMPT). */\n storyId?: string;\n /** Collection-scoped use cases (SUGGEST_RELATED_TRADITIONS). */\n collectionId?: string;\n /** Oral-history use case (TRANSCRIBE_ORAL_HISTORY) — action only, no run list\n * filter exists for oral histories server-side. */\n oralHistoryId?: string;\n useCases: TcpAiUseCase[];\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport function AiContextSection({\n storyId,\n collectionId,\n oralHistoryId,\n useCases,\n title = 'AI assistant',\n description = 'Citation-grounded answers from sources you can read. Every answer waits for editorial review before adoption.',\n className,\n}: AiContextSectionProps) {\n const { workspaceId } = useTheCulturePost();\n const permissions = useSafePermissions();\n const { canRead, canCreate, canReview } = resolveAiContextPermissions(permissions, workspaceId);\n const [activeUseCase, setActiveUseCase] = useState<TcpAiUseCase | null>(null);\n // Runs are listable per story or collection; the svc has no oralHistoryId filter.\n const listable = Boolean(storyId || collectionId) && canRead;\n const runsQuery = useTcpAiContextRuns({\n storyId,\n collectionId,\n pagination: { limit: 10 },\n enabled: listable,\n });\n\n if (!canRead && !canCreate) {\n return null;\n }\n\n const runs = listable ? (runsQuery.data?.items ?? []) : [];\n const pendingCount = runs.filter(isReviewableAiRun).length;\n\n return (\n <FeatureGate flag=\"theculturepost.ai-context\" defaultValue fallback={null}>\n <GlassCard treatment=\"plain\" className={`flex flex-col gap-4 p-5 sm:p-6 ${className ?? ''}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <h2 className=\"flex items-center gap-2 font-display text-xl font-semibold text-text-primary\">\n <Sparkles className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> {title}\n {pendingCount > 0 && (\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {pendingCount} pending\n </span>\n )}\n </h2>\n <p className=\"mt-1 text-sm text-text-secondary\">{description}</p>\n </div>\n {canCreate && (\n <div className=\"flex flex-wrap gap-2\">\n {useCases.map((useCase) => (\n <Button key={useCase} variant=\"outline\" onClick={() => setActiveUseCase(useCase)}>\n <Sparkles className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {AI_USE_CASE_LABELS[useCase]}\n </Button>\n ))}\n </div>\n )}\n </div>\n\n {listable &&\n (runsQuery.isLoading ? (\n <LoadingView label=\"Loading AI runs…\" />\n ) : runsQuery.isError ? (\n <ErrorView title=\"Could not load AI runs\" onRetry={() => runsQuery.refetch()} />\n ) : runs.length === 0 ? (\n <EmptyState\n icon={<Sparkles className=\"h-9 w-9\" />}\n title=\"No AI runs yet\"\n description={\n canCreate\n ? 'Run one of the actions above to draft a citation-grounded answer.'\n : 'No citation-grounded AI runs have been created for this scope yet.'\n }\n />\n ) : (\n <div className=\"flex flex-col gap-3\">\n {runs.map((run) => (\n <AiRunCard key={run.id} run={run} canReview={canReview} />\n ))}\n </div>\n ))}\n\n {activeUseCase && (\n <GenerateAiContextDialog\n open\n onOpenChange={(open) => {\n if (!open) setActiveUseCase(null);\n }}\n useCase={activeUseCase}\n storyId={storyId}\n collectionId={collectionId}\n oralHistoryId={oralHistoryId}\n canReview={canReview}\n />\n )}\n </GlassCard>\n </FeatureGate>\n );\n}\n\n// ============================================================================\n// Editorial review queue (workspace-wide, StoriesPage overview)\n// ============================================================================\n\nexport function AiReviewQueue({ className }: { className?: string }) {\n const { workspaceId } = useTheCulturePost();\n const permissions = useSafePermissions();\n const { canRead, canReview } = resolveAiContextPermissions(permissions, workspaceId);\n\n if (!canRead) {\n return null;\n }\n\n return (\n <FeatureGate flag=\"theculturepost.ai-context\" defaultValue fallback={null}>\n <AiReviewQueueContent className={className} canReview={canReview} />\n </FeatureGate>\n );\n}\n\nfunction AiReviewQueueContent({\n className,\n canReview,\n}: {\n className?: string;\n canReview: boolean;\n}) {\n const runsQuery = useTcpAiContextRuns({ pagination: { limit: 50 } });\n const items = (runsQuery.data?.items ?? []).filter(isReviewableAiRun);\n\n if (runsQuery.isLoading) {\n return <LoadingView label=\"Loading AI review queue…\" />;\n }\n if (runsQuery.isError) {\n return (\n <ErrorView title=\"Could not load the AI review queue\" onRetry={() => runsQuery.refetch()} />\n );\n }\n if (items.length === 0) {\n return null;\n }\n\n return (\n <GlassCard treatment=\"plain\" className={`flex flex-col gap-3 p-5 sm:p-6 ${className ?? ''}`}>\n <h2 className=\"flex items-center gap-2 font-display text-xl font-semibold text-text-primary\">\n <Sparkles className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> AI review queue\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {items.length} pending\n </span>\n </h2>\n <p className=\"text-sm text-text-secondary\">\n Generated answers awaiting an editorial decision, newest first. Approve or reject them here,\n or in place on the story or collection they belong to.\n </p>\n <div className=\"flex flex-col gap-3\">\n {items.slice(0, 5).map((run) => (\n <AiRunCard key={run.id} run={run} canReview={canReview} />\n ))}\n {items.length > 5 && (\n <p className=\"text-xs text-text-tertiary\">\n {items.length - 5} more pending — open the story or collection they belong to review\n them in place.\n </p>\n )}\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,IAAaE,IAAmD;CAC9D,oBAAoB;CACpB,sBAAsB;CACtB,4BAA4B;CAC5B,yBAAyB;CACzB,iBAAiB;CACjB,sBAAsB;CACtB,qBAAqB;CACrB,cAAc;CACd,iBAAiB;CACjB,iBAAiB;CACjB,uBAAuB;CACvB,oBAAoB;CACpB,gBAAgB;AAClB,GAEMC,IAAgD;CACpD,oBAAoB;CACpB,sBACE;CACF,4BACE;CACF,yBACE;CACF,iBAAiB;CACjB,sBAAsB;CACtB,qBAAqB;CACrB,cAAc;CACd,iBAAiB;CACjB,iBAAiB;CACjB,uBACE;CACF,oBAAoB;CACpB,gBAAgB;AAClB,GAEMC,IAA4D;CAChE,UAAU;CACV,cAAc;CACd,cAAc;AAChB;AAoBA,SAAgBC,EAAwB,EACtC,SACA,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;GACE,kBAAC,MAAD;IAAI,WAAU;IAAd,UAAA;KACE,kBAACxC,GAAD;MAAU,WAAU;MAAsB,eAAY;KAAQ,CAAA;KAAC;KAC/D,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACGkD,EAAM,QAAO,UACV;;IACJ;;GACJ,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAGxC,CAAA;GACH,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACGA,EAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,MACtB,kBAACxD,GAAD;KAA6B;KAAgB;IAAY,GAAzCpB,EAAI,EAAqC,CAC1D,GACA4E,EAAM,SAAS,KACd,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA,CACGA,EAAM,SAAS,GAAE,mFAEjB;IAEF,CAAA,CAAA;;EACI;;AAEf"}
|
|
@@ -17,7 +17,7 @@ function m({ item: m, onOpen: h }) {
|
|
|
17
17
|
children: [/* @__PURE__ */ f("button", {
|
|
18
18
|
type: "button",
|
|
19
19
|
onClick: h,
|
|
20
|
-
className: "group relative block aspect-[4/3] w-full overflow-hidden text-
|
|
20
|
+
className: "group relative block aspect-[4/3] w-full overflow-hidden text-start",
|
|
21
21
|
"aria-label": `Open ${m.title}`,
|
|
22
22
|
children: [/* @__PURE__ */ d(e, {
|
|
23
23
|
fileId: m.file?.id,
|
|
@@ -40,7 +40,7 @@ function m({ item: m, onOpen: h }) {
|
|
|
40
40
|
/* @__PURE__ */ d("button", {
|
|
41
41
|
type: "button",
|
|
42
42
|
onClick: h,
|
|
43
|
-
className: "text-
|
|
43
|
+
className: "text-start text-sm font-semibold leading-snug text-text-primary hover:underline",
|
|
44
44
|
children: m.title
|
|
45
45
|
}),
|
|
46
46
|
/* @__PURE__ */ f("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchiveItemCard.js","names":["ArchiveItemCard","Icon","KIND_ICON","item","languageLabel","useLanguageMetadata","GlassCard","onOpen","CoverImage","OverlayBadge","createElement","formatEnumLabel","StatusBadge","MapPin","Languages","CalendarClock","formatDate"],"sources":["../../../src/theculturepost/components/ArchiveItemCard.tsx"],"sourcesContent":["/**\n * ArchiveItemCard — a tile for an archived artifact.\n * @module theculturepost/components\n *\n * Kind-icon badge overlaid on the cover, access-level badge, title, provenance/\n * origin, language names + dated chips. Image-like kinds resolve a thumbnail\n * from the file id; others fall back to the kind icon. The schema exposes a\n * single `file` (no galleries) — never render more than one. Links to detail.\n */\n\nimport { createElement } from 'react';\nimport { MapPin, CalendarClock, Languages } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { StatusBadge } from './StatusBadge';\nimport { OverlayBadge } from './OverlayBadge';\nimport { KIND_ICON } from './kindIcon';\nimport { formatDate, formatEnumLabel } from '../utils/formatters';\nimport { useLanguageMetadata } from '../hooks/useLanguageMetadata';\nimport type { TcpArchiveItem } from '../types';\n\ninterface ArchiveItemCardProps {\n item: TcpArchiveItem;\n onOpen: () => void;\n}\n\nexport function ArchiveItemCard({ item, onOpen }: ArchiveItemCardProps) {\n const Icon = KIND_ICON[item.kind];\n const languageLabel = useLanguageMetadata(item.languages);\n\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[4/3] w-full overflow-hidden text-
|
|
1
|
+
{"version":3,"file":"ArchiveItemCard.js","names":["ArchiveItemCard","Icon","KIND_ICON","item","languageLabel","useLanguageMetadata","GlassCard","onOpen","CoverImage","OverlayBadge","createElement","formatEnumLabel","StatusBadge","MapPin","Languages","CalendarClock","formatDate"],"sources":["../../../src/theculturepost/components/ArchiveItemCard.tsx"],"sourcesContent":["/**\n * ArchiveItemCard — a tile for an archived artifact.\n * @module theculturepost/components\n *\n * Kind-icon badge overlaid on the cover, access-level badge, title, provenance/\n * origin, language names + dated chips. Image-like kinds resolve a thumbnail\n * from the file id; others fall back to the kind icon. The schema exposes a\n * single `file` (no galleries) — never render more than one. Links to detail.\n */\n\nimport { createElement } from 'react';\nimport { MapPin, CalendarClock, Languages } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { StatusBadge } from './StatusBadge';\nimport { OverlayBadge } from './OverlayBadge';\nimport { KIND_ICON } from './kindIcon';\nimport { formatDate, formatEnumLabel } from '../utils/formatters';\nimport { useLanguageMetadata } from '../hooks/useLanguageMetadata';\nimport type { TcpArchiveItem } from '../types';\n\ninterface ArchiveItemCardProps {\n item: TcpArchiveItem;\n onOpen: () => void;\n}\n\nexport function ArchiveItemCard({ item, onOpen }: ArchiveItemCardProps) {\n const Icon = KIND_ICON[item.kind];\n const languageLabel = useLanguageMetadata(item.languages);\n\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[4/3] w-full overflow-hidden text-start\"\n aria-label={`Open ${item.title}`}\n >\n <CoverImage\n fileId={item.file?.id}\n alt={item.title}\n rounded=\"rounded-none\"\n className=\"h-full w-full transition-transform duration-500 group-hover:scale-[1.03]\"\n icon={<Icon className=\"h-8 w-8\" />}\n />\n <OverlayBadge position=\"top-left\" icon={createElement(Icon, { className: 'h-3 w-3' })}>\n {formatEnumLabel(item.kind)}\n </OverlayBadge>\n </button>\n\n <div className=\"flex flex-1 flex-col p-4\">\n <div className=\"mb-1.5\">\n <StatusBadge status={item.accessLevel} />\n </div>\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"text-start text-sm font-semibold leading-snug text-text-primary hover:underline\"\n >\n {item.title}\n </button>\n\n <div className=\"mt-auto flex flex-col gap-1 pt-3 text-xs text-text-tertiary\">\n {item.origin && (\n <span className=\"inline-flex items-center gap-1 truncate\">\n <MapPin className=\"h-3.5 w-3.5 shrink-0\" /> {item.origin}\n </span>\n )}\n {languageLabel && (\n <span className=\"inline-flex items-center gap-1\">\n <Languages className=\"h-3.5 w-3.5 shrink-0\" aria-hidden=\"true\" />\n <bdi>{languageLabel}</bdi>\n </span>\n )}\n {item.datedAt && (\n <span className=\"inline-flex items-center gap-1\">\n <CalendarClock className=\"h-3.5 w-3.5 shrink-0\" /> {formatDate(item.datedAt)}\n </span>\n )}\n </div>\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;;AA0BA,SAAgBA,EAAgB,EAAE,SAAM,aAAgC;CACtE,IAAMC,IAAOC,EAAUC,EAAK,OACtBC,IAAgBC,EAAoBF,EAAK,SAAS;CAExD,OACE,kBAACG,GAAD;EAAW,WAAU;EAAQ,WAAU;EAAvC,UAAA,CACE,kBAAC,UAAD;GACE,MAAK;GACL,SAASC;GACT,WAAU;GACV,cAAY,QAAQJ,EAAK;GAJ3B,UAAA,CAME,kBAACK,GAAD;IACE,QAAQL,EAAK,MAAM;IACnB,KAAKA,EAAK;IACV,SAAQ;IACR,WAAU;IACV,MAAM,kBAACF,GAAD,EAAM,WAAU,UAAW,CAAA;GAClC,CAAA,GACD,kBAACQ,GAAD;IAAc,UAAS;IAAW,MAAMC,EAAcT,GAAM,EAAE,WAAW,UAAU,CAAC;IACjF,UAAAU,EAAgBR,EAAK,IAAI;GACd,CAAA,CACR;EAER,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACS,GAAD,EAAa,QAAQT,EAAK,YAAc,CAAA;IACrC,CAAA;IACL,kBAAC,UAAD;KACE,MAAK;KACL,SAASI;KACT,WAAU;KAET,UAAAJ,EAAK;IACA,CAAA;IAER,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACGA,EAAK,UACJ,kBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA;QACE,kBAACU,GAAD,EAAQ,WAAU,uBAAwB,CAAA;QAAC;QAAEV,EAAK;OAC9C;;MAEPC,KACC,kBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA,CACE,kBAACU,GAAD;QAAW,WAAU;QAAuB,eAAY;OAAQ,CAAA,GAChE,kBAAC,OAAD,EAAA,UAAMV,EAAmB,CAAA,CACrB;;MAEPD,EAAK,WACJ,kBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA;QACE,kBAACY,GAAD,EAAe,WAAU,uBAAwB,CAAA;QAAC;QAAEC,EAAWb,EAAK,OAAO;OACvE;;KAEL;;GACF;EACI,CAAA,CAAA;;AAEf"}
|
|
@@ -58,7 +58,7 @@ function h({ value: h, onRecorded: g, onClear: _, disabled: v }) {
|
|
|
58
58
|
onClick: () => {
|
|
59
59
|
T.current?.stop(), b(!1);
|
|
60
60
|
},
|
|
61
|
-
children: [/* @__PURE__ */ u(s, { className: "
|
|
61
|
+
children: [/* @__PURE__ */ u(s, { className: "me-1.5 h-4 w-4" }), " Stop recording"]
|
|
62
62
|
})] }) : /* @__PURE__ */ d(l, { children: [
|
|
63
63
|
/* @__PURE__ */ u(o, {
|
|
64
64
|
className: "h-6 w-6 text-text-tertiary",
|
|
@@ -95,7 +95,7 @@ function h({ value: h, onRecorded: g, onClear: _, disabled: v }) {
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
disabled: v,
|
|
98
|
-
children: [/* @__PURE__ */ u(o, { className: "
|
|
98
|
+
children: [/* @__PURE__ */ u(o, { className: "me-1.5 h-4 w-4" }), " Start recording"]
|
|
99
99
|
})
|
|
100
100
|
] }), C && /* @__PURE__ */ d("p", {
|
|
101
101
|
className: "flex items-center gap-1.5 text-xs text-status-error-text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioRecorderControl.js","names":["_Fragment","Fragment$1","pickSupportedMimeType","candidate","formatElapsed","m","seconds","s","AudioRecorderControl","recording","setRecording","useState","elapsed","setElapsed","error","setError","mediaRecorderRef","useRef","chunksRef","streamRef","startedAtRef","timerRef","track","stopTimer","value","AudioPlayer","onClear","Trash2","Button","Square","Mic","isNativePlatform","stream","mimeType","recorder","event","finalMimeType","blob","AlertCircle"],"sources":["../../../src/theculturepost/components/AudioRecorderControl.tsx"],"sourcesContent":["/**\n * AudioRecorderControl — in-app microphone recording for oral-history capture.\n * @module theculturepost/components\n *\n * Uses the standard `navigator.mediaDevices.getUserMedia` + `MediaRecorder`\n * Web APIs, which work identically inside the Capacitor WebView (once the\n * host app declares `RECORD_AUDIO` / `NSMicrophoneUsageDescription`) and in a\n * desktop browser — no native Capacitor plugin is required for audio-only\n * capture. This is what makes \"record now\" possible on-device for field\n * oral-history collection (BOFF-4128), as an addition to the existing\n * upload-an-existing-file flow in {@link MediaDropzone}.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { Mic, Square, Trash2, AlertCircle } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { AudioPlayer } from './AudioPlayer';\nimport { isNativePlatform } from '../utils/nativeBridge';\n\nexport interface RecordedAudio {\n blob: Blob;\n mimeType: string;\n durationSecs: number;\n /** An object URL for local preview — caller must revoke it when done. */\n previewUrl: string;\n}\n\ninterface AudioRecorderControlProps {\n value: RecordedAudio | null;\n onRecorded: (audio: RecordedAudio) => void;\n onClear: () => void;\n disabled?: boolean;\n}\n\n/** Picks the first MIME type the platform's MediaRecorder actually supports. */\nfunction pickSupportedMimeType(): string {\n const candidates = ['audio/webm;codecs=opus', 'audio/webm', 'audio/mp4', 'audio/aac'];\n for (const candidate of candidates) {\n if (typeof MediaRecorder !== 'undefined' && MediaRecorder.isTypeSupported?.(candidate)) {\n return candidate;\n }\n }\n return '';\n}\n\nfunction formatElapsed(seconds: number): string {\n const m = Math.floor(seconds / 60);\n const s = Math.floor(seconds % 60);\n return `${m}:${String(s).padStart(2, '0')}`;\n}\n\nexport function AudioRecorderControl({\n value,\n onRecorded,\n onClear,\n disabled,\n}: AudioRecorderControlProps) {\n const [recording, setRecording] = useState(false);\n const [elapsed, setElapsed] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const mediaRecorderRef = useRef<MediaRecorder | null>(null);\n const chunksRef = useRef<Blob[]>([]);\n const streamRef = useRef<MediaStream | null>(null);\n const startedAtRef = useRef<number>(0);\n const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\n useEffect(\n () => () => {\n // Unmount safety: stop any in-flight recording and release the mic.\n if (timerRef.current) clearInterval(timerRef.current);\n streamRef.current?.getTracks().forEach((track) => track.stop());\n },\n []\n );\n\n const stopTimer = () => {\n if (timerRef.current) {\n clearInterval(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const start = async () => {\n setError(null);\n if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) {\n setError('Microphone recording is not supported in this browser.');\n return;\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n streamRef.current = stream;\n const mimeType = pickSupportedMimeType();\n const recorder = mimeType\n ? new MediaRecorder(stream, { mimeType })\n : new MediaRecorder(stream);\n chunksRef.current = [];\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) chunksRef.current.push(event.data);\n };\n\n recorder.onstop = () => {\n stopTimer();\n stream.getTracks().forEach((track) => track.stop());\n const finalMimeType = recorder.mimeType || mimeType || 'audio/webm';\n const blob = new Blob(chunksRef.current, { type: finalMimeType });\n const durationSecs = Math.max(1, Math.round((Date.now() - startedAtRef.current) / 1000));\n onRecorded({\n blob,\n mimeType: finalMimeType,\n durationSecs,\n previewUrl: URL.createObjectURL(blob),\n });\n };\n\n mediaRecorderRef.current = recorder;\n startedAtRef.current = Date.now();\n setElapsed(0);\n recorder.start();\n setRecording(true);\n timerRef.current = setInterval(() => {\n setElapsed(Math.round((Date.now() - startedAtRef.current) / 1000));\n }, 500);\n } catch {\n setError(\n 'Microphone access was denied or is unavailable. Check app permissions and try again.'\n );\n }\n };\n\n const stop = () => {\n mediaRecorderRef.current?.stop();\n setRecording(false);\n };\n\n const discard = () => {\n if (value) URL.revokeObjectURL(value.previewUrl);\n onClear();\n setElapsed(0);\n };\n\n if (value) {\n return (\n <div className=\"flex flex-col gap-2\">\n <AudioPlayer\n src={value.previewUrl}\n seed=\"local-recording\"\n durationSecs={value.durationSecs}\n />\n <button\n type=\"button\"\n onClick={discard}\n disabled={disabled}\n className=\"inline-flex w-fit items-center gap-1 text-sm text-text-tertiary hover:text-text-primary disabled:opacity-60\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" /> Discard and record again\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col items-center gap-3 rounded-xl border border-dashed border-border-seam bg-bg-surface px-4 py-6 text-center\">\n {recording ? (\n <>\n <div className=\"flex items-center gap-2 text-status-error-text\">\n <span className=\"relative flex h-3 w-3\">\n <span className=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-status-error-text opacity-75\" />\n <span className=\"relative inline-flex h-3 w-3 rounded-full bg-status-error-text\" />\n </span>\n <span className=\"font-mono text-lg tabular-nums\">{formatElapsed(elapsed)}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" onClick={stop}>\n <Square className=\"mr-1.5 h-4 w-4\" /> Stop recording\n </Button>\n </>\n ) : (\n <>\n <Mic className=\"h-6 w-6 text-text-tertiary\" aria-hidden=\"true\" />\n <p className=\"text-sm text-text-secondary\">\n {isNativePlatform()\n ? 'Record the testimony directly on this device.'\n : 'Record using this device’s microphone.'}\n </p>\n <Button type=\"button\" onClick={start} disabled={disabled}>\n <Mic className=\"mr-1.5 h-4 w-4\" /> Start recording\n </Button>\n </>\n )}\n {error && (\n <p className=\"flex items-center gap-1.5 text-xs text-status-error-text\">\n <AlertCircle className=\"h-3.5 w-3.5 shrink-0\" /> {error}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAmCA,SAASE,IAAgC;CAEvC,KAAK,IAAMC,KAAa;EADJ;EAA0B;EAAc;EAAa;CACjD,GACtB,IAAI,OAAO,gBAAkB,OAAe,cAAc,kBAAkBA,CAAS,GACnF,OAAOA;CAGX,OAAO;AACT;AAEA,SAASC,EAAc,GAAyB;CAC9C,IAAMC,I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AAO,IAAI,KAAKnB,EAAU,SAAS,EAAE,MAAMkB,EAAc,CAAC;OAEhE,EAAW;QACT;QACA,UAAUA;QACV,cAJmB,KAAK,IAAI,GAAG,KAAK,OAAO,KAAK,IAAI,IAAIhB,EAAa,WAAW,GAAI,CAIpF;QACA,YAAY,IAAI,gBAAgBiB,CAAI;OACtC,CAAC;MACH,GAEA,EAAiB,UAAUH,GAC3B,EAAa,UAAU,KAAK,IAAI,GAChCrB,EAAW,CAAC,GACZqB,EAAS,MAAM,GACfxB,EAAa,EAAI,GACjB,EAAS,UAAU,kBAAkB;OACnC,EAAW,KAAK,OAAO,KAAK,IAAI,IAAIU,EAAa,WAAW,GAAI,CAAC;MACnE,GAAG,GAAG;KACR,QAAQ;MACN,EACE,sFACF;KACF;IACF;IAwDwD;IAAhD,UAAA,CACE,kBAACU,GAAD,EAAK,WAAU,iBAAkB,CAAA,GAAC,kBAC5B;;EACR,EAAA,CAAA,GAEHhB,KACC,kBAAC,KAAD;GAAG,WAAU;GAAb,UAAA;IACE,kBAACwB,GAAD,EAAa,WAAU,uBAAwB,CAAA;IAAC;IAAExB;GACjD;EAEF,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"AudioRecorderControl.js","names":["_Fragment","Fragment$1","pickSupportedMimeType","candidate","formatElapsed","m","seconds","s","AudioRecorderControl","recording","setRecording","useState","elapsed","setElapsed","error","setError","mediaRecorderRef","useRef","chunksRef","streamRef","startedAtRef","timerRef","track","stopTimer","value","AudioPlayer","onClear","Trash2","Button","Square","Mic","isNativePlatform","stream","mimeType","recorder","event","finalMimeType","blob","AlertCircle"],"sources":["../../../src/theculturepost/components/AudioRecorderControl.tsx"],"sourcesContent":["/**\n * AudioRecorderControl — in-app microphone recording for oral-history capture.\n * @module theculturepost/components\n *\n * Uses the standard `navigator.mediaDevices.getUserMedia` + `MediaRecorder`\n * Web APIs, which work identically inside the Capacitor WebView (once the\n * host app declares `RECORD_AUDIO` / `NSMicrophoneUsageDescription`) and in a\n * desktop browser — no native Capacitor plugin is required for audio-only\n * capture. This is what makes \"record now\" possible on-device for field\n * oral-history collection (BOFF-4128), as an addition to the existing\n * upload-an-existing-file flow in {@link MediaDropzone}.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { Mic, Square, Trash2, AlertCircle } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { AudioPlayer } from './AudioPlayer';\nimport { isNativePlatform } from '../utils/nativeBridge';\n\nexport interface RecordedAudio {\n blob: Blob;\n mimeType: string;\n durationSecs: number;\n /** An object URL for local preview — caller must revoke it when done. */\n previewUrl: string;\n}\n\ninterface AudioRecorderControlProps {\n value: RecordedAudio | null;\n onRecorded: (audio: RecordedAudio) => void;\n onClear: () => void;\n disabled?: boolean;\n}\n\n/** Picks the first MIME type the platform's MediaRecorder actually supports. */\nfunction pickSupportedMimeType(): string {\n const candidates = ['audio/webm;codecs=opus', 'audio/webm', 'audio/mp4', 'audio/aac'];\n for (const candidate of candidates) {\n if (typeof MediaRecorder !== 'undefined' && MediaRecorder.isTypeSupported?.(candidate)) {\n return candidate;\n }\n }\n return '';\n}\n\nfunction formatElapsed(seconds: number): string {\n const m = Math.floor(seconds / 60);\n const s = Math.floor(seconds % 60);\n return `${m}:${String(s).padStart(2, '0')}`;\n}\n\nexport function AudioRecorderControl({\n value,\n onRecorded,\n onClear,\n disabled,\n}: AudioRecorderControlProps) {\n const [recording, setRecording] = useState(false);\n const [elapsed, setElapsed] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const mediaRecorderRef = useRef<MediaRecorder | null>(null);\n const chunksRef = useRef<Blob[]>([]);\n const streamRef = useRef<MediaStream | null>(null);\n const startedAtRef = useRef<number>(0);\n const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\n useEffect(\n () => () => {\n // Unmount safety: stop any in-flight recording and release the mic.\n if (timerRef.current) clearInterval(timerRef.current);\n streamRef.current?.getTracks().forEach((track) => track.stop());\n },\n []\n );\n\n const stopTimer = () => {\n if (timerRef.current) {\n clearInterval(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const start = async () => {\n setError(null);\n if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) {\n setError('Microphone recording is not supported in this browser.');\n return;\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n streamRef.current = stream;\n const mimeType = pickSupportedMimeType();\n const recorder = mimeType\n ? new MediaRecorder(stream, { mimeType })\n : new MediaRecorder(stream);\n chunksRef.current = [];\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) chunksRef.current.push(event.data);\n };\n\n recorder.onstop = () => {\n stopTimer();\n stream.getTracks().forEach((track) => track.stop());\n const finalMimeType = recorder.mimeType || mimeType || 'audio/webm';\n const blob = new Blob(chunksRef.current, { type: finalMimeType });\n const durationSecs = Math.max(1, Math.round((Date.now() - startedAtRef.current) / 1000));\n onRecorded({\n blob,\n mimeType: finalMimeType,\n durationSecs,\n previewUrl: URL.createObjectURL(blob),\n });\n };\n\n mediaRecorderRef.current = recorder;\n startedAtRef.current = Date.now();\n setElapsed(0);\n recorder.start();\n setRecording(true);\n timerRef.current = setInterval(() => {\n setElapsed(Math.round((Date.now() - startedAtRef.current) / 1000));\n }, 500);\n } catch {\n setError(\n 'Microphone access was denied or is unavailable. Check app permissions and try again.'\n );\n }\n };\n\n const stop = () => {\n mediaRecorderRef.current?.stop();\n setRecording(false);\n };\n\n const discard = () => {\n if (value) URL.revokeObjectURL(value.previewUrl);\n onClear();\n setElapsed(0);\n };\n\n if (value) {\n return (\n <div className=\"flex flex-col gap-2\">\n <AudioPlayer\n src={value.previewUrl}\n seed=\"local-recording\"\n durationSecs={value.durationSecs}\n />\n <button\n type=\"button\"\n onClick={discard}\n disabled={disabled}\n className=\"inline-flex w-fit items-center gap-1 text-sm text-text-tertiary hover:text-text-primary disabled:opacity-60\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" /> Discard and record again\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col items-center gap-3 rounded-xl border border-dashed border-border-seam bg-bg-surface px-4 py-6 text-center\">\n {recording ? (\n <>\n <div className=\"flex items-center gap-2 text-status-error-text\">\n <span className=\"relative flex h-3 w-3\">\n <span className=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-status-error-text opacity-75\" />\n <span className=\"relative inline-flex h-3 w-3 rounded-full bg-status-error-text\" />\n </span>\n <span className=\"font-mono text-lg tabular-nums\">{formatElapsed(elapsed)}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" onClick={stop}>\n <Square className=\"me-1.5 h-4 w-4\" /> Stop recording\n </Button>\n </>\n ) : (\n <>\n <Mic className=\"h-6 w-6 text-text-tertiary\" aria-hidden=\"true\" />\n <p className=\"text-sm text-text-secondary\">\n {isNativePlatform()\n ? 'Record the testimony directly on this device.'\n : 'Record using this device’s microphone.'}\n </p>\n <Button type=\"button\" onClick={start} disabled={disabled}>\n <Mic className=\"me-1.5 h-4 w-4\" /> Start recording\n </Button>\n </>\n )}\n {error && (\n <p className=\"flex items-center gap-1.5 text-xs text-status-error-text\">\n <AlertCircle className=\"h-3.5 w-3.5 shrink-0\" /> {error}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAmCA,SAASE,IAAgC;CAEvC,KAAK,IAAMC,KAAa;EADJ;EAA0B;EAAc;EAAa;CACjD,GACtB,IAAI,OAAO,gBAAkB,OAAe,cAAc,kBAAkBA,CAAS,GACnF,OAAOA;CAGX,OAAO;AACT;AAEA,SAASC,EAAc,GAAyB;CAC9C,IAAMC,IAAI,KAAK,MAAMC,IAAU,EAAE,GAC3BC,IAAI,KAAK,MAAMD,IAAU,EAAE;CACjC,OAAO,GAAGD,EAAE,GAAG,OAAOE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;AAC1C;AAEA,SAAgBC,EAAqB,EACnC,UACA,eACA,YACA,eAC4B;CAC5B,IAAM,CAACC,GAAWC,KAAgBC,EAAS,EAAK,GAC1C,CAACC,GAASC,KA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K,IAAI,GAChCrB,EAAW,CAAC,GACZqB,EAAS,MAAM,GACfxB,EAAa,EAAI,GACjB,EAAS,UAAU,kBAAkB;OACnC,EAAW,KAAK,OAAO,KAAK,IAAI,IAAIU,EAAa,WAAW,GAAI,CAAC;MACnE,GAAG,GAAG;KACR,QAAQ;MACN,EACE,sFACF;KACF;IACF;IAwDwD;IAAhD,UAAA,CACE,kBAACU,GAAD,EAAK,WAAU,iBAAkB,CAAA,GAAC,kBAC5B;;EACR,EAAA,CAAA,GAEHhB,KACC,kBAAC,KAAD;GAAG,WAAU;GAAb,UAAA;IACE,kBAACwB,GAAD,EAAa,WAAU,uBAAwB,CAAA;IAAC;IAAExB;GACjD;EAEF,CAAA,CAAA;;AAET"}
|
|
@@ -12,7 +12,7 @@ function c({ collection: c, onOpen: l }) {
|
|
|
12
12
|
children: [/* @__PURE__ */ o("button", {
|
|
13
13
|
type: "button",
|
|
14
14
|
onClick: l,
|
|
15
|
-
className: "group relative block aspect-[3/2] w-full overflow-hidden text-
|
|
15
|
+
className: "group relative block aspect-[3/2] w-full overflow-hidden text-start",
|
|
16
16
|
"aria-label": `Open ${c.name}`,
|
|
17
17
|
children: [/* @__PURE__ */ a(e, {
|
|
18
18
|
fileId: c.cover?.id,
|
|
@@ -35,7 +35,7 @@ function c({ collection: c, onOpen: l }) {
|
|
|
35
35
|
/* @__PURE__ */ a("button", {
|
|
36
36
|
type: "button",
|
|
37
37
|
onClick: l,
|
|
38
|
-
className: "font-display text-
|
|
38
|
+
className: "font-display text-start text-lg font-semibold text-text-primary hover:underline",
|
|
39
39
|
children: c.name
|
|
40
40
|
}),
|
|
41
41
|
c.tradition && /* @__PURE__ */ a("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionCard.js","names":["CollectionCard","GlassCard","onOpen","collection","CoverImage","Library","OverlayBadge","Layers","formatNumber"],"sources":["../../../src/theculturepost/components/CollectionCard.tsx"],"sourcesContent":["/**\n * CollectionCard — a tile for an archive collection.\n * @module theculturepost/components\n *\n * Cover image (collections DO carry a cover file) with the real item count as an\n * {@link OverlayBadge}; serif name, tradition (as region), description. Links to\n * the collection detail page.\n */\n\nimport { Library, Layers } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { OverlayBadge } from './OverlayBadge';\nimport { formatNumber } from '../utils/formatters';\nimport type { TcpCollection } from '../types';\n\ninterface CollectionCardProps {\n collection: TcpCollection;\n onOpen: () => void;\n}\n\nexport function CollectionCard({ collection, onOpen }: CollectionCardProps) {\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[3/2] w-full overflow-hidden text-
|
|
1
|
+
{"version":3,"file":"CollectionCard.js","names":["CollectionCard","GlassCard","onOpen","collection","CoverImage","Library","OverlayBadge","Layers","formatNumber"],"sources":["../../../src/theculturepost/components/CollectionCard.tsx"],"sourcesContent":["/**\n * CollectionCard — a tile for an archive collection.\n * @module theculturepost/components\n *\n * Cover image (collections DO carry a cover file) with the real item count as an\n * {@link OverlayBadge}; serif name, tradition (as region), description. Links to\n * the collection detail page.\n */\n\nimport { Library, Layers } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { OverlayBadge } from './OverlayBadge';\nimport { formatNumber } from '../utils/formatters';\nimport type { TcpCollection } from '../types';\n\ninterface CollectionCardProps {\n collection: TcpCollection;\n onOpen: () => void;\n}\n\nexport function CollectionCard({ collection, onOpen }: CollectionCardProps) {\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[3/2] w-full overflow-hidden text-start\"\n aria-label={`Open ${collection.name}`}\n >\n <CoverImage\n fileId={collection.cover?.id}\n alt={collection.name}\n rounded=\"rounded-none\"\n className=\"h-full w-full transition-transform duration-500 group-hover:scale-[1.03]\"\n icon={<Library className=\"h-8 w-8\" />}\n />\n <OverlayBadge position=\"top-right\" icon={<Layers className=\"h-3 w-3\" />}>\n {formatNumber(collection.itemCount)} {collection.itemCount === 1 ? 'item' : 'items'}\n </OverlayBadge>\n </button>\n\n <div className=\"flex flex-1 flex-col p-5\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"font-display text-start text-lg font-semibold text-text-primary hover:underline\"\n >\n {collection.name}\n </button>\n {collection.tradition && (\n <p className=\"mt-0.5 text-sm text-text-secondary\">{collection.tradition}</p>\n )}\n {collection.description && (\n <p className=\"mt-2 line-clamp-2 text-sm text-text-secondary\">{collection.description}</p>\n )}\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAAgBA,EAAe,EAAE,eAAY,aAA+B;CAC1E,OACE,kBAACC,GAAD;EAAW,WAAU;EAAQ,WAAU;EAAvC,UAAA,CACE,kBAAC,UAAD;GACE,MAAK;GACL,SAASC;GACT,WAAU;GACV,cAAY,QAAQC,EAAW;GAJjC,UAAA,CAME,kBAACC,GAAD;IACE,QAAQD,EAAW,OAAO;IAC1B,KAAKA,EAAW;IAChB,SAAQ;IACR,WAAU;IACV,MAAM,kBAACE,GAAD,EAAS,WAAU,UAAW,CAAA;GACrC,CAAA,GACD,kBAACC,GAAD;IAAc,UAAS;IAAY,MAAM,kBAACC,GAAD,EAAQ,WAAU,UAAW,CAAA;IAAtE,UAAA;KACGC,EAAaL,EAAW,SAAS;KAAE;KAAEA,EAAW,cAAc,IAAI,SAAS;IAChE;GACR,CAAA,CAAA;EAER,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,kBAAC,UAAD;KACE,MAAK;KACL,SAASD;KACT,WAAU;KAET,UAAAC,EAAW;IACN,CAAA;IACPA,EAAW,aACV,kBAAC,KAAD;KAAG,WAAU;KAAsC,UAAAA,EAAW;IAAa,CAAA;IAE5EA,EAAW,eACV,kBAAC,KAAD;KAAG,WAAU;KAAiD,UAAAA,EAAW;IAAe,CAAA;GAEvF;EACI,CAAA,CAAA;;AAEf"}
|
|
@@ -32,7 +32,7 @@ function s({ className: s, compact: c = !1 }) {
|
|
|
32
32
|
"aria-hidden": "true"
|
|
33
33
|
}), l("norms.title", "Community norms")]
|
|
34
34
|
}), /* @__PURE__ */ i("ul", {
|
|
35
|
-
className: "mt-2 flex list-disc flex-col gap-1
|
|
35
|
+
className: "mt-2 flex list-disc flex-col gap-1 ps-5 text-sm text-text-secondary",
|
|
36
36
|
children: o.map((e) => /* @__PURE__ */ i("li", { children: l(e.key, e.fallback) }, e.key))
|
|
37
37
|
})]
|
|
38
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityNorms.js","names":["COMMUNITY_NORMS","CommunityNorms","tr","useTr","titleId","useId","cn","compact","className","HeartHandshake","norm"],"sources":["../../../src/theculturepost/components/CommunityNorms.tsx"],"sourcesContent":["/**\n * CommunityNorms — the community norms, shown up front wherever people\n * start or join a conversation (discussions list, discussion detail, and the\n * open-discussion dialog).\n * @module theculturepost/components\n *\n * Product-wide norms from i18n keys (`norms.*`); workspace-editable norms are\n * a post-launch enhancement. Semantic tokens only.\n */\n\nimport { useId } from 'react';\nimport { HeartHandshake } from 'lucide-react';\nimport { useTr } from '../hooks';\nimport { cn } from '../utils/cn';\n\nexport interface CommunityNorm {\n key: string;\n fallback: string;\n}\n\n/** The norms, in display order. Exported so tests can pin the i18n keys. */\nexport const COMMUNITY_NORMS: readonly CommunityNorm[] = [\n {\n key: 'norms.respect',\n fallback: 'Treat every tradition, faith and community with respect.',\n },\n {\n key: 'norms.ownVoice',\n fallback: 'Speak from your own experience; do not speak for others.',\n },\n {\n key: 'norms.ideas',\n fallback: 'Challenge ideas, never people, and cite sources where you can.',\n },\n];\n\ninterface CommunityNormsProps {\n className?: string;\n /** Tighter spacing for dialogs and list headers. */\n compact?: boolean;\n}\n\nexport function CommunityNorms({ className, compact = false }: CommunityNormsProps) {\n const tr = useTr();\n const titleId = useId();\n return (\n <section\n aria-labelledby={titleId}\n className={cn(\n 'rounded-xl border border-border-seam bg-[var(--color-accent-soft)]',\n compact ? 'p-3' : 'p-4',\n className\n )}\n >\n <h2 id={titleId} className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <HeartHandshake className=\"h-4 w-4 text-accent\" aria-hidden=\"true\" />\n {tr('norms.title', 'Community norms')}\n </h2>\n <ul className=\"mt-2 flex list-disc flex-col gap-1
|
|
1
|
+
{"version":3,"file":"CommunityNorms.js","names":["COMMUNITY_NORMS","CommunityNorms","tr","useTr","titleId","useId","cn","compact","className","HeartHandshake","norm"],"sources":["../../../src/theculturepost/components/CommunityNorms.tsx"],"sourcesContent":["/**\n * CommunityNorms — the community norms, shown up front wherever people\n * start or join a conversation (discussions list, discussion detail, and the\n * open-discussion dialog).\n * @module theculturepost/components\n *\n * Product-wide norms from i18n keys (`norms.*`); workspace-editable norms are\n * a post-launch enhancement. Semantic tokens only.\n */\n\nimport { useId } from 'react';\nimport { HeartHandshake } from 'lucide-react';\nimport { useTr } from '../hooks';\nimport { cn } from '../utils/cn';\n\nexport interface CommunityNorm {\n key: string;\n fallback: string;\n}\n\n/** The norms, in display order. Exported so tests can pin the i18n keys. */\nexport const COMMUNITY_NORMS: readonly CommunityNorm[] = [\n {\n key: 'norms.respect',\n fallback: 'Treat every tradition, faith and community with respect.',\n },\n {\n key: 'norms.ownVoice',\n fallback: 'Speak from your own experience; do not speak for others.',\n },\n {\n key: 'norms.ideas',\n fallback: 'Challenge ideas, never people, and cite sources where you can.',\n },\n];\n\ninterface CommunityNormsProps {\n className?: string;\n /** Tighter spacing for dialogs and list headers. */\n compact?: boolean;\n}\n\nexport function CommunityNorms({ className, compact = false }: CommunityNormsProps) {\n const tr = useTr();\n const titleId = useId();\n return (\n <section\n aria-labelledby={titleId}\n className={cn(\n 'rounded-xl border border-border-seam bg-[var(--color-accent-soft)]',\n compact ? 'p-3' : 'p-4',\n className\n )}\n >\n <h2 id={titleId} className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <HeartHandshake className=\"h-4 w-4 text-accent\" aria-hidden=\"true\" />\n {tr('norms.title', 'Community norms')}\n </h2>\n <ul className=\"mt-2 flex list-disc flex-col gap-1 ps-5 text-sm text-text-secondary\">\n {COMMUNITY_NORMS.map((norm) => (\n <li key={norm.key}>{tr(norm.key, norm.fallback)}</li>\n ))}\n </ul>\n </section>\n );\n}\n"],"mappings":";;;;;;;AAqBA,IAAaA,IAA4C;CACvD;EACE,KAAK;EACL,UAAU;CACZ;CACA;EACE,KAAK;EACL,UAAU;CACZ;CACA;EACE,KAAK;EACL,UAAU;CACZ;AACF;AAQA,SAAgBC,EAAe,EAAE,cAAW,aAAU,MAA8B;CAClF,IAAMC,IAAKC,EAAM,GACXC,IAAUC,EAAM;CACtB,OACE,kBAAC,WAAD;EACE,mBAAiBD;EACjB,WAAWE,EACT,sEACAC,IAAU,QAAQ,OAClBC,CACF;EANF,UAAA,CAQE,kBAAC,MAAD;GAAI,IAAIJ;GAAS,WAAU;GAA3B,UAAA,CACE,kBAACK,GAAD;IAAgB,WAAU;IAAsB,eAAY;GAAQ,CAAA,GACnEP,EAAG,eAAe,iBAAiB,CAClC;EACJ,CAAA,GAAA,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAF,EAAgB,KAAK,MACpB,kBAAC,MAAD,EAAA,UAAoBE,EAAGQ,EAAK,KAAKA,EAAK,QAAQ,EAAM,GAA3CA,EAAK,GAAsC,CACrD;EACC,CAAA,CACG;;AAEb"}
|
|
@@ -63,7 +63,7 @@ function ae({ coverFileId: e, onUploaded: r, onCleared: i }) {
|
|
|
63
63
|
className: "max-h-52 w-full object-cover"
|
|
64
64
|
}),
|
|
65
65
|
/* @__PURE__ */ y("div", {
|
|
66
|
-
className: "absolute
|
|
66
|
+
className: "absolute end-2 top-2 flex gap-1.5",
|
|
67
67
|
children: [/* @__PURE__ */ v("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
onClick: () => a.current?.click(),
|
|
@@ -173,7 +173,7 @@ function P({ open: t, onOpenChange: n, topicId: o, onCreated: u }) {
|
|
|
173
173
|
}),
|
|
174
174
|
/* @__PURE__ */ y("div", {
|
|
175
175
|
"data-testid": "create-story-dialog-body",
|
|
176
|
-
className: "flex min-h-0 max-h-[52dvh] flex-1 flex-col gap-5 overflow-y-auto overscroll-contain py-2
|
|
176
|
+
className: "flex min-h-0 max-h-[52dvh] flex-1 flex-col gap-5 overflow-y-auto overscroll-contain py-2 pe-1 md:max-h-none",
|
|
177
177
|
children: [
|
|
178
178
|
/* @__PURE__ */ y("div", {
|
|
179
179
|
className: "grid gap-1.5",
|
|
@@ -212,9 +212,9 @@ function P({ open: t, onOpenChange: n, topicId: o, onCreated: u }) {
|
|
|
212
212
|
I(!0), F(s(e.target.value));
|
|
213
213
|
},
|
|
214
214
|
placeholder: "the-weavers-of-the-coromandel-coast",
|
|
215
|
-
className: $ ? "
|
|
215
|
+
className: $ ? "pe-9" : void 0
|
|
216
216
|
}), $ && /* @__PURE__ */ v(f, {
|
|
217
|
-
className: "pointer-events-none absolute
|
|
217
|
+
className: "pointer-events-none absolute end-3 top-1/2 h-4 w-4 -translate-y-1/2 text-status-success-text",
|
|
218
218
|
"aria-hidden": "true"
|
|
219
219
|
})]
|
|
220
220
|
}),
|
|
@@ -376,7 +376,7 @@ function P({ open: t, onOpenChange: n, topicId: o, onCreated: u }) {
|
|
|
376
376
|
},
|
|
377
377
|
disabled: p.isPending,
|
|
378
378
|
children: p.isPending ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
|
|
379
|
-
className: "
|
|
379
|
+
className: "me-1.5 h-4 w-4 animate-spin",
|
|
380
380
|
"aria-hidden": "true"
|
|
381
381
|
}), " Creating…"] }) : "Create story"
|
|
382
382
|
})]
|