@parallelworks/tandem-web 0.192.0 → 0.192.2

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.
@@ -632,10 +632,6 @@ var e = {
632
632
  agents: "Agents",
633
633
  settings: "Settings",
634
634
  myAccount: "My account",
635
- online: "{count, plural, other {# online}}",
636
- onThisPage: "{count, plural, one {# other on this page} other {# others on this page}}",
637
- oneOnThisPage: "{name} is here · {count, plural, other {# online}}",
638
- othersOnThisPage: "{here} here · {count, plural, other {# online}}",
639
635
  notifications: "Notifications",
640
636
  createTeam: "Create team",
641
637
  createFirstTeam: "Create a team",
@@ -4141,14 +4137,29 @@ var e = {
4141
4137
  removeView: "Remove view",
4142
4138
  makeSeriesDoc: "Make the {series} notes for this day",
4143
4139
  newOn: "New sub-page on {date}",
4144
- emptyPage: "Empty page",
4145
- fromTemplateDefault: "{template} (default)",
4146
4140
  moreOnDay: "{count} more",
4147
4141
  previousMonth: "Previous month",
4148
4142
  today: "Today",
4149
4143
  nextMonth: "Next month",
4150
4144
  none: "No sub-pages yet.",
4151
4145
  undated: "No date"
4146
+ },
4147
+ newPage: {
4148
+ title: "New page",
4149
+ titleLabel: "Page title",
4150
+ openFull: "Open as a full page",
4151
+ share: "Share",
4152
+ copyLink: "Copy link",
4153
+ linkCopied: "Link copied",
4154
+ more: "More",
4155
+ properties: "Properties",
4156
+ discussions: "Discussions",
4157
+ addComment: "Add a comment…",
4158
+ templates: "Templates",
4159
+ hint: "Press Enter to continue with an empty page, or pick a template (use ↑ and ↓ to select)",
4160
+ empty: "Empty",
4161
+ newTemplate: "New template",
4162
+ newTemplateTitle: "New template"
4152
4163
  }
4153
4164
  };
4154
4165
  export { e as default };
@@ -632,10 +632,6 @@ var e = {
632
632
  agents: "Agentes",
633
633
  settings: "Configuración",
634
634
  myAccount: "Mi cuenta",
635
- online: "{count, plural, other {# en línea}}",
636
- onThisPage: "{count, plural, one {# persona más en esta página} other {# personas más en esta página}}",
637
- oneOnThisPage: "{name} está aquí · {count, plural, other {# en línea}}",
638
- othersOnThisPage: "{here} aquí · {count, plural, other {# en línea}}",
639
635
  notifications: "Notificaciones",
640
636
  createTeam: "Crear equipo",
641
637
  createFirstTeam: "Crear un equipo",
@@ -4141,14 +4137,29 @@ var e = {
4141
4137
  removeView: "Quitar vista",
4142
4138
  makeSeriesDoc: "Crear las notas de {series} de este día",
4143
4139
  newOn: "Nueva subpágina el {date}",
4144
- emptyPage: "Página vacía",
4145
- fromTemplateDefault: "{template} (predeterminada)",
4146
4140
  moreOnDay: "{count} más",
4147
4141
  previousMonth: "Mes anterior",
4148
4142
  today: "Hoy",
4149
4143
  nextMonth: "Mes siguiente",
4150
4144
  none: "Aún no hay subpáginas.",
4151
4145
  undated: "Sin fecha"
4146
+ },
4147
+ newPage: {
4148
+ title: "Página nueva",
4149
+ titleLabel: "Título de la página",
4150
+ openFull: "Abrir como página completa",
4151
+ share: "Compartir",
4152
+ copyLink: "Copiar enlace",
4153
+ linkCopied: "Enlace copiado",
4154
+ more: "Más",
4155
+ properties: "Propiedades",
4156
+ discussions: "Conversaciones",
4157
+ addComment: "Añade un comentario…",
4158
+ templates: "Plantillas",
4159
+ hint: "Pulsa Intro para seguir con una página vacía, o elige una plantilla (usa ↑ y ↓ para seleccionar)",
4160
+ empty: "Vacía",
4161
+ newTemplate: "Nueva plantilla",
4162
+ newTemplateTitle: "Nueva plantilla"
4152
4163
  }
4153
4164
  };
