@burdenoff/microfe-theculturepost 2026.1113.1 → 2026.1113.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/components/CommunityNorms.d.ts +22 -0
- package/dist/theculturepost/components/CommunityNorms.js +42 -0
- package/dist/theculturepost/components/CommunityNorms.js.map +1 -0
- package/dist/theculturepost/components/OpenDiscussionDialog.js +63 -61
- package/dist/theculturepost/components/OpenDiscussionDialog.js.map +1 -1
- package/dist/theculturepost/hooks/index.js +7 -7
- package/dist/theculturepost/hooks/useTcpApi.d.ts +6 -1
- package/dist/theculturepost/hooks/useTcpApi.js +252 -237
- package/dist/theculturepost/hooks/useTcpApi.js.map +1 -1
- package/dist/theculturepost/pages/discussions/DiscussionDetailPage.js +151 -146
- package/dist/theculturepost/pages/discussions/DiscussionDetailPage.js.map +1 -1
- package/dist/theculturepost/pages/discussions/DiscussionsPage.js +62 -57
- package/dist/theculturepost/pages/discussions/DiscussionsPage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoriesPage.js +120 -83
- package/dist/theculturepost/pages/stories/StoriesPage.js.map +1 -1
- package/dist/theculturepost/translations/en.d.ts +6 -0
- package/dist/theculturepost/translations/en.js +6 -0
- package/dist/theculturepost/translations/en.js.map +1 -1
- package/dist/theculturepost/utils/storyTraditions.d.ts +8 -0
- package/dist/theculturepost/utils/storyTraditions.js +22 -0
- package/dist/theculturepost/utils/storyTraditions.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommunityNorms — the community norms, shown up front wherever people
|
|
3
|
+
* start or join a conversation (discussions list, discussion detail, and the
|
|
4
|
+
* open-discussion dialog).
|
|
5
|
+
* @module theculturepost/components
|
|
6
|
+
*
|
|
7
|
+
* Product-wide norms from i18n keys (`norms.*`); workspace-editable norms are
|
|
8
|
+
* a post-launch enhancement. Semantic tokens only.
|
|
9
|
+
*/
|
|
10
|
+
export interface CommunityNorm {
|
|
11
|
+
key: string;
|
|
12
|
+
fallback: string;
|
|
13
|
+
}
|
|
14
|
+
/** The norms, in display order. Exported so tests can pin the i18n keys. */
|
|
15
|
+
export declare const COMMUNITY_NORMS: readonly CommunityNorm[];
|
|
16
|
+
interface CommunityNormsProps {
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Tighter spacing for dialogs and list headers. */
|
|
19
|
+
compact?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function CommunityNorms({ className, compact }: CommunityNormsProps): import('react').JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "../hooks/index.js";
|
|
2
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
3
|
+
import { cn as t } from "../utils/cn.js";
|
|
4
|
+
import { useId as n } from "react";
|
|
5
|
+
import { HeartHandshake as r } from "lucide-react";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
// src/theculturepost/components/CommunityNorms.tsx
|
|
8
|
+
var o = [
|
|
9
|
+
{
|
|
10
|
+
key: "norms.respect",
|
|
11
|
+
fallback: "Treat every tradition, faith and community with respect."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: "norms.ownVoice",
|
|
15
|
+
fallback: "Speak from your own experience; do not speak for others."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "norms.ideas",
|
|
19
|
+
fallback: "Challenge ideas, never people, and cite sources where you can."
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
function s({ className: s, compact: c = !1 }) {
|
|
23
|
+
let l = e(), u = n();
|
|
24
|
+
return /* @__PURE__ */ a("section", {
|
|
25
|
+
"aria-labelledby": u,
|
|
26
|
+
className: t("rounded-xl border border-border-seam bg-[var(--color-accent-soft)]", c ? "p-3" : "p-4", s),
|
|
27
|
+
children: [/* @__PURE__ */ a("h2", {
|
|
28
|
+
id: u,
|
|
29
|
+
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
30
|
+
children: [/* @__PURE__ */ i(r, {
|
|
31
|
+
className: "h-4 w-4 text-accent",
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
}), l("norms.title", "Community norms")]
|
|
34
|
+
}), /* @__PURE__ */ i("ul", {
|
|
35
|
+
className: "mt-2 flex list-disc flex-col gap-1 pl-5 text-sm text-text-secondary",
|
|
36
|
+
children: o.map((e) => /* @__PURE__ */ i("li", { children: l(e.key, e.fallback) }, e.key))
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { o as COMMUNITY_NORMS, s as CommunityNorms };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=CommunityNorms.js.map
|
|
@@ -0,0 +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 pl-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"}
|
|
@@ -1,125 +1,127 @@
|
|
|
1
1
|
import { useTcpOpenDiscussion as e, useTcpStories as t } from "../hooks/useTcpApi.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CommunityNorms as n } from "./CommunityNorms.js";
|
|
3
|
+
import { TagInput as r } from "./TagInput.js";
|
|
3
4
|
import "../hooks/index.js";
|
|
4
|
-
import { describeError as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { MessagesSquare as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { Button as
|
|
5
|
+
import { describeError as i, notify as a } from "../lib/toast.js";
|
|
6
|
+
import { useState as o } from "react";
|
|
7
|
+
import { MessagesSquare as s, Plus as c } from "lucide-react";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
import { Button as d, Input as f, Label as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogDescription as g, ResponsiveDialogFooter as _, ResponsiveDialogHeader as v, ResponsiveDialogTitle as y, Select as b, SelectContent as x, SelectItem as S, SelectTrigger as C, SelectValue as w, Switch as T, Textarea as E } from "@burdenoff/fe-libs/ui";
|
|
9
10
|
// src/theculturepost/components/OpenDiscussionDialog.tsx
|
|
10
|
-
function
|
|
11
|
-
let
|
|
11
|
+
function D({ open: D, onOpenChange: O, storyId: k, onCreated: A }) {
|
|
12
|
+
let j = e(), M = t({
|
|
12
13
|
status: "PUBLISHED",
|
|
13
14
|
pagination: { limit: 100 }
|
|
14
|
-
}), [
|
|
15
|
-
|
|
15
|
+
}), [N, P] = o(""), [F, I] = o(""), [L, R] = o(k ?? ""), [z, B] = o(!1), [V, H] = o([]), [U, W] = o(null), G = () => {
|
|
16
|
+
P(""), I(""), R(k ?? ""), B(!1), H([]), W(null);
|
|
16
17
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
open:
|
|
19
|
-
onOpenChange:
|
|
20
|
-
children: /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ l(m, {
|
|
19
|
+
open: D,
|
|
20
|
+
onOpenChange: O,
|
|
21
|
+
children: /* @__PURE__ */ u(h, {
|
|
21
22
|
className: "sm:max-w-lg",
|
|
22
23
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ u(v, { children: [/* @__PURE__ */ u(y, {
|
|
24
25
|
className: "flex items-center gap-2",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ l(s, {
|
|
26
27
|
className: "h-5 w-5 text-accent",
|
|
27
28
|
"aria-hidden": "true"
|
|
28
29
|
}), " Open a discussion"]
|
|
29
|
-
}), /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
}), /* @__PURE__ */ l(g, { children: "Start a respectful conversation. Replies are moderated to keep the space welcoming." })] }),
|
|
31
|
+
/* @__PURE__ */ u("div", {
|
|
31
32
|
className: "flex max-h-[60vh] flex-col gap-4 overflow-y-auto py-2",
|
|
32
33
|
children: [
|
|
33
|
-
/* @__PURE__ */ l(
|
|
34
|
+
/* @__PURE__ */ l(n, { compact: !0 }),
|
|
35
|
+
/* @__PURE__ */ u("div", {
|
|
34
36
|
className: "grid gap-1.5",
|
|
35
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ l(p, {
|
|
36
38
|
htmlFor: "discussion-title",
|
|
37
39
|
children: "Title"
|
|
38
|
-
}), /* @__PURE__ */
|
|
40
|
+
}), /* @__PURE__ */ l(f, {
|
|
39
41
|
id: "discussion-title",
|
|
40
|
-
value:
|
|
41
|
-
onChange: (e) =>
|
|
42
|
+
value: N,
|
|
43
|
+
onChange: (e) => P(e.target.value),
|
|
42
44
|
placeholder: "e.g. How do communities keep oral traditions alive?"
|
|
43
45
|
})]
|
|
44
46
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ u("div", {
|
|
46
48
|
className: "grid gap-1.5",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
49
|
+
children: [/* @__PURE__ */ l(p, {
|
|
48
50
|
htmlFor: "discussion-prompt",
|
|
49
51
|
children: "Prompt"
|
|
50
|
-
}), /* @__PURE__ */
|
|
52
|
+
}), /* @__PURE__ */ l(E, {
|
|
51
53
|
id: "discussion-prompt",
|
|
52
|
-
value:
|
|
53
|
-
onChange: (e) =>
|
|
54
|
+
value: F,
|
|
55
|
+
onChange: (e) => I(e.target.value),
|
|
54
56
|
placeholder: "Set the context and invite perspectives.",
|
|
55
57
|
rows: 3
|
|
56
58
|
})]
|
|
57
59
|
}),
|
|
58
|
-
!
|
|
60
|
+
!k && /* @__PURE__ */ u("div", {
|
|
59
61
|
className: "grid gap-1.5",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
61
|
-
value:
|
|
62
|
-
onValueChange:
|
|
63
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ l(p, { children: "Linked story" }), /* @__PURE__ */ u(b, {
|
|
63
|
+
value: L,
|
|
64
|
+
onValueChange: R,
|
|
65
|
+
children: [/* @__PURE__ */ l(C, { children: /* @__PURE__ */ l(w, { placeholder: "Anchor to a story (optional)" }) }), /* @__PURE__ */ l(x, { children: (M.data?.items ?? []).map((e) => /* @__PURE__ */ l(S, {
|
|
64
66
|
value: e.id,
|
|
65
67
|
children: e.title
|
|
66
68
|
}, e.id)) })]
|
|
67
69
|
})]
|
|
68
70
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ u("div", {
|
|
70
72
|
className: "grid gap-1.5",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ l(p, {
|
|
72
74
|
htmlFor: "discussion-tags",
|
|
73
75
|
children: "Tags"
|
|
74
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ l(r, {
|
|
75
77
|
id: "discussion-tags",
|
|
76
|
-
value:
|
|
77
|
-
onChange:
|
|
78
|
+
value: V,
|
|
79
|
+
onChange: H,
|
|
78
80
|
placeholder: "Add tags…"
|
|
79
81
|
})]
|
|
80
82
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ u("label", {
|
|
82
84
|
className: "flex items-center justify-between gap-3 rounded-xl border border-border-seam bg-bg-surface px-4 py-3",
|
|
83
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: [/* @__PURE__ */ u("span", { children: [/* @__PURE__ */ l("span", {
|
|
84
86
|
className: "block text-sm font-medium text-text-primary",
|
|
85
87
|
children: "Interfaith space"
|
|
86
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ l("span", {
|
|
87
89
|
className: "block text-xs text-text-secondary",
|
|
88
90
|
children: "Signals that perspectives from many traditions are welcome."
|
|
89
|
-
})] }), /* @__PURE__ */
|
|
90
|
-
checked:
|
|
91
|
-
onCheckedChange:
|
|
91
|
+
})] }), /* @__PURE__ */ l(T, {
|
|
92
|
+
checked: z,
|
|
93
|
+
onCheckedChange: B,
|
|
92
94
|
"aria-label": "Interfaith discussion"
|
|
93
95
|
})]
|
|
94
96
|
}),
|
|
95
|
-
|
|
97
|
+
U && /* @__PURE__ */ l("p", {
|
|
96
98
|
className: "text-sm text-status-error-text",
|
|
97
|
-
children:
|
|
99
|
+
children: U
|
|
98
100
|
})
|
|
99
101
|
]
|
|
100
102
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ u(_, { children: [/* @__PURE__ */ l(d, {
|
|
102
104
|
variant: "outline",
|
|
103
|
-
onClick: () =>
|
|
105
|
+
onClick: () => O(!1),
|
|
104
106
|
children: "Cancel"
|
|
105
|
-
}), /* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ u(d, {
|
|
106
108
|
onClick: async () => {
|
|
107
|
-
if (!
|
|
109
|
+
if (!N.trim()) W("A title is required.");
|
|
108
110
|
else try {
|
|
109
|
-
let e = await
|
|
110
|
-
title:
|
|
111
|
-
prompt:
|
|
112
|
-
storyId:
|
|
113
|
-
isInterfaith:
|
|
114
|
-
tags:
|
|
111
|
+
let e = await j.mutateAsync({
|
|
112
|
+
title: N.trim(),
|
|
113
|
+
prompt: F.trim() || null,
|
|
114
|
+
storyId: L || null,
|
|
115
|
+
isInterfaith: z,
|
|
116
|
+
tags: V.length ? V : null
|
|
115
117
|
});
|
|
116
|
-
|
|
118
|
+
a.success("Discussion opened", e.title), O(!1), G(), A?.(e);
|
|
117
119
|
} catch (e) {
|
|
118
|
-
|
|
120
|
+
W(i(e));
|
|
119
121
|
}
|
|
120
122
|
},
|
|
121
|
-
disabled:
|
|
122
|
-
children: [/* @__PURE__ */ c
|
|
123
|
+
disabled: j.isPending,
|
|
124
|
+
children: [/* @__PURE__ */ l(c, {
|
|
123
125
|
className: "mr-1.5 h-4 w-4",
|
|
124
126
|
"aria-hidden": "true"
|
|
125
127
|
}), " Open discussion"]
|
|
@@ -128,6 +130,6 @@ function E({ open: E, onOpenChange: D, storyId: O, onCreated: k }) {
|
|
|
128
130
|
})
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
|
-
export {
|
|
133
|
+
export { D as OpenDiscussionDialog };
|
|
132
134
|
|
|
133
135
|
//# sourceMappingURL=OpenDiscussionDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenDiscussionDialog.js","names":["OpenDiscussionDialog","openDiscussion","useTcpOpenDiscussion","storiesQuery","useTcpStories","title","setTitle","useState","prompt","setPrompt","pickedStory","setPickedStory","storyId","isInterfaith","setIsInterfaith","tags","setTags","error","setError","reset","ResponsiveDialog","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","MessagesSquare","ResponsiveDialogDescription","Label","Input","Textarea","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","story","TagInput","Switch","ResponsiveDialogFooter","Button","onOpenChange","created","notify","onCreated","err","describeError","Plus"],"sources":["../../../src/theculturepost/components/OpenDiscussionDialog.tsx"],"sourcesContent":["/**\n * OpenDiscussionDialog — open a new community discussion.\n * @module theculturepost/components\n *\n * Writes `tcpOpenDiscussion`. An optional interfaith flag marks the space as one\n * that welcomes multiple traditions; an optional story link anchors the thread.\n */\n\nimport { useState } from 'react';\nimport { MessagesSquare, Plus } from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Textarea,\n Switch,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { TagInput } from './TagInput';\nimport { useTcpOpenDiscussion, useTcpStories } from '../hooks';\nimport { notify, describeError } from '../lib/toast';\nimport type { TcpDiscussion } from '../types';\n\ninterface OpenDiscussionDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Anchor the discussion to a story (e.g. from a story detail page). */\n storyId?: string;\n onCreated?: (discussion: TcpDiscussion) => void;\n}\n\nexport function OpenDiscussionDialog({\n open,\n onOpenChange,\n storyId,\n onCreated,\n}: OpenDiscussionDialogProps) {\n const openDiscussion = useTcpOpenDiscussion();\n const storiesQuery = useTcpStories({ status: 'PUBLISHED', pagination: { limit: 100 } });\n\n const [title, setTitle] = useState('');\n const [prompt, setPrompt] = useState('');\n const [pickedStory, setPickedStory] = useState(storyId ?? '');\n const [isInterfaith, setIsInterfaith] = useState(false);\n const [tags, setTags] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n\n const reset = () => {\n setTitle('');\n setPrompt('');\n setPickedStory(storyId ?? '');\n setIsInterfaith(false);\n setTags([]);\n setError(null);\n };\n\n const submit = async () => {\n if (!title.trim()) {\n setError('A title is required.');\n return;\n }\n try {\n const created = await openDiscussion.mutateAsync({\n title: title.trim(),\n prompt: prompt.trim() || null,\n storyId: pickedStory || null,\n isInterfaith,\n tags: tags.length ? tags : null,\n });\n notify.success('Discussion opened', created.title);\n onOpenChange(false);\n reset();\n onCreated?.(created);\n } catch (err) {\n setError(describeError(err));\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className=\"sm:max-w-lg\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle className=\"flex items-center gap-2\">\n <MessagesSquare className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> Open a discussion\n </ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Start a respectful conversation. Replies are moderated to keep the space welcoming.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <div className=\"flex max-h-[60vh] flex-col gap-4 overflow-y-auto py-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-title\">Title</Label>\n <Input\n id=\"discussion-title\"\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n placeholder=\"e.g. How do communities keep oral traditions alive?\"\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-prompt\">Prompt</Label>\n <Textarea\n id=\"discussion-prompt\"\n value={prompt}\n onChange={(e) => setPrompt(e.target.value)}\n placeholder=\"Set the context and invite perspectives.\"\n rows={3}\n />\n </div>\n {!storyId && (\n <div className=\"grid gap-1.5\">\n <Label>Linked story</Label>\n <Select value={pickedStory} onValueChange={setPickedStory}>\n <SelectTrigger>\n <SelectValue placeholder=\"Anchor to a story (optional)\" />\n </SelectTrigger>\n <SelectContent>\n {(storiesQuery.data?.items ?? []).map((story) => (\n <SelectItem key={story.id} value={story.id}>\n {story.title}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n )}\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-tags\">Tags</Label>\n <TagInput\n id=\"discussion-tags\"\n value={tags}\n onChange={setTags}\n placeholder=\"Add tags…\"\n />\n </div>\n <label className=\"flex items-center justify-between gap-3 rounded-xl border border-border-seam bg-bg-surface px-4 py-3\">\n <span>\n <span className=\"block text-sm font-medium text-text-primary\">Interfaith space</span>\n <span className=\"block text-xs text-text-secondary\">\n Signals that perspectives from many traditions are welcome.\n </span>\n </span>\n <Switch\n checked={isInterfaith}\n onCheckedChange={setIsInterfaith}\n aria-label=\"Interfaith discussion\"\n />\n </label>\n {error && <p className=\"text-sm text-status-error-text\">{error}</p>}\n </div>\n\n <ResponsiveDialogFooter>\n <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={openDiscussion.isPending}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Open discussion\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenDiscussionDialog.js","names":["OpenDiscussionDialog","openDiscussion","useTcpOpenDiscussion","storiesQuery","useTcpStories","title","setTitle","useState","prompt","setPrompt","pickedStory","setPickedStory","storyId","isInterfaith","setIsInterfaith","tags","setTags","error","setError","reset","ResponsiveDialog","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","MessagesSquare","ResponsiveDialogDescription","CommunityNorms","Label","Input","Textarea","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","story","TagInput","Switch","ResponsiveDialogFooter","Button","onOpenChange","created","notify","onCreated","err","describeError","Plus"],"sources":["../../../src/theculturepost/components/OpenDiscussionDialog.tsx"],"sourcesContent":["/**\n * OpenDiscussionDialog — open a new community discussion.\n * @module theculturepost/components\n *\n * Writes `tcpOpenDiscussion`. An optional interfaith flag marks the space as one\n * that welcomes multiple traditions; an optional story link anchors the thread.\n */\n\nimport { useState } from 'react';\nimport { MessagesSquare, Plus } from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Textarea,\n Switch,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { CommunityNorms } from './CommunityNorms';\nimport { TagInput } from './TagInput';\nimport { useTcpOpenDiscussion, useTcpStories } from '../hooks';\nimport { notify, describeError } from '../lib/toast';\nimport type { TcpDiscussion } from '../types';\n\ninterface OpenDiscussionDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Anchor the discussion to a story (e.g. from a story detail page). */\n storyId?: string;\n onCreated?: (discussion: TcpDiscussion) => void;\n}\n\nexport function OpenDiscussionDialog({\n open,\n onOpenChange,\n storyId,\n onCreated,\n}: OpenDiscussionDialogProps) {\n const openDiscussion = useTcpOpenDiscussion();\n const storiesQuery = useTcpStories({ status: 'PUBLISHED', pagination: { limit: 100 } });\n\n const [title, setTitle] = useState('');\n const [prompt, setPrompt] = useState('');\n const [pickedStory, setPickedStory] = useState(storyId ?? '');\n const [isInterfaith, setIsInterfaith] = useState(false);\n const [tags, setTags] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n\n const reset = () => {\n setTitle('');\n setPrompt('');\n setPickedStory(storyId ?? '');\n setIsInterfaith(false);\n setTags([]);\n setError(null);\n };\n\n const submit = async () => {\n if (!title.trim()) {\n setError('A title is required.');\n return;\n }\n try {\n const created = await openDiscussion.mutateAsync({\n title: title.trim(),\n prompt: prompt.trim() || null,\n storyId: pickedStory || null,\n isInterfaith,\n tags: tags.length ? tags : null,\n });\n notify.success('Discussion opened', created.title);\n onOpenChange(false);\n reset();\n onCreated?.(created);\n } catch (err) {\n setError(describeError(err));\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className=\"sm:max-w-lg\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle className=\"flex items-center gap-2\">\n <MessagesSquare className=\"h-5 w-5 text-accent\" aria-hidden=\"true\" /> Open a discussion\n </ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Start a respectful conversation. Replies are moderated to keep the space welcoming.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <div className=\"flex max-h-[60vh] flex-col gap-4 overflow-y-auto py-2\">\n <CommunityNorms compact />\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-title\">Title</Label>\n <Input\n id=\"discussion-title\"\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n placeholder=\"e.g. How do communities keep oral traditions alive?\"\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-prompt\">Prompt</Label>\n <Textarea\n id=\"discussion-prompt\"\n value={prompt}\n onChange={(e) => setPrompt(e.target.value)}\n placeholder=\"Set the context and invite perspectives.\"\n rows={3}\n />\n </div>\n {!storyId && (\n <div className=\"grid gap-1.5\">\n <Label>Linked story</Label>\n <Select value={pickedStory} onValueChange={setPickedStory}>\n <SelectTrigger>\n <SelectValue placeholder=\"Anchor to a story (optional)\" />\n </SelectTrigger>\n <SelectContent>\n {(storiesQuery.data?.items ?? []).map((story) => (\n <SelectItem key={story.id} value={story.id}>\n {story.title}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n )}\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"discussion-tags\">Tags</Label>\n <TagInput\n id=\"discussion-tags\"\n value={tags}\n onChange={setTags}\n placeholder=\"Add tags…\"\n />\n </div>\n <label className=\"flex items-center justify-between gap-3 rounded-xl border border-border-seam bg-bg-surface px-4 py-3\">\n <span>\n <span className=\"block text-sm font-medium text-text-primary\">Interfaith space</span>\n <span className=\"block text-xs text-text-secondary\">\n Signals that perspectives from many traditions are welcome.\n </span>\n </span>\n <Switch\n checked={isInterfaith}\n onCheckedChange={setIsInterfaith}\n aria-label=\"Interfaith discussion\"\n />\n </label>\n {error && <p className=\"text-sm text-status-error-text\">{error}</p>}\n </div>\n\n <ResponsiveDialogFooter>\n <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={openDiscussion.isPending}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Open discussion\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mapp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AAU,eAAeC,EAAa,EAAK;KAAG,UAAA;IAEtD,CAAA,GACR,kBAACD,GAAD;KAAQ,SAAS,YArGE;MACzB,IAAI,CAAClC,EAAM,KAAK,GACd,EAAS,sBAAsB;WAGjC,IAAI;OACF,IAAMoC,IAAU,MAAMxC,EAAe,YAAY;QAC/C,OAAOI,EAAM,KAAK;QAClB,QAAQG,EAAO,KAAK,KAAK;QACzB,SAASE,KAAe;QACxB;QACA,MAAMK,EAAK,SAASA,IAAO;OAC7B,CAAC;OAID,AAHA2B,EAAO,QAAQ,qBAAqBD,EAAQ,KAAK,GACjDD,EAAa,EAAK,GAClBrB,EAAM,GACNwB,IAAYF,CAAO;MACrB,SAASG,GAAK;OACZ,EAASC,EAAcD,CAAG,CAAC;MAC7B;KACF;KAiFiC,UAAU3C,EAAe;KAAlD,UAAA,CACE,kBAAC6C,GAAD;MAAM,WAAU;MAAiB,eAAY;KAAQ,CAAA,GAAC,kBAChD;IACc,CAAA,CAAA,EAAA,CAAA;GACD;;CACT,CAAA;AAEtB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TcpApiError as e, useTcpAddCitation as t, useTcpAddStoryClaim as n, useTcpAiContextRuns as r, useTcpArchiveArchiveItem as i, useTcpArchiveItem as a, useTcpArchiveItems as o, useTcpArchiveTopic as s, useTcpCitations as c, useTcpCollection as l, useTcpCollections as u, useTcpCreateArchiveItem as d, useTcpCreateCollection as f, useTcpCreateStory as p, useTcpCreateTopic as m, useTcpDiscussion as h, useTcpDiscussions as g, useTcpGenerateAiContext as _, useTcpLinkCitationToClaim as v, useTcpLockDiscussion as y, useTcpModerateReply as b, useTcpMySavedStories as x, useTcpOpenDiscussion as S, useTcpOralHistories as C, useTcpPostReply as w, useTcpRecordOralHistory as T, useTcpRemoveStoryClaim as E, useTcpReplies as D, useTcpReviewAiContext as O, useTcpStories as k,
|
|
2
|
-
import { useCursorPager as
|
|
3
|
-
import { FILE_FOLDERS as
|
|
4
|
-
import { stripBasePath as
|
|
5
|
-
import { useTr as
|
|
6
|
-
import { usePendingOralHistorySync as
|
|
7
|
-
export {
|
|
1
|
+
import { TcpApiError as e, useTcpAddCitation as t, useTcpAddStoryClaim as n, useTcpAiContextRuns as r, useTcpArchiveArchiveItem as i, useTcpArchiveItem as a, useTcpArchiveItems as o, useTcpArchiveTopic as s, useTcpCitations as c, useTcpCollection as l, useTcpCollections as u, useTcpCreateArchiveItem as d, useTcpCreateCollection as f, useTcpCreateStory as p, useTcpCreateTopic as m, useTcpDiscussion as h, useTcpDiscussions as g, useTcpGenerateAiContext as _, useTcpLinkCitationToClaim as v, useTcpLockDiscussion as y, useTcpModerateReply as b, useTcpMySavedStories as x, useTcpOpenDiscussion as S, useTcpOralHistories as C, useTcpPostReply as w, useTcpRecordOralHistory as T, useTcpRemoveStoryClaim as E, useTcpReplies as D, useTcpReviewAiContext as O, useTcpStories as k, useTcpStoriesForTopics as A, useTcpStory as j, useTcpStoryClaims as M, useTcpToggleStoryBookmark as N, useTcpTopic as P, useTcpTopics as F, useTcpTransitionStory as I, useTcpUpdateArchiveItem as L, useTcpUpdateStory as R, useTcpUpdateStoryClaim as z, useTcpUpdateTopic as B, useTcpVerifyCitation as V } from "./useTcpApi.js";
|
|
2
|
+
import { useCursorPager as H } from "./useCursorPager.js";
|
|
3
|
+
import { FILE_FOLDERS as U, uploadImageToFiles as W, useFileUrl as G } from "./useFiles.js";
|
|
4
|
+
import { stripBasePath as K, usePageAnalytics as q } from "./usePageAnalytics.js";
|
|
5
|
+
import { useTr as J } from "./useTr.js";
|
|
6
|
+
import { usePendingOralHistorySync as Y } from "./usePendingOralHistorySync.js";
|
|
7
|
+
export { U as FILE_FOLDERS, e as TcpApiError, K as stripBasePath, W as uploadImageToFiles, H as useCursorPager, G as useFileUrl, q as usePageAnalytics, Y as usePendingOralHistorySync, t as useTcpAddCitation, n as useTcpAddStoryClaim, r as useTcpAiContextRuns, i as useTcpArchiveArchiveItem, a as useTcpArchiveItem, o as useTcpArchiveItems, s as useTcpArchiveTopic, c as useTcpCitations, l as useTcpCollection, u as useTcpCollections, d as useTcpCreateArchiveItem, f as useTcpCreateCollection, p as useTcpCreateStory, m as useTcpCreateTopic, h as useTcpDiscussion, g as useTcpDiscussions, _ as useTcpGenerateAiContext, v as useTcpLinkCitationToClaim, y as useTcpLockDiscussion, b as useTcpModerateReply, x as useTcpMySavedStories, S as useTcpOpenDiscussion, C as useTcpOralHistories, w as useTcpPostReply, T as useTcpRecordOralHistory, E as useTcpRemoveStoryClaim, D as useTcpReplies, O as useTcpReviewAiContext, k as useTcpStories, A as useTcpStoriesForTopics, j as useTcpStory, M as useTcpStoryClaims, N as useTcpToggleStoryBookmark, P as useTcpTopic, F as useTcpTopics, I as useTcpTransitionStory, L as useTcpUpdateArchiveItem, R as useTcpUpdateStory, z as useTcpUpdateStoryClaim, B as useTcpUpdateTopic, V as useTcpVerifyCitation, J as useTr };
|
|
@@ -10,7 +10,12 @@ export interface StoryFilters {
|
|
|
10
10
|
featured?: boolean;
|
|
11
11
|
pagination?: PaginationInput;
|
|
12
12
|
}
|
|
13
|
-
export declare const useTcpStories: (filters?: StoryFilters) => import('@tanstack/react-query').UseQueryResult<TcpConnection<TcpStory>, Error>;
|
|
13
|
+
export declare const useTcpStories: (filters?: StoryFilters, enabled?: boolean) => import('@tanstack/react-query').UseQueryResult<TcpConnection<TcpStory>, Error>;
|
|
14
|
+
/**
|
|
15
|
+
* Stories across several topics (the svc filters by a single `topicId`). Used by
|
|
16
|
+
* the tradition filter: one query per topic of the tradition, merged by the caller.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useTcpStoriesForTopics: (topicIds: readonly string[], filters?: Omit<StoryFilters, "topicId" | "pagination">, enabled?: boolean) => import('@tanstack/react-query').UseQueryResult<TcpConnection<TcpStory>, Error>[];
|
|
14
19
|
export declare const useTcpStory: (id: string | undefined) => import('@tanstack/react-query').UseQueryResult<TcpStory | null, Error>;
|
|
15
20
|
export declare const useTcpCreateStory: () => import('@tanstack/react-query').UseMutationResult<TcpStory, Error, TcpCreateStoryInput, unknown>;
|
|
16
21
|
export declare const useTcpUpdateStory: () => import('@tanstack/react-query').UseMutationResult<TcpStory, Error, {
|