@burdenoff/microfe-theculturepost 2026.1123.1 → 2026.1201.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/theculturepost/components/ArchiveItemCard.js +37 -37
- package/dist/theculturepost/components/ArchiveItemCard.js.map +1 -1
- package/dist/theculturepost/components/OralHistoryCard.js +1 -0
- package/dist/theculturepost/components/StoryCard.js +52 -52
- package/dist/theculturepost/components/StoryCard.js.map +1 -1
- package/dist/theculturepost/hooks/useLanguageMetadata.d.ts +2 -0
- package/dist/theculturepost/hooks/useLanguageMetadata.js +10 -0
- package/dist/theculturepost/hooks/useLanguageMetadata.js.map +1 -0
- package/dist/theculturepost/pages/archive/ArchiveItemDetailPage.js +129 -128
- package/dist/theculturepost/pages/archive/ArchiveItemDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/archive/ArchivePage.js +98 -101
- package/dist/theculturepost/pages/archive/ArchivePage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoryDetailPage.js +285 -288
- package/dist/theculturepost/pages/stories/StoryDetailPage.js.map +1 -1
- package/dist/theculturepost/utils/languageMetadata.d.ts +6 -0
- package/dist/theculturepost/utils/languageMetadata.js +35 -0
- package/dist/theculturepost/utils/languageMetadata.js.map +1 -0
- package/package.json +6 -2
|
@@ -3,70 +3,70 @@ import { StatusBadge as t } from "./StatusBadge.js";
|
|
|
3
3
|
import { OverlayBadge as n } from "./OverlayBadge.js";
|
|
4
4
|
import { KIND_ICON as r } from "./kindIcon.js";
|
|
5
5
|
import { formatDate as i, formatEnumLabel as a } from "../utils/formatters.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { useLanguageMetadata as o } from "../hooks/useLanguageMetadata.js";
|
|
7
|
+
import { createElement as s } from "react";
|
|
8
|
+
import { CalendarClock as c, Languages as l, MapPin as u } from "lucide-react";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { GlassCard as p } from "@burdenoff/fe-libs/ui";
|
|
10
11
|
// src/theculturepost/components/ArchiveItemCard.tsx
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
function m({ item: m, onOpen: h }) {
|
|
13
|
+
let g = r[m.kind], _ = o(m.languages);
|
|
14
|
+
return /* @__PURE__ */ f(p, {
|
|
14
15
|
treatment: "plain",
|
|
15
16
|
className: "flex flex-col overflow-hidden",
|
|
16
|
-
children: [/* @__PURE__ */
|
|
17
|
+
children: [/* @__PURE__ */ f("button", {
|
|
17
18
|
type: "button",
|
|
18
|
-
onClick:
|
|
19
|
+
onClick: h,
|
|
19
20
|
className: "group relative block aspect-[4/3] w-full overflow-hidden text-left",
|
|
20
|
-
"aria-label": `Open ${
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
-
fileId:
|
|
23
|
-
alt:
|
|
21
|
+
"aria-label": `Open ${m.title}`,
|
|
22
|
+
children: [/* @__PURE__ */ d(e, {
|
|
23
|
+
fileId: m.file?.id,
|
|
24
|
+
alt: m.title,
|
|
24
25
|
rounded: "rounded-none",
|
|
25
26
|
className: "h-full w-full transition-transform duration-500 group-hover:scale-[1.03]",
|
|
26
|
-
icon: /* @__PURE__ */
|
|
27
|
-
}), /* @__PURE__ */
|
|
27
|
+
icon: /* @__PURE__ */ d(g, { className: "h-8 w-8" })
|
|
28
|
+
}), /* @__PURE__ */ d(n, {
|
|
28
29
|
position: "top-left",
|
|
29
|
-
icon:
|
|
30
|
-
children: a(
|
|
30
|
+
icon: s(g, { className: "h-3 w-3" }),
|
|
31
|
+
children: a(m.kind)
|
|
31
32
|
})]
|
|
32
|
-
}), /* @__PURE__ */
|
|
33
|
+
}), /* @__PURE__ */ f("div", {
|
|
33
34
|
className: "flex flex-1 flex-col p-4",
|
|
34
35
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ d("div", {
|
|
36
37
|
className: "mb-1.5",
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ d(t, { status: m.accessLevel })
|
|
38
39
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ d("button", {
|
|
40
41
|
type: "button",
|
|
41
|
-
onClick:
|
|
42
|
+
onClick: h,
|
|
42
43
|
className: "text-left text-sm font-semibold leading-snug text-text-primary hover:underline",
|
|
43
|
-
children:
|
|
44
|
+
children: m.title
|
|
44
45
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ f("div", {
|
|
46
47
|
className: "mt-auto flex flex-col gap-1 pt-3 text-xs text-text-tertiary",
|
|
47
48
|
children: [
|
|
48
|
-
|
|
49
|
+
m.origin && /* @__PURE__ */ f("span", {
|
|
49
50
|
className: "inline-flex items-center gap-1 truncate",
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */ u
|
|
52
|
+
/* @__PURE__ */ d(u, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
52
53
|
" ",
|
|
53
|
-
|
|
54
|
+
m.origin
|
|
54
55
|
]
|
|
55
56
|
}),
|
|
56
|
-
|
|
57
|
+
_ && /* @__PURE__ */ f("span", {
|
|
57
58
|
className: "inline-flex items-center gap-1",
|
|
58
|
-
children: [
|
|
59
|
-
|
|
60
|
-
" "
|
|
61
|
-
|
|
62
|
-
]
|
|
59
|
+
children: [/* @__PURE__ */ d(l, {
|
|
60
|
+
className: "h-3.5 w-3.5 shrink-0",
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}), /* @__PURE__ */ d("bdi", { children: _ })]
|
|
63
63
|
}),
|
|
64
|
-
|
|
64
|
+
m.datedAt && /* @__PURE__ */ f("span", {
|
|
65
65
|
className: "inline-flex items-center gap-1",
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ d(c, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
68
68
|
" ",
|
|
69
|
-
i(
|
|
69
|
+
i(m.datedAt)
|
|
70
70
|
]
|
|
71
71
|
})
|
|
72
72
|
]
|
|
@@ -75,6 +75,6 @@ function p({ item: p, onOpen: m }) {
|
|
|
75
75
|
})]
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
export {
|
|
78
|
+
export { m as ArchiveItemCard };
|
|
79
79
|
|
|
80
80
|
//# sourceMappingURL=ArchiveItemCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchiveItemCard.js","names":["ArchiveItemCard","Icon","KIND_ICON","item","
|
|
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-left\"\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-left 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"}
|
|
@@ -6,103 +6,103 @@ import { categoryIcon as i } from "./categoryMeta.js";
|
|
|
6
6
|
import { formatEnumLabel as a, formatNumber as o, formatRelativeTime as s } from "../utils/formatters.js";
|
|
7
7
|
import "../hooks/index.js";
|
|
8
8
|
import { useTcpToggleStoryBookmark as c } from "../hooks/useTcpApi.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { useLanguageMetadata as l } from "../hooks/useLanguageMetadata.js";
|
|
10
|
+
import { describeError as u, notify as d } from "../lib/toast.js";
|
|
11
|
+
import { cn as f } from "../utils/cn.js";
|
|
12
|
+
import { createElement as p } from "react";
|
|
13
|
+
import { BookOpen as m, Bookmark as h, Clock as g, Languages as _ } from "lucide-react";
|
|
14
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
|
+
import { GlassCard as b } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
// src/theculturepost/components/StoryCard.tsx
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
function x({ story: x, onOpen: S, hideStatus: C = !1 }) {
|
|
18
|
+
let w = x.publishedAt ?? x.updatedAt, T = x.topic?.category ?? null, E = c(), D = l(x.languages);
|
|
19
|
+
return /* @__PURE__ */ y(b, {
|
|
19
20
|
treatment: "plain",
|
|
20
21
|
className: "relative flex flex-col overflow-hidden",
|
|
21
22
|
children: [
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ y("button", {
|
|
23
24
|
type: "button",
|
|
24
|
-
onClick:
|
|
25
|
+
onClick: S,
|
|
25
26
|
className: "group relative block aspect-[16/9] w-full overflow-hidden text-left",
|
|
26
|
-
"aria-label": `Open ${
|
|
27
|
+
"aria-label": `Open ${x.title}`,
|
|
27
28
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
fileId:
|
|
30
|
-
alt:
|
|
29
|
+
/* @__PURE__ */ v(e, {
|
|
30
|
+
fileId: x.cover?.id,
|
|
31
|
+
alt: x.title,
|
|
31
32
|
rounded: "rounded-none",
|
|
32
33
|
className: "h-full w-full transition-transform duration-500 group-hover:scale-[1.03]",
|
|
33
|
-
icon: /* @__PURE__ */
|
|
34
|
+
icon: /* @__PURE__ */ v(m, { className: "h-8 w-8" })
|
|
34
35
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ v(n, {
|
|
36
37
|
position: "top-left",
|
|
37
|
-
children: a(
|
|
38
|
+
children: a(x.format)
|
|
38
39
|
}),
|
|
39
|
-
!
|
|
40
|
+
!C && /* @__PURE__ */ v(n, {
|
|
40
41
|
position: "top-right",
|
|
41
|
-
children: a(
|
|
42
|
+
children: a(x.status)
|
|
42
43
|
})
|
|
43
44
|
]
|
|
44
45
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ v("button", {
|
|
46
47
|
type: "button",
|
|
47
48
|
onClick: async (e) => {
|
|
48
49
|
e.stopPropagation();
|
|
49
50
|
try {
|
|
50
|
-
await
|
|
51
|
+
await E.mutateAsync(x.id);
|
|
51
52
|
} catch (e) {
|
|
52
|
-
|
|
53
|
+
d.error(u(e));
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
|
-
disabled:
|
|
56
|
-
"aria-pressed":
|
|
57
|
-
"aria-label":
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
56
|
+
disabled: E.isPending,
|
|
57
|
+
"aria-pressed": x.isBookmarked,
|
|
58
|
+
"aria-label": x.isBookmarked ? "Remove from reading list" : "Save to reading list",
|
|
59
|
+
className: f("absolute right-2.5 top-2.5 z-10 flex h-8 w-8 items-center justify-center rounded-full", "bg-bg-surface/90 text-text-secondary shadow-sm backdrop-blur transition-colors hover:text-accent", x.isBookmarked && "text-accent"),
|
|
60
|
+
children: /* @__PURE__ */ v(h, { className: f("h-4 w-4", x.isBookmarked && "fill-current") })
|
|
60
61
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ y("div", {
|
|
62
63
|
className: "flex flex-1 flex-col p-5",
|
|
63
64
|
children: [
|
|
64
|
-
|
|
65
|
+
x.topic && /* @__PURE__ */ v("div", {
|
|
65
66
|
className: "mb-2",
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
status:
|
|
68
|
-
icon:
|
|
67
|
+
children: /* @__PURE__ */ v(t, {
|
|
68
|
+
status: T ?? "CULTURE_AND_IDENTITY",
|
|
69
|
+
icon: p(i(T), { className: "h-3 w-3" })
|
|
69
70
|
})
|
|
70
71
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ v("button", {
|
|
72
73
|
type: "button",
|
|
73
|
-
onClick:
|
|
74
|
+
onClick: S,
|
|
74
75
|
className: "font-display text-left text-lg font-semibold leading-snug text-text-primary hover:underline",
|
|
75
|
-
children:
|
|
76
|
+
children: x.title
|
|
76
77
|
}),
|
|
77
|
-
|
|
78
|
+
x.summary && /* @__PURE__ */ v("p", {
|
|
78
79
|
className: "mt-1.5 line-clamp-2 text-sm text-text-secondary",
|
|
79
|
-
children:
|
|
80
|
+
children: x.summary
|
|
80
81
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ y("div", {
|
|
82
83
|
className: "mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-4 text-xs text-text-tertiary",
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
actorId:
|
|
85
|
+
/* @__PURE__ */ v(r, {
|
|
86
|
+
actorId: x.authorId,
|
|
86
87
|
prefix: "By"
|
|
87
88
|
}),
|
|
88
|
-
|
|
89
|
+
x.readingMins > 0 && /* @__PURE__ */ y("span", {
|
|
89
90
|
className: "inline-flex items-center gap-1",
|
|
90
91
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ v(g, { className: "h-3.5 w-3.5" }),
|
|
92
93
|
" ",
|
|
93
|
-
o(
|
|
94
|
+
o(x.readingMins),
|
|
94
95
|
" min read"
|
|
95
96
|
]
|
|
96
97
|
}),
|
|
97
|
-
|
|
98
|
+
D && /* @__PURE__ */ y("span", {
|
|
98
99
|
className: "inline-flex items-center gap-1",
|
|
99
|
-
children: [
|
|
100
|
-
|
|
101
|
-
" "
|
|
102
|
-
|
|
103
|
-
]
|
|
100
|
+
children: [/* @__PURE__ */ v(_, {
|
|
101
|
+
className: "h-3.5 w-3.5 shrink-0",
|
|
102
|
+
"aria-hidden": "true"
|
|
103
|
+
}), /* @__PURE__ */ v("bdi", { children: D })]
|
|
104
104
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ v("span", { children: s(w) })
|
|
106
106
|
]
|
|
107
107
|
})
|
|
108
108
|
]
|
|
@@ -110,6 +110,6 @@ function b({ story: b, onOpen: x, hideStatus: S = !1 }) {
|
|
|
110
110
|
]
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
export {
|
|
113
|
+
export { x as StoryCard };
|
|
114
114
|
|
|
115
115
|
//# sourceMappingURL=StoryCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryCard.js","names":["StoryCard","dateLabel","story","category","toggleBookmark","useTcpToggleStoryBookmark","GlassCard","onOpen","CoverImage","BookOpen","OverlayBadge","formatEnumLabel","hideStatus","error","describeError","cn","Bookmark","StatusBadge","createElement","categoryIcon","AuthorLabel","Clock","formatNumber","Languages","formatRelativeTime"],"sources":["../../../src/theculturepost/components/StoryCard.tsx"],"sourcesContent":["/**\n * StoryCard — an editorial tile for a story.\n * @module theculturepost/components\n *\n * Cover image (via file id) with the format badge overlaid top-left and the\n * lifecycle status top-right; a colored (semantic-token) category pill, serif\n * title, summary, reading-time + language chips, author + updated time. Links to\n * the story detail page. Only real schema fields — no fabricated metrics.\n */\n\nimport { createElement } from 'react';\nimport { Bookmark, BookOpen, Clock, Languages } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { StatusBadge } from './StatusBadge';\nimport { OverlayBadge } from './OverlayBadge';\nimport { AuthorLabel } from './AuthorLabel';\nimport { categoryIcon } from './categoryMeta';\nimport { formatEnumLabel, formatNumber, formatRelativeTime } from '../utils/formatters';\nimport { useTcpToggleStoryBookmark } from '../hooks';\nimport { notify, describeError } from '../lib/toast';\nimport { cn } from '../utils/cn';\nimport type { TcpStory } from '../types';\n\ninterface StoryCardProps {\n story: TcpStory;\n onOpen: () => void;\n /** Hide the status badge (e.g. on published-only surfaces). */\n hideStatus?: boolean;\n}\n\nexport function StoryCard({ story, onOpen, hideStatus = false }: StoryCardProps) {\n const dateLabel = story.publishedAt ?? story.updatedAt;\n const category = story.topic?.category ?? null;\n const toggleBookmark = useTcpToggleStoryBookmark();\n\n return (\n <GlassCard treatment=\"plain\" className=\"relative flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[16/9] w-full overflow-hidden text-left\"\n aria-label={`Open ${story.title}`}\n >\n <CoverImage\n fileId={story.cover?.id}\n alt={story.title}\n rounded=\"rounded-none\"\n className=\"h-full w-full transition-transform duration-500 group-hover:scale-[1.03]\"\n icon={<BookOpen className=\"h-8 w-8\" />}\n />\n <OverlayBadge position=\"top-left\">{formatEnumLabel(story.format)}</OverlayBadge>\n {!hideStatus && (\n <OverlayBadge position=\"top-right\">{formatEnumLabel(story.status)}</OverlayBadge>\n )}\n </button>\n\n <button\n type=\"button\"\n onClick={async (event) => {\n event.stopPropagation();\n try {\n await toggleBookmark.mutateAsync(story.id);\n } catch (error) {\n notify.error(describeError(error));\n }\n }}\n disabled={toggleBookmark.isPending}\n aria-pressed={story.isBookmarked}\n aria-label={story.isBookmarked ? 'Remove from reading list' : 'Save to reading list'}\n className={cn(\n 'absolute right-2.5 top-2.5 z-10 flex h-8 w-8 items-center justify-center rounded-full',\n 'bg-bg-surface/90 text-text-secondary shadow-sm backdrop-blur transition-colors hover:text-accent',\n story.isBookmarked && 'text-accent'\n )}\n >\n <Bookmark className={cn('h-4 w-4', story.isBookmarked && 'fill-current')} />\n </button>\n\n <div className=\"flex flex-1 flex-col p-5\">\n {story.topic && (\n <div className=\"mb-2\">\n <StatusBadge\n status={category ?? 'CULTURE_AND_IDENTITY'}\n icon={createElement(categoryIcon(category), { className: 'h-3 w-3' })}\n />\n </div>\n )}\n\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"font-display text-left text-lg font-semibold leading-snug text-text-primary hover:underline\"\n >\n {story.title}\n </button>\n\n {story.summary && (\n <p className=\"mt-1.5 line-clamp-2 text-sm text-text-secondary\">{story.summary}</p>\n )}\n\n <div className=\"mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-4 text-xs text-text-tertiary\">\n <AuthorLabel actorId={story.authorId} prefix=\"By\" />\n {story.readingMins > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3.5 w-3.5\" /> {formatNumber(story.readingMins)} min read\n </span>\n )}\n {
|
|
1
|
+
{"version":3,"file":"StoryCard.js","names":["StoryCard","dateLabel","story","category","toggleBookmark","useTcpToggleStoryBookmark","languageLabel","useLanguageMetadata","GlassCard","onOpen","CoverImage","BookOpen","OverlayBadge","formatEnumLabel","hideStatus","error","describeError","cn","Bookmark","StatusBadge","createElement","categoryIcon","AuthorLabel","Clock","formatNumber","Languages","formatRelativeTime"],"sources":["../../../src/theculturepost/components/StoryCard.tsx"],"sourcesContent":["/**\n * StoryCard — an editorial tile for a story.\n * @module theculturepost/components\n *\n * Cover image (via file id) with the format badge overlaid top-left and the\n * lifecycle status top-right; a colored (semantic-token) category pill, serif\n * title, summary, reading-time + language chips, author + updated time. Links to\n * the story detail page. Only real schema fields — no fabricated metrics.\n */\n\nimport { createElement } from 'react';\nimport { Bookmark, BookOpen, Clock, Languages } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { CoverImage } from './CoverImage';\nimport { StatusBadge } from './StatusBadge';\nimport { OverlayBadge } from './OverlayBadge';\nimport { AuthorLabel } from './AuthorLabel';\nimport { categoryIcon } from './categoryMeta';\nimport { formatEnumLabel, formatNumber, formatRelativeTime } from '../utils/formatters';\nimport { useTcpToggleStoryBookmark } from '../hooks';\nimport { useLanguageMetadata } from '../hooks/useLanguageMetadata';\nimport { notify, describeError } from '../lib/toast';\nimport { cn } from '../utils/cn';\nimport type { TcpStory } from '../types';\n\ninterface StoryCardProps {\n story: TcpStory;\n onOpen: () => void;\n /** Hide the status badge (e.g. on published-only surfaces). */\n hideStatus?: boolean;\n}\n\nexport function StoryCard({ story, onOpen, hideStatus = false }: StoryCardProps) {\n const dateLabel = story.publishedAt ?? story.updatedAt;\n const category = story.topic?.category ?? null;\n const toggleBookmark = useTcpToggleStoryBookmark();\n const languageLabel = useLanguageMetadata(story.languages);\n\n return (\n <GlassCard treatment=\"plain\" className=\"relative flex flex-col overflow-hidden\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"group relative block aspect-[16/9] w-full overflow-hidden text-left\"\n aria-label={`Open ${story.title}`}\n >\n <CoverImage\n fileId={story.cover?.id}\n alt={story.title}\n rounded=\"rounded-none\"\n className=\"h-full w-full transition-transform duration-500 group-hover:scale-[1.03]\"\n icon={<BookOpen className=\"h-8 w-8\" />}\n />\n <OverlayBadge position=\"top-left\">{formatEnumLabel(story.format)}</OverlayBadge>\n {!hideStatus && (\n <OverlayBadge position=\"top-right\">{formatEnumLabel(story.status)}</OverlayBadge>\n )}\n </button>\n\n <button\n type=\"button\"\n onClick={async (event) => {\n event.stopPropagation();\n try {\n await toggleBookmark.mutateAsync(story.id);\n } catch (error) {\n notify.error(describeError(error));\n }\n }}\n disabled={toggleBookmark.isPending}\n aria-pressed={story.isBookmarked}\n aria-label={story.isBookmarked ? 'Remove from reading list' : 'Save to reading list'}\n className={cn(\n 'absolute right-2.5 top-2.5 z-10 flex h-8 w-8 items-center justify-center rounded-full',\n 'bg-bg-surface/90 text-text-secondary shadow-sm backdrop-blur transition-colors hover:text-accent',\n story.isBookmarked && 'text-accent'\n )}\n >\n <Bookmark className={cn('h-4 w-4', story.isBookmarked && 'fill-current')} />\n </button>\n\n <div className=\"flex flex-1 flex-col p-5\">\n {story.topic && (\n <div className=\"mb-2\">\n <StatusBadge\n status={category ?? 'CULTURE_AND_IDENTITY'}\n icon={createElement(categoryIcon(category), { className: 'h-3 w-3' })}\n />\n </div>\n )}\n\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"font-display text-left text-lg font-semibold leading-snug text-text-primary hover:underline\"\n >\n {story.title}\n </button>\n\n {story.summary && (\n <p className=\"mt-1.5 line-clamp-2 text-sm text-text-secondary\">{story.summary}</p>\n )}\n\n <div className=\"mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-4 text-xs text-text-tertiary\">\n <AuthorLabel actorId={story.authorId} prefix=\"By\" />\n {story.readingMins > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3.5 w-3.5\" /> {formatNumber(story.readingMins)} min read\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 <span>{formatRelativeTime(dateLabel)}</span>\n </div>\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAgBA,EAAU,EAAE,UAAO,WAAQ,gBAAa,MAAyB;CAC/E,IAAMC,IAAYC,EAAM,eAAeA,EAAM,WACvCC,IAAWD,EAAM,OAAO,YAAY,MACpCE,IAAiBC,EAA0B,GAC3CC,IAAgBC,EAAoBL,EAAM,SAAS;CAEzD,OACE,kBAACM,GAAD;EAAW,WAAU;EAAQ,WAAU;EAAvC,UAAA;GACE,kBAAC,UAAD;IACE,MAAK;IACL,SAASC;IACT,WAAU;IACV,cAAY,QAAQP,EAAM;IAJ5B,UAAA;KAME,kBAACQ,GAAD;MACE,QAAQR,EAAM,OAAO;MACrB,KAAKA,EAAM;MACX,SAAQ;MACR,WAAU;MACV,MAAM,kBAACS,GAAD,EAAU,WAAU,UAAW,CAAA;KACtC,CAAA;KACD,kBAACC,GAAD;MAAc,UAAS;MAAY,UAAAC,EAAgBX,EAAM,MAAM;KAAgB,CAAA;KAC9E,CAACY,KACA,kBAACF,GAAD;MAAc,UAAS;MAAa,UAAAC,EAAgBX,EAAM,MAAM;KAAgB,CAAA;IAE5E;;GAER,kBAAC,UAAD;IACE,MAAK;IACL,SAAS,OAAO,MAAU;KACxB,EAAM,gBAAgB;KACtB,IAAI;MACF,MAAME,EAAe,YAAYF,EAAM,EAAE;KAC3C,SAASa,GAAO;MACd,EAAO,MAAMC,EAAcD,CAAK,CAAC;KACnC;IACF;IACA,UAAUX,EAAe;IACzB,gBAAcF,EAAM;IACpB,cAAYA,EAAM,eAAe,6BAA6B;IAC9D,WAAWe,EACT,yFACA,oGACAf,EAAM,gBAAgB,aACxB;IAEA,UAAA,kBAACgB,GAAD,EAAU,WAAWD,EAAG,WAAWf,EAAM,gBAAgB,cAAc,EAAI,CAAA;GACrE,CAAA;GAER,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACGA,EAAM,SACL,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAACiB,GAAD;OACE,QAAQhB,KAAY;OACpB,MAAMiB,EAAcC,EAAalB,CAAQ,GAAG,EAAE,WAAW,UAAU,CAAC;MACrE,CAAA;KACE,CAAA;KAGP,kBAAC,UAAD;MACE,MAAK;MACL,SAASM;MACT,WAAU;MAET,UAAAP,EAAM;KACD,CAAA;KAEPA,EAAM,WACL,kBAAC,KAAD;MAAG,WAAU;MAAmD,UAAAA,EAAM;KAAW,CAAA;KAGnF,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA;OACE,kBAACoB,GAAD;QAAa,SAASpB,EAAM;QAAU,QAAO;OAAM,CAAA;OAClDA,EAAM,cAAc,KACnB,kBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA;SACE,kBAACqB,GAAD,EAAO,WAAU,cAAe,CAAA;SAAC;SAAEC,EAAatB,EAAM,WAAW;SAAE;QAC/D;;OAEPI,KACC,kBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CACE,kBAACmB,GAAD;SAAW,WAAU;SAAuB,eAAY;QAAQ,CAAA,GAChE,kBAAC,OAAD,EAAA,UAAMnB,EAAmB,CAAA,CACrB;;OAER,kBAAC,QAAD,EAAA,UAAOoB,EAAmBzB,CAAS,EAAQ,CAAA;MACxC;;IACF;;EACI;;AAEf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { formatLanguageMetadata as e } from "../utils/languageMetadata.js";
|
|
2
|
+
import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
3
|
+
// src/theculturepost/hooks/useLanguageMetadata.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let { locale: r } = t();
|
|
6
|
+
return e(n, r);
|
|
7
|
+
}
|
|
8
|
+
export { n as useLanguageMetadata };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=useLanguageMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLanguageMetadata.js","names":["useLanguageMetadata","useI18n","formatLanguageMetadata","values","locale"],"sources":["../../../src/theculturepost/hooks/useLanguageMetadata.ts"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { type LanguageMetadata, formatLanguageMetadata } from '../utils/languageMetadata';\n\nexport function useLanguageMetadata(values: LanguageMetadata): string {\n const { locale } = useI18n();\n return formatLanguageMetadata(values, locale);\n}\n"],"mappings":";;;AAGA,SAAgBA,EAAoB,GAAkC;CACpE,IAAM,EAAE,cAAWC,EAAQ;CAC3B,OAAOC,EAAuBC,GAAQC,CAAM;AAC9C"}
|