4154
4165
  export { e as default };
@@ -632,10 +632,6 @@ var e = {
632
632
  agents: "エージェント",
633
633
  settings: "設定",
634
634
  myAccount: "マイアカウント",
635
- online: "{count, plural, other {#人がオンライン}}",
636
- onThisPage: "{count, plural, other {このページに他#人}}",
637
- oneOnThisPage: "{name}さんがここにいます · {count, plural, other {#人がオンライン}}",
638
- othersOnThisPage: "ここに{here}人 · {count, plural, other {#人がオンライン}}",
639
635
  notifications: "通知",
640
636
  createTeam: "チームを作成",
641
637
  createFirstTeam: "チームを作成",
@@ -4141,14 +4137,29 @@ var e = {
4141
4137
  removeView: "ビューを削除",
4142
4138
  makeSeriesDoc: "この日の {series} のノートを作成",
4143
4139
  newOn: "{date} の新しいサブページ",
4144
- emptyPage: "空のページ",
4145
- fromTemplateDefault: "{template}(既定)",
4146
4140
  moreOnDay: "他 {count} 件",
4147
4141
  previousMonth: "前の月",
4148
4142
  today: "今日",
4149
4143
  nextMonth: "次の月",
4150
4144
  none: "サブページはまだありません。",
4151
4145
  undated: "日付なし"
4146
+ },
4147
+ newPage: {
4148
+ title: "新しいページ",
4149
+ titleLabel: "ページのタイトル",
4150
+ openFull: "フルページで開く",
4151
+ share: "共有",
4152
+ copyLink: "リンクをコピー",
4153
+ linkCopied: "リンクをコピーしました",
4154
+ more: "その他",
4155
+ properties: "プロパティ",
4156
+ discussions: "ディスカッション",
4157
+ addComment: "コメントを追加…",
4158
+ templates: "テンプレート",
4159
+ hint: "Enter で空のページのまま続けるか、テンプレートを選択します(↑ と ↓ で選択)",
4160
+ empty: "空",
4161
+ newTemplate: "新しいテンプレート",
4162
+ newTemplateTitle: "新しいテンプレート"
4152
4163
  }
4153
4164
  };
4154
4165
  export { e as default };
@@ -632,10 +632,6 @@ var e = {
632
632
  agents: "에이전트",
633
633
  settings: "설정",
634
634
  myAccount: "내 계정",
635
- online: "{count, plural, other {#명 온라인}}",
636
- onThisPage: "{count, plural, other {이 페이지에 다른 #명}}",
637
- oneOnThisPage: "{name} 님이 여기 있음 · {count, plural, other {#명 온라인}}",
638
- othersOnThisPage: "여기 {here}명 · {count, plural, other {#명 온라인}}",
639
635
  notifications: "알림",
640
636
  createTeam: "팀 생성",
641
637
  createFirstTeam: "팀 생성",
@@ -4141,14 +4137,29 @@ var e = {
4141
4137
  removeView: "보기 삭제",
4142
4138
  makeSeriesDoc: "이 날의 {series} 노트 만들기",
4143
4139
  newOn: "{date}에 새 하위 페이지",
4144
- emptyPage: "빈 페이지",
4145
- fromTemplateDefault: "{template} (기본)",
4146
4140
  moreOnDay: "{count}개 더",
4147
4141
  previousMonth: "이전 달",
4148
4142
  today: "오늘",
4149
4143
  nextMonth: "다음 달",
4150
4144
  none: "아직 하위 페이지가 없습니다.",
4151
4145
  undated: "날짜 없음"
4146
+ },
4147
+ newPage: {
4148
+ title: "새 페이지",
4149
+ titleLabel: "페이지 제목",
4150
+ openFull: "전체 페이지로 열기",
4151
+ share: "공유",
4152
+ copyLink: "링크 복사",
4153
+ linkCopied: "링크를 복사했습니다",
4154
+ more: "더 보기",
4155
+ properties: "속성",
4156
+ discussions: "토론",
4157
+ addComment: "댓글 추가…",
4158
+ templates: "템플릿",
4159
+ hint: "Enter를 눌러 빈 페이지로 계속하거나 템플릿을 고르세요(↑와 ↓로 선택)",
4160
+ empty: "비어 있음",
4161
+ newTemplate: "새 템플릿",
4162
+ newTemplateTitle: "새 템플릿"
4152
4163
  }
4153
4164
  };
4154
4165
  export { e as default };
@@ -632,10 +632,6 @@ var e = {
632
632
  agents: "代理",
633
633
  settings: "设置",
634
634
  myAccount: "我的账户",
635
- online: "{count, plural, other {# 人在线}}",
636
- onThisPage: "{count, plural, other {此页面还有 # 人}}",
637
- oneOnThisPage: "{name} 在这里 · {count, plural, other {# 人在线}}",
638
- othersOnThisPage: "这里有 {here} 人 · {count, plural, other {# 人在线}}",
639
635
  notifications: "通知",
640
636
  createTeam: "创建团队",
641
637
  createFirstTeam: "创建团队",
@@ -4141,14 +4137,29 @@ var e = {
4141
4137
  removeView: "删除视图",
4142
4138
  makeSeriesDoc: "创建这一天的 {series} 记录",
4143
4139
  newOn: "在 {date} 新建子页面",
4144
- emptyPage: "空白页面",
4145
- fromTemplateDefault: "{template}(默认)",
4146
4140
  moreOnDay: "还有 {count} 篇",
4147
4141
  previousMonth: "上个月",
4148
4142
  today: "今天",
4149
4143
  nextMonth: "下个月",
4150
4144
  none: "还没有子页面。",
4151
4145
  undated: "无日期"
4146
+ },
4147
+ newPage: {
4148
+ title: "新页面",
4149
+ titleLabel: "页面标题",
4150
+ openFull: "以完整页面打开",
4151
+ share: "共享",
4152
+ copyLink: "复制链接",
4153
+ linkCopied: "已复制链接",
4154
+ more: "更多",
4155
+ properties: "属性",
4156
+ discussions: "讨论",
4157
+ addComment: "添加评论…",
4158
+ templates: "模板",
4159
+ hint: "按 Enter 继续使用空白页,或选择一个模板(用 ↑ 和 ↓ 选择)",
4160
+ empty: "空",
4161
+ newTemplate: "新建模板",
4162
+ newTemplateTitle: "新建模板"
4152
4163
  }
4153
4164
  };
4154
4165
  export { e as default };
@@ -340,4 +340,4 @@ function N({ workspace: e, space: t, property: r, onDone: a, onRemove: o }) {
340
340
  ]
341
341
  });
342
342
  }
343
- export { O as DocProperties, A as PropertyField, D as usePropertyText };
343
+ export { M as AddProperty, O as DocProperties, A as PropertyField, D as usePropertyText };
@@ -0,0 +1,374 @@
1
+ import { api as e, unwrap as t } from "../api/client.js";
2
+ import { docCommentsQuery as n, docTemplatesQuery as r } from "../api/queries.js";
3
+ import { fromIsoDate as i } from "../lib/datePhrases.js";
4
+ import { docPropertiesQuery as a, spaceScope as o } from "../lib/docProperties.js";
5
+ import { docSeriesQuery as ee } from "../lib/docSeries.js";
6
+ import { docRef as s, docURL as te, useDocMenu as ne } from "../lib/docs.js";
7
+ import { usePeople as re } from "../lib/people.js";
8
+ import { useCan as ie } from "../lib/roles.js";
9
+ import { openShare as ae } from "../lib/share.js";
10
+ import { AddProperty as oe, PropertyField as se } from "./DocProperties.js";
11
+ import { Editor as c } from "./Editor.js";
12
+ import { FavoriteStar as l } from "./FavoriteStar.js";
13
+ import { AddIcon as ce, ExpandIcon as le, FileTextIcon as ue, LinkIcon as de } from "./icons.js";
14
+ import { Button as fe, ErrorText as pe, IconButton as u, Modal as me, cx as he, toast as ge, useOpenMenu as _e } from "@parallelworks/ui";
15
+ import { useNavigate as ve } from "@tanstack/react-router";
16
+ import { useEffect as ye, useRef as d, useState as f } from "react";
17
+ import { useErrorMessage as be } from "@parallelworks/problem/react";
18
+ import { useFormatter as xe, useTranslations as p } from "use-intl";
19
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
20
+ import { useMutation as g, useQuery as _, useQueryClient as Se } from "@tanstack/react-query";
21
+ import { MoreIcon as Ce, ShareIcon as we } from "@parallelworks/ui/icons";
22
+ // src/components/NewPageModal.tsx
23
+ var Te = 400;
24
+ function v({ workspace: v, parent: y, space: b, day: x, dateProperty: S, viewTemplate: C, onClose: w }) {
25
+ let T = p("newPage"), E = p("subpages"), D = xe(), O = be(), k = Se(), A = ve(), Ee = _e(), De = ne(v), { nameOf: Oe } = re(v), ke = ie(v, "manage_labels", o(b)), { data: Ae = [] } = _(a(v, b)), { data: je = [] } = _(r(v)), { data: Me = [] } = _(ee(v, b, x, x)), [j, M] = f(), N = d(void 0), [P, Ne] = f(""), F = d(""), [I, Pe] = f(S ? { [S]: x } : {}), L = d(I), [R, Fe] = f(!1), [z, B] = f(-1), [V, H] = f(""), [U, Ie] = f(), { data: Le = [] } = _({
26
+ ...n(v, j?.key ?? ""),
27
+ enabled: !!j
28
+ }), W = () => k.invalidateQueries({ queryKey: [
29
+ "workspace",
30
+ v,
31
+ "docs"
32
+ ] }), G = (e) => ({ path: {
33
+ workspace: v,
34
+ doc: e
35
+ } }), K = { date: D.dateTime(i(x), { dateStyle: "long" }) }, q = [
36
+ ...je.filter((e) => e.starter || !e.teamId || e.teamId === y.teamId).sort((e, t) => Number(t.id === C) - Number(e.id === C)).map((e) => ({
37
+ kind: "template",
38
+ id: e.id,
39
+ label: e.title
40
+ })),
41
+ ...Me.filter((e) => e.parentId === y.id && !e.stoppedAt && e.template).map((e) => ({
42
+ kind: "series",
43
+ series: e,
44
+ label: e.title
45
+ })),
46
+ {
47
+ kind: "empty",
48
+ label: T("empty")
49
+ }
50
+ ], J = (e) => j ? Promise.resolve(j) : (N.current ??= Re(e).then((e) => (M(e), W(), e), (e) => {
51
+ throw N.current = void 0, e;
52
+ }), N.current), Re = async (n) => {
53
+ let r = P.trim();
54
+ F.current = r;
55
+ let i;
56
+ if (n?.kind === "series" && n.series.upcoming?.includes(x)) i = t(await e.POST("/api/v1/workspaces/{workspace}/doc-series/{series}/docs", {
57
+ params: { path: {
58
+ workspace: v,
59
+ series: n.series.id
60
+ } },
61
+ body: { day: x }
62
+ })), r && (i = t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
63
+ params: G(i.key),
64
+ body: { title: r }
65
+ })));
66
+ else {
67
+ let a = n?.kind === "template" ? n.id : n?.kind === "series" ? n.series.template : void 0, o = n?.kind === "series" ? n.series.title : E("untitled");
68
+ i = t(await e.POST("/api/v1/workspaces/{workspace}/docs", {
69
+ params: { path: { workspace: v } },
70
+ body: {
71
+ parent: y.key,
72
+ ...r || n?.kind !== "template" ? { title: r || o } : {},
73
+ ...a && {
74
+ template: a,
75
+ variables: K
76
+ }
77
+ }
78
+ }));
79
+ }
80
+ let a = Object.fromEntries(Object.entries(L.current).filter(([, e]) => e != null && e !== ""));
81
+ if (Object.keys(a).length > 0) {
82
+ let { properties: n } = t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
83
+ params: G(i.key),
84
+ body: { values: a }
85
+ }));
86
+ i = {
87
+ ...i,
88
+ properties: n
89
+ };
90
+ }
91
+ return i;
92
+ }, Y = (e) => e.catch((e) => {
93
+ Ie(e);
94
+ });
95
+ ye(() => {
96
+ let n = P.trim();
97
+ if (n === F.current) return;
98
+ let r = setTimeout(() => {
99
+ (n || j) && Y(J().then(async (r) => {
100
+ n !== F.current && (F.current = n, M(t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
101
+ params: G(r.key),
102
+ body: { title: n || E("untitled") }
103
+ }))), W());
104
+ }));
105
+ }, Te);
106
+ return () => clearTimeout(r);
107
+ });
108
+ let X = (n) => {
109
+ Fe(!0), B(-1), Y((async () => {
110
+ if (!j && !N.current) {
111
+ await J(n);
112
+ return;
113
+ }
114
+ let r = await J(), i = n.kind === "template" ? n.id : n.kind === "series" ? n.series.template : void 0;
115
+ if (!i) return;
116
+ let a = t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
117
+ params: G(r.key),
118
+ body: {
119
+ startFrom: i,
120
+ variables: K
121
+ }
122
+ }));
123
+ F.current && a.title !== F.current && (a = t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
124
+ params: G(r.key),
125
+ body: { title: F.current }
126
+ }))), M(a), W();
127
+ })());
128
+ }, ze = (n, r) => {
129
+ L.current = {
130
+ ...L.current,
131
+ [n]: r
132
+ }, Pe(L.current), Y((async () => {
133
+ if (!j && !N.current) {
134
+ await J();
135
+ return;
136
+ }
137
+ let i = await J(), { properties: a } = t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
138
+ params: G(i.key),
139
+ body: { values: { [n]: r } }
140
+ }));
141
+ M((e) => e ? {
142
+ ...e,
143
+ properties: a
144
+ } : {
145
+ ...i,
146
+ properties: a
147
+ }), W();
148
+ })());
149
+ }, Be = (r) => {
150
+ r.preventDefault();
151
+ let i = V.trim();
152
+ i && (H(""), Y(J().then(async (r) => {
153
+ t(await e.POST("/api/v1/workspaces/{workspace}/docs/{doc}/comments", {
154
+ params: G(r.key),
155
+ body: { body: i }
156
+ })), await k.invalidateQueries({ queryKey: n(v, r.key).queryKey });
157
+ })));
158
+ }, Ve = () => {
159
+ let t = P.trim();
160
+ t && t !== F.current && J().then(async (n) => {
161
+ t !== F.current && (await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
162
+ params: G(n.key),
163
+ body: { title: t }
164
+ }), W());
165
+ }), w();
166
+ }, Z = (e) => () => {
167
+ Y(J().then(e));
168
+ }, Q = Z((e) => {
169
+ w(), A({
170
+ to: "/$workspace/docs/$doc",
171
+ params: {
172
+ workspace: v,
173
+ doc: s(e)
174
+ }
175
+ });
176
+ }), He = Z((e) => ae({
177
+ doc: e.key,
178
+ title: e.title
179
+ })), Ue = Z((e) => {
180
+ navigator.clipboard.writeText(te(v, e)).then(() => ge.success(T("linkCopied")));
181
+ }), $ = g({
182
+ mutationFn: async () => {
183
+ let n = t(await e.POST("/api/v1/workspaces/{workspace}/docs", {
184
+ params: { path: { workspace: v } },
185
+ body: {
186
+ title: T("newTemplateTitle"),
187
+ ...b !== "workspace" && { team: b }
188
+ }
189
+ }));
190
+ return t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
191
+ params: G(n.key),
192
+ body: { template: !0 }
193
+ }));
194
+ },
195
+ onSuccess: (e) => {
196
+ W(), w(), A({
197
+ to: "/$workspace/docs/$doc",
198
+ params: {
199
+ workspace: v,
200
+ doc: s(e)
201
+ }
202
+ });
203
+ }
204
+ }), We = (e) => {
205
+ if (R) e.key === "Enter" && e.preventDefault();
206
+ else if (e.key === "ArrowDown") e.preventDefault(), B((e) => Math.min(e + 1, q.length - 1));
207
+ else if (e.key === "ArrowUp") e.preventDefault(), B((e) => Math.max(e - 1, -1));
208
+ else if (e.key === "Enter") {
209
+ e.preventDefault();
210
+ let t = q[z] ?? q[q.length - 1];
211
+ t && X(t);
212
+ }
213
+ }, Ge = {
214
+ ...I,
215
+ ...j?.properties ?? {}
216
+ };
217
+ return /* @__PURE__ */ h(me, {
218
+ open: !0,
219
+ onClose: Ve,
220
+ align: "center",
221
+ "aria-label": P.trim() || T("title"),
222
+ className: "flex max-h-[85vh] w-[min(900px,calc(100vw-2rem))] flex-col overflow-hidden",
223
+ children: [/* @__PURE__ */ h("div", {
224
+ className: "flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",
225
+ children: [/* @__PURE__ */ m(u, {
226
+ size: "sm",
227
+ variant: "ghost",
228
+ icon: /* @__PURE__ */ m(le, {}),
229
+ label: T("openFull"),
230
+ onClick: Q
231
+ }), /* @__PURE__ */ h("span", {
232
+ className: "ml-auto flex items-center gap-1",
233
+ children: [
234
+ /* @__PURE__ */ m(fe, {
235
+ size: "sm",
236
+ variant: "ghost",
237
+ icon: /* @__PURE__ */ m(we, {}),
238
+ onClick: He,
239
+ children: T("share")
240
+ }),
241
+ /* @__PURE__ */ m(u, {
242
+ size: "sm",
243
+ variant: "ghost",
244
+ icon: /* @__PURE__ */ m(de, {}),
245
+ label: T("copyLink"),
246
+ onClick: Ue
247
+ }),
248
+ j && /* @__PURE__ */ m(l, {
249
+ workspace: v,
250
+ kind: "doc",
251
+ target: j.id
252
+ }),
253
+ /* @__PURE__ */ m(u, {
254
+ size: "sm",
255
+ variant: "ghost",
256
+ icon: /* @__PURE__ */ m(Ce, {}),
257
+ label: T("more"),
258
+ disabled: !j,
259
+ onClick: (e) => j && Ee(e.currentTarget, De(j))
260
+ })
261
+ ]
262
+ })]
263
+ }), /* @__PURE__ */ h("div", {
264
+ className: "min-h-0 flex-1 overflow-y-auto px-10 pt-8 pb-6 max-sm:px-5",
265
+ children: [
266
+ /* @__PURE__ */ m("textarea", {
267
+ autoFocus: !0,
268
+ rows: 1,
269
+ value: P,
270
+ onChange: (e) => Ne(e.target.value.replace(/\n/g, "")),
271
+ onKeyDown: We,
272
+ placeholder: T("title"),
273
+ "aria-label": T("titleLabel"),
274
+ className: "w-full resize-none bg-transparent text-3xl font-bold outline-none placeholder:text-muted-foreground/60"
275
+ }),
276
+ /* @__PURE__ */ h("section", {
277
+ "aria-label": T("properties"),
278
+ className: "mt-3 space-y-0.5 text-sm",
279
+ children: [Ae.map((e) => /* @__PURE__ */ h("div", {
280
+ className: "flex min-h-8 items-center gap-2",
281
+ children: [/* @__PURE__ */ m("span", {
282
+ className: "w-36 shrink-0 truncate text-muted-foreground",
283
+ children: e.name
284
+ }), /* @__PURE__ */ m("div", {
285
+ className: "min-w-0 flex-1",
286
+ children: /* @__PURE__ */ m(se, {
287
+ workspace: v,
288
+ property: e,
289
+ value: Ge[e.id],
290
+ editable: !0,
291
+ onChange: (t) => ze(e.id, t)
292
+ })
293
+ })]
294
+ }, e.id)), ke && /* @__PURE__ */ m(oe, {
295
+ workspace: v,
296
+ space: b,
297
+ unset: [],
298
+ admin: !0,
299
+ onPick: () => {}
300
+ })]
301
+ }),
302
+ j?.body?.trim() && /* @__PURE__ */ m("div", {
303
+ className: "mt-6 border-t border-border pt-4",
304
+ children: /* @__PURE__ */ m(c, {
305
+ value: j.body,
306
+ editable: !1
307
+ })
308
+ }),
309
+ /* @__PURE__ */ h("section", {
310
+ "aria-label": T("discussions"),
311
+ className: "mt-6",
312
+ children: [
313
+ /* @__PURE__ */ m("h3", {
314
+ className: "mb-2 text-sm font-medium text-muted-foreground",
315
+ children: T("discussions")
316
+ }),
317
+ Le.filter((e) => !e.parentId && !e.deletedAt).map((e) => /* @__PURE__ */ h("p", {
318
+ className: "mb-1 text-sm",
319
+ children: [
320
+ /* @__PURE__ */ m("span", {
321
+ className: "font-medium",
322
+ children: Oe(e.author.kind, e.author.handle)
323
+ }),
324
+ " ",
325
+ e.body
326
+ ]
327
+ }, e.id)),
328
+ /* @__PURE__ */ m("form", {
329
+ onSubmit: Be,
330
+ children: /* @__PURE__ */ m("input", {
331
+ value: V,
332
+ onChange: (e) => H(e.target.value),
333
+ placeholder: T("addComment"),
334
+ "aria-label": T("addComment"),
335
+ className: "h-9 w-full rounded-md bg-transparent px-2 text-sm outline-none placeholder:text-muted-foreground hover:bg-muted focus:bg-muted"
336
+ })
337
+ })
338
+ ]
339
+ }),
340
+ !R && /* @__PURE__ */ h("section", {
341
+ "aria-label": T("templates"),
342
+ className: "mt-6 border-t border-border pt-4",
343
+ children: [/* @__PURE__ */ m("p", {
344
+ className: "mb-2 text-sm text-muted-foreground",
345
+ children: T("hint")
346
+ }), /* @__PURE__ */ h("ul", {
347
+ className: "space-y-0.5",
348
+ children: [q.map((e, t) => /* @__PURE__ */ m("li", { children: /* @__PURE__ */ h("button", {
349
+ type: "button",
350
+ "aria-current": t === z || void 0,
351
+ onMouseEnter: () => B(t),
352
+ onClick: () => X(e),
353
+ className: he("flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-sm", t === z ? "bg-muted" : "hover:bg-muted"),
354
+ children: [/* @__PURE__ */ m(ue, { className: "size-4 shrink-0 text-muted-foreground" }), /* @__PURE__ */ m("span", {
355
+ className: "truncate",
356
+ children: e.label
357
+ })]
358
+ }) }, e.kind === "template" ? e.id : e.kind === "series" ? e.series.id : "empty")), /* @__PURE__ */ m("li", { children: /* @__PURE__ */ h("button", {
359
+ type: "button",
360
+ onClick: () => $.mutate(),
361
+ className: "flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-muted-foreground hover:bg-muted",
362
+ children: [/* @__PURE__ */ m(ce, { className: "size-4 shrink-0" }), T("newTemplate")]
363
+ }) })]
364
+ })]
365
+ }),
366
+ (U || $.error) && /* @__PURE__ */ m(pe, {
367
+ className: "mt-3",
368
+ children: O(U ?? $.error)
369
+ })
370
+ ]
371
+ })]
372
+ });
373
+ }
374
+ export { v as NewPageModal };