@eifi1/ui-kit 0.37.0 → 0.38.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.
Files changed (130) hide show
  1. package/README.md +11 -4
  2. package/dist/eslint/index.js +1 -1
  3. package/dist/feedback/feedback-comment-thread.d.ts +87 -0
  4. package/dist/feedback/feedback-comment-thread.js +170 -0
  5. package/dist/feedback/feedback-comment-thread.js.map +1 -0
  6. package/dist/feedback/feedback-dialog-labels.js +2 -1
  7. package/dist/feedback/feedback-dialog-labels.js.map +1 -1
  8. package/dist/feedback/feedback-dialog.d.ts +13 -0
  9. package/dist/feedback/feedback-dialog.js +12 -4
  10. package/dist/feedback/feedback-dialog.js.map +1 -1
  11. package/dist/feedback/feedback-labels.d.ts +11 -0
  12. package/dist/feedback/feedback-labels.js +4 -1
  13. package/dist/feedback/feedback-labels.js.map +1 -1
  14. package/dist/feedback/feedback-menu-labels.js +2 -1
  15. package/dist/feedback/feedback-menu-labels.js.map +1 -1
  16. package/dist/feedback/feedback-menu.d.ts +17 -3
  17. package/dist/feedback/feedback-menu.js +11 -1
  18. package/dist/feedback/feedback-menu.js.map +1 -1
  19. package/dist/feedback/feedback-public-labels.d.ts +53 -0
  20. package/dist/feedback/feedback-public-labels.js +27 -0
  21. package/dist/feedback/feedback-public-labels.js.map +1 -0
  22. package/dist/feedback/feedback-public-list.d.ts +139 -0
  23. package/dist/feedback/feedback-public-list.js +299 -0
  24. package/dist/feedback/feedback-public-list.js.map +1 -0
  25. package/dist/feedback/feedback-public-switch.d.ts +51 -0
  26. package/dist/feedback/feedback-public-switch.js +50 -0
  27. package/dist/feedback/feedback-public-switch.js.map +1 -0
  28. package/dist/feedback/feedback-public-types.d.ts +75 -0
  29. package/dist/feedback/feedback-public-types.js +2 -0
  30. package/dist/feedback/feedback-public-types.js.map +1 -0
  31. package/dist/feedback/feedback-record.d.ts +32 -1
  32. package/dist/feedback/feedback-record.js +10 -0
  33. package/dist/feedback/feedback-record.js.map +1 -1
  34. package/dist/feedback/feedback-replies-context.d.ts +7 -0
  35. package/dist/feedback/feedback-replies-context.js +7 -0
  36. package/dist/feedback/feedback-replies-context.js.map +1 -0
  37. package/dist/feedback/feedback-replies.d.ts +97 -0
  38. package/dist/feedback/feedback-replies.js +114 -0
  39. package/dist/feedback/feedback-replies.js.map +1 -0
  40. package/dist/feedback/feedback-row-detail-labels.js +1 -0
  41. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  42. package/dist/feedback/feedback-row-detail.d.ts +47 -10
  43. package/dist/feedback/feedback-row-detail.js +51 -50
  44. package/dist/feedback/feedback-row-detail.js.map +1 -1
  45. package/dist/feedback/feedback-submit-dialog.d.ts +3 -1
  46. package/dist/feedback/feedback-submit-dialog.js +6 -1
  47. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  48. package/dist/feedback/feedback-submit.d.ts +8 -0
  49. package/dist/feedback/feedback-submit.js +3 -2
  50. package/dist/feedback/feedback-submit.js.map +1 -1
  51. package/dist/feedback/feedback-table.d.ts +15 -5
  52. package/dist/feedback/feedback-table.js +46 -5
  53. package/dist/feedback/feedback-table.js.map +1 -1
  54. package/dist/feedback/feedback-thread-parts-labels.d.ts +6 -0
  55. package/dist/feedback/feedback-thread-parts-labels.js +36 -0
  56. package/dist/feedback/feedback-thread-parts-labels.js.map +1 -0
  57. package/dist/feedback/feedback-thread.d.ts +8 -0
  58. package/dist/feedback/feedback-thread.js +7 -2
  59. package/dist/feedback/feedback-thread.js.map +1 -1
  60. package/dist/feedback/feedback-vote-button.d.ts +49 -0
  61. package/dist/feedback/feedback-vote-button.js +72 -0
  62. package/dist/feedback/feedback-vote-button.js.map +1 -0
  63. package/dist/feedback.d.ts +6 -0
  64. package/dist/feedback.js +6 -0
  65. package/dist/feedback.js.map +1 -1
  66. package/dist/i18n/defaults.js +12 -0
  67. package/dist/i18n/defaults.js.map +1 -1
  68. package/dist/i18n/german.js +69 -3
  69. package/dist/i18n/german.js.map +1 -1
  70. package/dist/i18n/kit-labels.d.ts +16 -0
  71. package/dist/i18n/kit-labels.js.map +1 -1
  72. package/dist/i18n/locales/en.js +85 -3
  73. package/dist/i18n/locales/en.js.map +3 -3
  74. package/dist/i18n/locales/es.js +69 -3
  75. package/dist/i18n/locales/es.js.map +1 -1
  76. package/dist/i18n/locales/fr.js +69 -3
  77. package/dist/i18n/locales/fr.js.map +1 -1
  78. package/dist/i18n/locales/hu.js +69 -3
  79. package/dist/i18n/locales/hu.js.map +1 -1
  80. package/dist/i18n/locales/it.js +69 -3
  81. package/dist/i18n/locales/it.js.map +1 -1
  82. package/dist/i18n/locales/zh.js +69 -3
  83. package/dist/i18n/locales/zh.js.map +1 -1
  84. package/dist/i18n/review.js +5 -0
  85. package/dist/i18n/review.js.map +1 -1
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.js +6 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/notifications/feedback-notification-types-labels.d.ts +15 -0
  90. package/dist/notifications/feedback-notification-types-labels.js +11 -0
  91. package/dist/notifications/feedback-notification-types-labels.js.map +1 -0
  92. package/dist/notifications/feedback-notification-types.d.ts +28 -0
  93. package/dist/notifications/feedback-notification-types.js +21 -0
  94. package/dist/notifications/feedback-notification-types.js.map +1 -0
  95. package/package.json +1 -1
  96. package/src/feedback/feedback-comment-thread.tsx +277 -0
  97. package/src/feedback/feedback-dialog-labels.ts +1 -0
  98. package/src/feedback/feedback-dialog.tsx +30 -2
  99. package/src/feedback/feedback-labels.ts +14 -0
  100. package/src/feedback/feedback-menu-labels.ts +1 -0
  101. package/src/feedback/feedback-menu.tsx +29 -3
  102. package/src/feedback/feedback-public-labels.ts +80 -0
  103. package/src/feedback/feedback-public-list.tsx +478 -0
  104. package/src/feedback/feedback-public-switch.tsx +102 -0
  105. package/src/feedback/feedback-public-types.ts +82 -0
  106. package/src/feedback/feedback-record.ts +39 -1
  107. package/src/feedback/feedback-replies-context.ts +9 -0
  108. package/src/feedback/feedback-replies.tsx +235 -0
  109. package/src/feedback/feedback-row-detail-labels.ts +1 -0
  110. package/src/feedback/feedback-row-detail.tsx +115 -74
  111. package/src/feedback/feedback-submit-dialog.tsx +9 -0
  112. package/src/feedback/feedback-submit.tsx +10 -1
  113. package/src/feedback/feedback-table.tsx +73 -6
  114. package/src/feedback/feedback-thread-parts-labels.ts +41 -0
  115. package/src/feedback/feedback-thread.tsx +18 -1
  116. package/src/feedback/feedback-vote-button.tsx +123 -0
  117. package/src/feedback.ts +10 -0
  118. package/src/i18n/defaults.ts +12 -0
  119. package/src/i18n/german.ts +66 -0
  120. package/src/i18n/kit-labels.tsx +16 -0
  121. package/src/i18n/locales/en.ts +8 -0
  122. package/src/i18n/locales/es.ts +66 -0
  123. package/src/i18n/locales/fr.ts +66 -0
  124. package/src/i18n/locales/hu.ts +66 -0
  125. package/src/i18n/locales/it.ts +66 -0
  126. package/src/i18n/locales/zh.ts +66 -0
  127. package/src/i18n/review.ts +5 -0
  128. package/src/index.ts +9 -0
  129. package/src/notifications/feedback-notification-types-labels.ts +24 -0
  130. package/src/notifications/feedback-notification-types.ts +46 -0
@@ -0,0 +1,299 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import { ChevronLeft, ChevronRight, MessageSquare, ThumbsUp } from "lucide-react";
5
+ import { DataTable } from "../components/data-table.js";
6
+ import { DEFAULT_DATA_TABLE_LABELS } from "../components/data-table-labels.js";
7
+ import { IconButton } from "../components/icon-button.js";
8
+ import { SearchField } from "../components/search-field.js";
9
+ import { ToggleGroup } from "../components/toggle-group.js";
10
+ import { useKitLabels } from "../i18n/kit-labels.js";
11
+ import { cn } from "../lib/cn.js";
12
+ import { EMPTY_FORMATTED_VALUE } from "../lib/format.js";
13
+ import { FeedbackCategoryBadge, FeedbackDetail, FeedbackDetailSection, FeedbackProse, FeedbackStatusBadge } from "./feedback-inbox.js";
14
+ import { useFeedbackCategoryLabels } from "./feedback-labels.js";
15
+ import { FeedbackCommentThread } from "./feedback-comment-thread.js";
16
+ import { DEFAULT_FEEDBACK_PUBLIC_LABELS } from "./feedback-public-labels.js";
17
+ import {
18
+ useFeedbackPageLabels,
19
+ useFeedbackRenderDate
20
+ } from "./feedback-table.js";
21
+ import { FeedbackVoteButton } from "./feedback-vote-button.js";
22
+ function useFeedbackPublicLabels(labels) {
23
+ return useKitLabels("feedbackPublic", DEFAULT_FEEDBACK_PUBLIC_LABELS, labels);
24
+ }
25
+ const SORTS = ["newest", "votes", "updated"];
26
+ function PublicDate({ value, renderDate }) {
27
+ if (!value) return /* @__PURE__ */ jsx("span", { className: "text-placeholder", children: EMPTY_FORMATTED_VALUE });
28
+ return /* @__PURE__ */ jsx("time", { dateTime: value, className: "whitespace-nowrap tabular-nums text-muted", children: renderDate(value) });
29
+ }
30
+ function CommentCount({ count, labels }) {
31
+ if (!count) return null;
32
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex shrink-0 items-center gap-1 text-xs text-muted", "data-feedback-comment-count": count, children: [
33
+ /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5", "aria-hidden": true }),
34
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "tabular-nums", children: count }),
35
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: labels.comments(count) })
36
+ ] });
37
+ }
38
+ function VoteCount({ count, voted, labels }) {
39
+ return /* @__PURE__ */ jsxs(
40
+ "span",
41
+ {
42
+ className: cn("ms-auto inline-flex shrink-0 items-center gap-1 text-xs", voted ? "text-brand" : "text-muted"),
43
+ "data-feedback-vote-count": count,
44
+ children: [
45
+ /* @__PURE__ */ jsx(ThumbsUp, { className: "size-3.5", "aria-hidden": true }),
46
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "tabular-nums", children: count }),
47
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: labels.votes(count) })
48
+ ]
49
+ }
50
+ );
51
+ }
52
+ function PublicPager({
53
+ page,
54
+ hasMore,
55
+ onPageChange,
56
+ labels
57
+ }) {
58
+ const tableLabels = useKitLabels("dataTable", DEFAULT_DATA_TABLE_LABELS);
59
+ const name = labels.page(page + 1);
60
+ return /* @__PURE__ */ jsxs(
61
+ "div",
62
+ {
63
+ role: "group",
64
+ "aria-label": name,
65
+ className: "flex items-center justify-end gap-2 text-sm text-secondary",
66
+ "data-feedback-public-pager": page,
67
+ children: [
68
+ /* @__PURE__ */ jsx(
69
+ IconButton,
70
+ {
71
+ size: "sm",
72
+ variant: "secondary",
73
+ label: tableLabels.prevPage,
74
+ disabled: page <= 0,
75
+ onClick: () => onPageChange(page - 1),
76
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "rtl:-scale-x-100" })
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums", "aria-hidden": true, children: name }),
80
+ /* @__PURE__ */ jsx(
81
+ IconButton,
82
+ {
83
+ size: "sm",
84
+ variant: "secondary",
85
+ label: tableLabels.nextPage,
86
+ disabled: !hasMore,
87
+ onClick: () => onPageChange(page + 1),
88
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:-scale-x-100" })
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ function FeedbackPublicList({
96
+ rows,
97
+ total,
98
+ sort,
99
+ onSortChange,
100
+ search = "",
101
+ onSearchChange,
102
+ renderDetail,
103
+ onVote,
104
+ loading = false,
105
+ openId: openIdProp,
106
+ onOpenChange,
107
+ openRow,
108
+ page: pageIndex = 0,
109
+ hasMore = false,
110
+ onPageChange,
111
+ commit,
112
+ renderDate: renderDateProp,
113
+ labels: labelsProp,
114
+ pageLabels: pageLabelsProp,
115
+ className
116
+ }) {
117
+ const labels = useFeedbackPublicLabels(labelsProp);
118
+ const page = useFeedbackPageLabels(pageLabelsProp);
119
+ const categoryLabels = useFeedbackCategoryLabels();
120
+ const renderDate = useFeedbackRenderDate(renderDateProp);
121
+ const [ownOpenId, setOwnOpenId] = useState(null);
122
+ const openId = openIdProp !== void 0 ? openIdProp : ownOpenId;
123
+ const setOpen = (id) => {
124
+ if (openIdProp === void 0) setOwnOpenId(id);
125
+ onOpenChange?.(id);
126
+ };
127
+ const shownRows = openRow && openId === openRow.id && !rows.some((row) => row.id === openRow.id) ? [openRow, ...rows] : rows;
128
+ const columns = useMemo(
129
+ () => [
130
+ {
131
+ key: "id",
132
+ header: page.columnId,
133
+ cell: (row) => /* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted", children: row.id }),
134
+ mobileHidden: true
135
+ },
136
+ {
137
+ key: "date",
138
+ header: page.columnDate,
139
+ cell: (row) => /* @__PURE__ */ jsx(PublicDate, { value: row.created_at, renderDate })
140
+ },
141
+ {
142
+ key: "category",
143
+ header: page.columnCategory,
144
+ cell: (row) => /* @__PURE__ */ jsx(FeedbackCategoryBadge, { category: row.category, label: categoryLabels[row.category] })
145
+ },
146
+ {
147
+ key: "title",
148
+ header: page.columnSubject,
149
+ cell: (row) => /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 max-w-full items-center gap-2 large:items-start", children: [
150
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate-until-large font-medium", children: row.title }),
151
+ /* @__PURE__ */ jsx(CommentCount, { count: row.comment_count, labels })
152
+ ] }),
153
+ mobilePrimary: true
154
+ },
155
+ {
156
+ key: "votes",
157
+ header: labels.columnVotes,
158
+ className: "whitespace-nowrap",
159
+ // The cell is a button: the row's own link must never wrap it.
160
+ noRowLink: true,
161
+ cell: (row) => /* @__PURE__ */ jsx(
162
+ FeedbackVoteButton,
163
+ {
164
+ votes: row.votes,
165
+ voted: row.voted,
166
+ own: row.mine,
167
+ onVote: (next) => onVote(row, next),
168
+ commit,
169
+ size: "sm"
170
+ }
171
+ )
172
+ },
173
+ {
174
+ key: "status",
175
+ header: page.columnStatus,
176
+ className: "whitespace-nowrap",
177
+ cell: (row) => /* @__PURE__ */ jsx(FeedbackStatusBadge, { status: row.status })
178
+ }
179
+ ],
180
+ [page, labels, categoryLabels, renderDate, onVote, commit]
181
+ );
182
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), "data-feedback-public-list": "", "aria-busy": loading || void 0, children: [
183
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
184
+ /* @__PURE__ */ jsx(
185
+ ToggleGroup,
186
+ {
187
+ "aria-label": labels.sort,
188
+ value: sort,
189
+ onChange: (value) => onSortChange(value),
190
+ options: SORTS.map((value) => ({
191
+ value,
192
+ label: value === "newest" ? labels.sortNewest : value === "votes" ? labels.sortVotes : labels.sortUpdated
193
+ }))
194
+ }
195
+ ),
196
+ onSearchChange && /* @__PURE__ */ jsx(
197
+ SearchField,
198
+ {
199
+ "aria-label": labels.search,
200
+ placeholder: labels.search,
201
+ value: search,
202
+ onChange: onSearchChange,
203
+ className: "min-w-[12rem] flex-1 md:max-w-xs"
204
+ }
205
+ ),
206
+ total !== void 0 && /* @__PURE__ */ jsx("span", { className: "ms-auto text-sm text-muted", "data-feedback-public-total": total, children: labels.total(total) })
207
+ ] }),
208
+ /* @__PURE__ */ jsx(
209
+ DataTable,
210
+ {
211
+ rows: shownRows,
212
+ columns,
213
+ rowKey: (row) => row.id,
214
+ rowName: (row) => row.title,
215
+ onRowClick: (row) => setOpen(openId === row.id ? null : row.id),
216
+ isExpanded: (row) => row.id === openId,
217
+ expandedRow: (row) => renderDetail(row),
218
+ mobileExpandAsDialog: true,
219
+ paginated: false,
220
+ empty: loading ? labels.loading : labels.empty,
221
+ mobileCard: (row) => /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
222
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
223
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 font-medium [overflow-wrap:anywhere]", children: row.title }),
224
+ /* @__PURE__ */ jsx(FeedbackStatusBadge, { status: row.status, className: "shrink-0" })
225
+ ] }),
226
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted", children: [
227
+ /* @__PURE__ */ jsx(FeedbackCategoryBadge, { category: row.category, compact: true, label: categoryLabels[row.category] }),
228
+ /* @__PURE__ */ jsx(PublicDate, { value: row.created_at, renderDate }),
229
+ /* @__PURE__ */ jsx(CommentCount, { count: row.comment_count, labels }),
230
+ /* @__PURE__ */ jsx(VoteCount, { count: row.votes, voted: row.voted || row.mine, labels })
231
+ ] })
232
+ ] })
233
+ }
234
+ ),
235
+ onPageChange && (pageIndex > 0 || hasMore) && /* @__PURE__ */ jsx(PublicPager, { page: pageIndex, hasMore, onPageChange, labels })
236
+ ] });
237
+ }
238
+ function FeedbackPublicDetail({
239
+ row,
240
+ comments,
241
+ onVote,
242
+ isAdmin = false,
243
+ onComment,
244
+ onHide,
245
+ onDelete,
246
+ pending,
247
+ commit,
248
+ voteDisabled,
249
+ renderDate: renderDateProp,
250
+ now,
251
+ labels: labelsProp,
252
+ commentLabels,
253
+ className
254
+ }) {
255
+ const labels = useFeedbackPublicLabels(labelsProp);
256
+ const renderDate = useFeedbackRenderDate(renderDateProp);
257
+ return /* @__PURE__ */ jsxs(FeedbackDetail, { className, children: [
258
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2", "data-feedback-public-detail": row.id, children: [
259
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-secondary", "data-feedback-author": "", children: labels.filedBy(row.author_name ?? labels.anonymous) }),
260
+ /* @__PURE__ */ jsx(PublicDate, { value: row.created_at, renderDate }),
261
+ /* @__PURE__ */ jsx(
262
+ FeedbackVoteButton,
263
+ {
264
+ votes: row.votes,
265
+ voted: row.voted,
266
+ own: row.mine,
267
+ onVote,
268
+ disabled: voteDisabled,
269
+ commit,
270
+ className: "ms-auto"
271
+ }
272
+ )
273
+ ] }),
274
+ /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.body, children: /* @__PURE__ */ jsx(FeedbackProse, { children: row.body }) }),
275
+ /* @__PURE__ */ jsx(FeedbackDetailSection, { title: labels.conversation, children: /* @__PURE__ */ jsx(
276
+ FeedbackCommentThread,
277
+ {
278
+ replies: row.replies,
279
+ comments: comments ?? [],
280
+ loading: comments === void 0,
281
+ isAdmin,
282
+ onComment,
283
+ onHide,
284
+ onDelete,
285
+ pending,
286
+ commit,
287
+ now,
288
+ labels: commentLabels
289
+ }
290
+ ) })
291
+ ] });
292
+ }
293
+ export {
294
+ DEFAULT_FEEDBACK_PUBLIC_LABELS,
295
+ FeedbackPublicDetail,
296
+ FeedbackPublicList,
297
+ useFeedbackPublicLabels
298
+ };
299
+ //# sourceMappingURL=feedback-public-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-public-list.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight, MessageSquare, ThumbsUp } from \"lucide-react\";\nimport { DataTable, type DataTableColumn } from \"../components/data-table\";\nimport { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { IconButton } from \"../components/icon-button\";\nimport { SearchField } from \"../components/search-field\";\nimport { ToggleGroup } from \"../components/toggle-group\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { EMPTY_FORMATTED_VALUE } from \"../lib/format\";\nimport { FeedbackCategoryBadge, FeedbackDetail, FeedbackDetailSection, FeedbackProse, FeedbackStatusBadge } from \"./feedback-inbox\";\nimport { useFeedbackCategoryLabels } from \"./feedback-labels\";\nimport { FeedbackCommentThread, type FeedbackCommentsLabels } from \"./feedback-comment-thread\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from \"./feedback-public-labels\";\nimport type {\n FeedbackComment,\n FeedbackPublicListItem,\n FeedbackPublicRecord,\n FeedbackPublicSort,\n FeedbackVoteState,\n} from \"./feedback-public-types\";\nimport {\n useFeedbackPageLabels,\n useFeedbackRenderDate,\n type FeedbackPageLabels,\n type FeedbackRenderDate,\n} from \"./feedback-table\";\nimport { FeedbackVoteButton } from \"./feedback-vote-button\";\n\nexport { DEFAULT_FEEDBACK_PUBLIC_LABELS };\nexport type { FeedbackPublicLabels };\n\n/** `feedbackPublic` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackPublicLabels(labels?: LabelOverride<FeedbackPublicLabels>): FeedbackPublicLabels {\n return useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS, labels);\n}\n\n/** The sort toggle's order: the server's default first (§9.6). */\nconst SORTS: readonly FeedbackPublicSort[] = [\"newest\", \"votes\", \"updated\"];\n\n/** A date in a cell, as the inbox writes it: `<time>`, nowrap, tabular figures. */\nfunction PublicDate({ value, renderDate }: { value: string | null | undefined; renderDate: FeedbackRenderDate }) {\n if (!value) return <span className=\"text-placeholder\">{EMPTY_FORMATTED_VALUE}</span>;\n return (\n <time dateTime={value} className=\"whitespace-nowrap tabular-nums text-muted\">\n {renderDate(value)}\n </time>\n );\n}\n\n/** The visible comments as a small chip beside the title — the count in figures, the\n * words for a screen reader. Nothing at 0. */\nfunction CommentCount({ count, labels }: { count: number; labels: FeedbackPublicLabels }) {\n if (!count) return null;\n return (\n <span className=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted\" data-feedback-comment-count={count}>\n <MessageSquare className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.comments(count)}</span>\n </span>\n );\n}\n\n/** The votes on a phone card: the thumb and the count, in the brand colour when the\n * viewer's own. */\nfunction VoteCount({ count, voted, labels }: { count: number; voted: boolean; labels: FeedbackPublicLabels }) {\n return (\n <span\n className={cn(\"ms-auto inline-flex shrink-0 items-center gap-1 text-xs\", voted ? \"text-brand\" : \"text-muted\")}\n data-feedback-vote-count={count}\n >\n <ThumbsUp className=\"size-3.5\" aria-hidden />\n <span aria-hidden className=\"tabular-nums\">\n {count}\n </span>\n <span className=\"sr-only\">{labels.votes(count)}</span>\n </span>\n );\n}\n\n/** 0.38.1: previous / next over the server's pages when it answers no total\n * (`GET /feedback/public` — Kurvenschmiede): \"Page 3\" between two arrows. The arrows'\n * names are `dataTable`'s, the strip's; the page's is `feedbackPublic.page`. */\nfunction PublicPager({\n page,\n hasMore,\n onPageChange,\n labels,\n}: {\n page: number;\n hasMore: boolean;\n onPageChange: (page: number) => void;\n labels: FeedbackPublicLabels;\n}) {\n const tableLabels = useKitLabels(\"dataTable\", DEFAULT_DATA_TABLE_LABELS);\n const name = labels.page(page + 1);\n return (\n <div\n role=\"group\"\n aria-label={name}\n className=\"flex items-center justify-end gap-2 text-sm text-secondary\"\n data-feedback-public-pager={page}\n >\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.prevPage}\n disabled={page <= 0}\n onClick={() => onPageChange(page - 1)}\n >\n {/* \"Previous\" points back along the line — left in LTR, right in RTL. */}\n <ChevronLeft className=\"rtl:-scale-x-100\" />\n </IconButton>\n <span className=\"tabular-nums\" aria-hidden>\n {name}\n </span>\n <IconButton\n size=\"sm\"\n variant=\"secondary\"\n label={tableLabels.nextPage}\n disabled={!hasMore}\n onClick={() => onPageChange(page + 1)}\n >\n <ChevronRight className=\"rtl:-scale-x-100\" />\n </IconButton>\n </div>\n );\n}\n\n/* ── The list ─────────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicListProps<T extends FeedbackPublicListItem = FeedbackPublicListItem> {\n /** `GET /feedback/public?sort=&q=` — the server's page, in the server's order. */\n rows: T[];\n /** How many the query has in all — the line beside the sort. Left out, no line. */\n total?: number;\n /** The server sorts (§9.6): the toggle only says which way. */\n sort: FeedbackPublicSort;\n onSortChange: (sort: FeedbackPublicSort) => void;\n /** The search box's text (`q`, titles only). */\n search?: string;\n /**\n * The search box is drawn ONLY with this handler: where the app's titles are sealed\n * (Kurvenschmiede, `FeedbackDeps.public_search=False`, §9.9) there is nothing to search\n * on and the server answers `q` with a 422 — so it passes none.\n */\n onSearchChange?: (search: string) => void;\n /** The opened row: the app's {@link FeedbackPublicDetail} with the row's\n * `GET /feedback/public/{id}` and its comments. */\n renderDetail: (row: T) => ReactNode;\n /** `PUT` / `DELETE /feedback/{id}/vote` for a row's button (`next`: the new state);\n * resolve with the answer, reject to roll back. */\n onVote: (row: T, next: boolean) => Promise<FeedbackVoteState>;\n /** The page is loading: the table says so where its rows would be. */\n loading?: boolean;\n /** The opened row's id, when the app keeps it (a `?row=` param). Left out, the list\n * keeps it itself. */\n openId?: number | null;\n onOpenChange?: (id: number | null) => void;\n /**\n * 0.38.1: the opened report when it is NOT on this page — a `?row=` link to an older\n * one (Kurvenschmiede). The app fetches it (`GET /feedback/public/{id}`, a list item's\n * fields and more) and passes it with `openId`; while `openId` is its id it is drawn\n * first, above the page's rows, and opened with `renderDetail` (on the phone, in the\n * full-screen dialog). Closed, it is gone. A row the page has already is never drawn\n * twice: the page's own is opened instead.\n */\n openRow?: T | null;\n /**\n * 0.38.1: the server's page, from 0 — for a pager where `/feedback/public` answers no\n * total (Kurvenschmiede). With {@link onPageChange} a **Previous / Page n / Next**\n * strip stands under the table; Next is off without {@link hasMore}. Left out, no\n * pager: the server's `limit` is all there is.\n */\n page?: number;\n /** 0.38.1: there is a page after this one (e.g. the page came back full). */\n hasMore?: boolean;\n /** 0.38.1: go to another page (`page ± 1`); the app fetches it. Draws the pager. */\n onPageChange?: (page: number) => void;\n /** A vote COMMITS — see Button's `commit`. */\n commit?: CommitScope;\n /** See {@link FeedbackRenderDate}. Default: the kit's, with the weekday. */\n renderDate?: FeedbackRenderDate;\n /** Over the `feedbackPublic` namespace. The shared column names (#, Date, Category,\n * Subject, Status) are `feedbackPage`'s: pass `pageLabels` for those. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n pageLabels?: LabelOverride<FeedbackPageLabels>;\n className?: string;\n}\n\n/**\n * **All feedback** — the reports every user the app lets in may read (round 0.38,\n * docs/feedback-harmonization.md §9.3, §9.9; keksdose's `/all-feedback`).\n *\n * - **Titles only** (decision 23): #, Date, Category, Subject (with the visible\n * comments), Votes, Status. No body, no submitter, no file — the list item carries\n * none of them (§9.10).\n * - **The server sorts**: the toggle **Newest / Most wanted / Recently updated** sets\n * `sort`, and the columns themselves do not sort (a page of 50 sorted in the browser\n * would not be the 50 the sort asks for).\n * - **The search box only with `onSearchChange`**: an app whose titles are sealed\n * passes none (§9.9).\n * - **Votes** are `FeedbackVoteButton`s, optimistic, the viewer's own report pressed\n * and locked (\"Your report\", §9.6).\n * - A row opens in place with `renderDetail` — on the phone, in a full-screen dialog.\n * The phone cards carry the title, the status, the category, the date and the two\n * counts; the vote itself is in the opened report (a button inside the card, which is\n * the row's own button, would be two controls in one).\n *\n * No client paging: the server's `limit` is the page, and `total` says how many there\n * are. For more than one page, `page` / `hasMore` / `onPageChange` draw a previous /\n * next strip that needs no total (0.38.1); `openRow` shows a `?row=` report from\n * another page. Needs a router, as every `DataTable` does.\n */\nexport function FeedbackPublicList<T extends FeedbackPublicListItem = FeedbackPublicListItem>({\n rows,\n total,\n sort,\n onSortChange,\n search = \"\",\n onSearchChange,\n renderDetail,\n onVote,\n loading = false,\n openId: openIdProp,\n onOpenChange,\n openRow,\n page: pageIndex = 0,\n hasMore = false,\n onPageChange,\n commit,\n renderDate: renderDateProp,\n labels: labelsProp,\n pageLabels: pageLabelsProp,\n className,\n}: FeedbackPublicListProps<T>) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const page = useFeedbackPageLabels(pageLabelsProp);\n const categoryLabels = useFeedbackCategoryLabels();\n const renderDate = useFeedbackRenderDate(renderDateProp);\n const [ownOpenId, setOwnOpenId] = useState<number | null>(null);\n const openId = openIdProp !== undefined ? openIdProp : ownOpenId;\n const setOpen = (id: number | null) => {\n if (openIdProp === undefined) setOwnOpenId(id);\n onOpenChange?.(id);\n };\n // A `?row=` report from another page: first, while it is the open one, and only when\n // the page does not have it itself.\n const shownRows =\n openRow && openId === openRow.id && !rows.some((row) => row.id === openRow.id) ? [openRow, ...rows] : rows;\n\n const columns = useMemo<DataTableColumn<T>[]>(\n () => [\n {\n key: \"id\",\n header: page.columnId,\n cell: (row) => <span className=\"font-mono text-xs text-muted\">{row.id}</span>,\n mobileHidden: true,\n },\n {\n key: \"date\",\n header: page.columnDate,\n cell: (row) => <PublicDate value={row.created_at} renderDate={renderDate} />,\n },\n {\n key: \"category\",\n header: page.columnCategory,\n cell: (row) => <FeedbackCategoryBadge category={row.category} label={categoryLabels[row.category]} />,\n },\n {\n key: \"title\",\n header: page.columnSubject,\n cell: (row) => (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-2 large:items-start\">\n <span className=\"min-w-0 truncate-until-large font-medium\">{row.title}</span>\n <CommentCount count={row.comment_count} labels={labels} />\n </span>\n ),\n mobilePrimary: true,\n },\n {\n key: \"votes\",\n header: labels.columnVotes,\n className: \"whitespace-nowrap\",\n // The cell is a button: the row's own link must never wrap it.\n noRowLink: true,\n cell: (row) => (\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={(next) => onVote(row, next)}\n commit={commit}\n size=\"sm\"\n />\n ),\n },\n {\n key: \"status\",\n header: page.columnStatus,\n className: \"whitespace-nowrap\",\n cell: (row) => <FeedbackStatusBadge status={row.status} />,\n },\n ],\n [page, labels, categoryLabels, renderDate, onVote, commit],\n );\n\n return (\n <div className={cn(\"flex flex-col gap-3\", className)} data-feedback-public-list=\"\" aria-busy={loading || undefined}>\n <div className=\"flex flex-wrap items-center gap-2\">\n <ToggleGroup\n aria-label={labels.sort}\n value={sort}\n onChange={(value) => onSortChange(value)}\n options={SORTS.map((value) => ({\n value,\n label: value === \"newest\" ? labels.sortNewest : value === \"votes\" ? labels.sortVotes : labels.sortUpdated,\n }))}\n />\n {onSearchChange && (\n <SearchField\n aria-label={labels.search}\n placeholder={labels.search}\n value={search}\n onChange={onSearchChange}\n className=\"min-w-[12rem] flex-1 md:max-w-xs\"\n />\n )}\n {total !== undefined && (\n <span className=\"ms-auto text-sm text-muted\" data-feedback-public-total={total}>\n {labels.total(total)}\n </span>\n )}\n </div>\n <DataTable\n rows={shownRows}\n columns={columns}\n rowKey={(row) => row.id}\n rowName={(row) => row.title}\n onRowClick={(row) => setOpen(openId === row.id ? null : row.id)}\n isExpanded={(row) => row.id === openId}\n expandedRow={(row) => renderDetail(row)}\n mobileExpandAsDialog\n paginated={false}\n empty={loading ? labels.loading : labels.empty}\n mobileCard={(row) => (\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <span className=\"min-w-0 flex-1 font-medium [overflow-wrap:anywhere]\">{row.title}</span>\n <FeedbackStatusBadge status={row.status} className=\"shrink-0\" />\n </div>\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted\">\n <FeedbackCategoryBadge category={row.category} compact label={categoryLabels[row.category]} />\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <CommentCount count={row.comment_count} labels={labels} />\n {/* A count, not the button: the whole card is the row's button, and a button\n inside it is two controls in one. The vote is in the opened report. */}\n <VoteCount count={row.votes} voted={row.voted || row.mine} labels={labels} />\n </div>\n </div>\n )}\n />\n {onPageChange && (pageIndex > 0 || hasMore) && (\n <PublicPager page={pageIndex} hasMore={hasMore} onPageChange={onPageChange} labels={labels} />\n )}\n </div>\n );\n}\n\n/* ── The detail ───────────────────────────────────────────────────────────── */\n\nexport interface FeedbackPublicDetailProps {\n /** `GET /feedback/public/{id}`: the public body (attachment URLs already stripped by\n * the server, §9.4) and the replies. */\n row: FeedbackPublicRecord;\n /** `GET /feedback/{id}/comments`, oldest first; `undefined` while it loads. */\n comments: readonly FeedbackComment[] | undefined;\n /** `PUT` / `DELETE /feedback/{id}/vote`; resolve with the answer, reject to roll back. */\n onVote: (next: boolean) => Promise<FeedbackVoteState>;\n /** The viewer is the app's admin: Hide / Unhide on the comments. */\n isAdmin?: boolean;\n /** `POST /feedback/{id}/comments`. Left out — a demo, a reader who may not write — no\n * composer. */\n onComment?: (body: string) => void | Promise<unknown>;\n /** The admin's hide (`PATCH …/comments/{id} {hidden}`). */\n onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;\n /** The writer's delete (`DELETE …/comments/{id}`), after a confirm. */\n onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;\n /** A comment is being sent. */\n pending?: boolean;\n /** The vote and the thread's buttons COMMIT — see Button's `commit`. */\n commit?: CommitScope;\n /** Voting is off for this viewer (a demo): `true`, or the reason. */\n voteDisabled?: boolean | string;\n /** See {@link FeedbackRenderDate}. */\n renderDate?: FeedbackRenderDate;\n /** \"Now\" for the thread's relative times — pin it in tests and stories. */\n now?: Date | number;\n /** Over the `feedbackPublic` namespace. */\n labels?: LabelOverride<FeedbackPublicLabels>;\n /** Over the `feedbackComments` namespace, for the thread. */\n commentLabels?: LabelOverride<FeedbackCommentsLabels>;\n className?: string;\n}\n\n/**\n * One public report opened (round 0.38, docs/feedback-harmonization.md §9.3, §9.10): who\n * filed it — the first name the server sent, else **\"A user\"** (§9.5) — and when; the\n * **vote**; the **public body**; and the **conversation**, the admin's replies and other\n * people's comments merged oldest first (§9.8, `FeedbackCommentThread`), with the box to\n * add one.\n *\n * What it never draws, because the public record never carries it (§9.10): an address,\n * a last name, a screenshot, a file, the page the report was filed on. The body is the\n * server's `public_body` — the client strips nothing and adds nothing.\n */\nexport function FeedbackPublicDetail({\n row,\n comments,\n onVote,\n isAdmin = false,\n onComment,\n onHide,\n onDelete,\n pending,\n commit,\n voteDisabled,\n renderDate: renderDateProp,\n now,\n labels: labelsProp,\n commentLabels,\n className,\n}: FeedbackPublicDetailProps) {\n const labels = useFeedbackPublicLabels(labelsProp);\n const renderDate = useFeedbackRenderDate(renderDateProp);\n return (\n <FeedbackDetail className={className}>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2\" data-feedback-public-detail={row.id}>\n <span className=\"text-sm text-secondary\" data-feedback-author=\"\">\n {labels.filedBy(row.author_name ?? labels.anonymous)}\n </span>\n <PublicDate value={row.created_at} renderDate={renderDate} />\n <FeedbackVoteButton\n votes={row.votes}\n voted={row.voted}\n own={row.mine}\n onVote={onVote}\n disabled={voteDisabled}\n commit={commit}\n className=\"ms-auto\"\n />\n </div>\n <FeedbackDetailSection title={labels.body}>\n {/* Rework rounds stay in it — the author's own words (§9.4). */}\n <FeedbackProse>{row.body}</FeedbackProse>\n </FeedbackDetailSection>\n <FeedbackDetailSection title={labels.conversation}>\n <FeedbackCommentThread\n replies={row.replies}\n comments={comments ?? []}\n loading={comments === undefined}\n isAdmin={isAdmin}\n onComment={onComment}\n onHide={onHide}\n onDelete={onDelete}\n pending={pending}\n commit={commit}\n now={now}\n labels={commentLabels}\n />\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AA4CqB,cAajB,YAbiB;AA5CrB,SAAS,SAAS,gBAAgB;AAElC,SAAS,aAAa,cAAc,eAAe,gBAAgB;AACnE,SAAS,iBAAuC;AAChD,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAE5B,SAAS,oBAAwC;AACjD,SAAS,UAAU;AACnB,SAAS,6BAA6B;AACtC,SAAS,uBAAuB,gBAAgB,uBAAuB,eAAe,2BAA2B;AACjH,SAAS,iCAAiC;AAC1C,SAAS,6BAA0D;AACnE,SAAS,sCAAiE;AAQ1E;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,0BAA0B;AAM5B,SAAS,wBAAwB,QAAoE;AAC1G,SAAO,aAAa,kBAAkB,gCAAgC,MAAM;AAC9E;AAGA,MAAM,QAAuC,CAAC,UAAU,SAAS,SAAS;AAG1E,SAAS,WAAW,EAAE,OAAO,WAAW,GAAyE;AAC/G,MAAI,CAAC,MAAO,QAAO,oBAAC,UAAK,WAAU,oBAAoB,iCAAsB;AAC7E,SACE,oBAAC,UAAK,UAAU,OAAO,WAAU,6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AAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,51 @@
1
+ import type { CommitScope } from "../components/write-lock.js";
2
+ import { type LabelOverride } from "../i18n/kit-labels.js";
3
+ import { type FeedbackRecord } from "./feedback-record.js";
4
+ import { type FeedbackPublicLabels } from "./feedback-public-labels.js";
5
+ /** What the switch reads off a report: {@link FeedbackRecord}'s fields (§9.3). */
6
+ export type FeedbackPublicSwitchRow = Pick<FeedbackRecord, "user_id" | "category" | "status" | "public" | "filed_private" | "mine">;
7
+ /** Who is looking: the app's admin check, and the signed-in user's id. */
8
+ export interface FeedbackPublicSwitchViewer {
9
+ isAdmin: boolean;
10
+ viewerId?: number | null;
11
+ }
12
+ /**
13
+ * Whether the viewer may flip a report's `public` flag — the server's rule (§9.3), so the
14
+ * switch never offers what the `PATCH {public}` would refuse with a 403:
15
+ *
16
+ * - never on a CRASH (decision 9: a crash is private whatever its flag);
17
+ * - an admin, at any status;
18
+ * - the author while the status is OPEN, READY or IN_PROGRESS
19
+ * (`FEEDBACK_AUTHOR_EDITABLE_STATUSES`), and on a `filed_private` report — one the
20
+ * 0.38 migration made public — at any status: that is the opt-out the notice offers.
21
+ */
22
+ export declare function feedbackPublicSwitchAllowed(row: FeedbackPublicSwitchRow, { isAdmin, viewerId }: FeedbackPublicSwitchViewer): boolean;
23
+ export interface FeedbackPublicSwitchProps extends FeedbackPublicSwitchViewer {
24
+ row: FeedbackPublicSwitchRow;
25
+ /** `PATCH /feedback/{id} {"public": next}` — the app's mutation. */
26
+ onChange: (next: boolean) => void;
27
+ /** The PATCH is in flight: the switch holds still. */
28
+ pending?: boolean;
29
+ /** Flipping it SAVES: pass `true` to put it under the page's `WriteLockProvider`
30
+ * (Switch's `commit`). Off by default, as on the inbox's status buttons. */
31
+ commit?: CommitScope;
32
+ /** Over the `feedbackPublic` namespace (`visibleToOthers`, `visibleHint`,
33
+ * `visibleLocked`). */
34
+ labels?: LabelOverride<FeedbackPublicLabels>;
35
+ className?: string;
36
+ }
37
+ /**
38
+ * **Visible to others** — a report's `public` flag (round 0.38, docs/feedback-harmonization.md
39
+ * §9.3, decision 6), for the row detail (`FeedbackRowDetail`'s `onPublicChange`) or an
40
+ * app's own page.
41
+ *
42
+ * - Drawn for the admin and the author only: nobody else is sent `public` (§9.10). Not
43
+ * drawn on a CRASH, and not when the row carries no `public` at all (a server before
44
+ * 0.38, or an app without public parts — kastlan).
45
+ * - The author past the open window sees it **locked with the reason** ("Only while the
46
+ * report is open"), focusable, so the reason reaches a keyboard; a `filed_private`
47
+ * report is never locked for its author ({@link feedbackPublicSwitchAllowed}).
48
+ * - The line under it says what "visible" means: the title and the text, never the
49
+ * screenshots or files (decision 1).
50
+ */
51
+ export declare function FeedbackPublicSwitch({ row, isAdmin, viewerId, onChange, pending, commit, labels: labelsProp, className, }: FeedbackPublicSwitchProps): import("react").JSX.Element | null;
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Switch } from "../components/switch.js";
4
+ import { useKitLabels } from "../i18n/kit-labels.js";
5
+ import { FEEDBACK_AUTHOR_EDITABLE_STATUSES } from "./feedback-record.js";
6
+ import { DEFAULT_FEEDBACK_PUBLIC_LABELS } from "./feedback-public-labels.js";
7
+ function isAuthorOf(row, viewerId) {
8
+ if (row.mine != null) return row.mine;
9
+ return row.user_id !== null && viewerId !== void 0 && viewerId !== null && row.user_id === viewerId;
10
+ }
11
+ function feedbackPublicSwitchAllowed(row, { isAdmin, viewerId }) {
12
+ if (row.category === "CRASH") return false;
13
+ if (isAdmin) return true;
14
+ if (!isAuthorOf(row, viewerId)) return false;
15
+ return row.filed_private === true || FEEDBACK_AUTHOR_EDITABLE_STATUSES.includes(row.status);
16
+ }
17
+ function FeedbackPublicSwitch({
18
+ row,
19
+ isAdmin,
20
+ viewerId,
21
+ onChange,
22
+ pending = false,
23
+ commit,
24
+ labels: labelsProp,
25
+ className
26
+ }) {
27
+ const labels = useKitLabels("feedbackPublic", DEFAULT_FEEDBACK_PUBLIC_LABELS, labelsProp);
28
+ if (row.category === "CRASH" || row.public == null) return null;
29
+ if (!isAdmin && !isAuthorOf(row, viewerId)) return null;
30
+ const allowed = feedbackPublicSwitchAllowed(row, { isAdmin, viewerId });
31
+ return /* @__PURE__ */ jsx(
32
+ Switch,
33
+ {
34
+ className,
35
+ label: labels.visibleToOthers,
36
+ description: labels.visibleHint,
37
+ checked: row.public === true,
38
+ disabled: pending,
39
+ disabledReason: allowed ? void 0 : labels.visibleLocked,
40
+ commit,
41
+ onCheckedChange: (next) => onChange(next),
42
+ "data-feedback-public": row.public ? "on" : "off"
43
+ }
44
+ );
45
+ }
46
+ export {
47
+ FeedbackPublicSwitch,
48
+ feedbackPublicSwitchAllowed
49
+ };
50
+ //# sourceMappingURL=feedback-public-switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/feedback/feedback-public-switch.tsx"],"sourcesContent":["import { Switch } from \"../components/switch\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { FEEDBACK_AUTHOR_EDITABLE_STATUSES, type FeedbackRecord } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from \"./feedback-public-labels\";\n\n/** What the switch reads off a report: {@link FeedbackRecord}'s fields (§9.3). */\nexport type FeedbackPublicSwitchRow = Pick<\n FeedbackRecord,\n \"user_id\" | \"category\" | \"status\" | \"public\" | \"filed_private\" | \"mine\"\n>;\n\n/** Who is looking: the app's admin check, and the signed-in user's id. */\nexport interface FeedbackPublicSwitchViewer {\n isAdmin: boolean;\n viewerId?: number | null;\n}\n\n/** The viewer filed the row — `mine` when the server sent it, else the ids (never for an\n * erased author, `user_id: null`). */\nfunction isAuthorOf(row: FeedbackPublicSwitchRow, viewerId: number | null | undefined): boolean {\n if (row.mine != null) return row.mine;\n return row.user_id !== null && viewerId !== undefined && viewerId !== null && row.user_id === viewerId;\n}\n\n/**\n * Whether the viewer may flip a report's `public` flag — the server's rule (§9.3), so the\n * switch never offers what the `PATCH {public}` would refuse with a 403:\n *\n * - never on a CRASH (decision 9: a crash is private whatever its flag);\n * - an admin, at any status;\n * - the author while the status is OPEN, READY or IN_PROGRESS\n * (`FEEDBACK_AUTHOR_EDITABLE_STATUSES`), and on a `filed_private` report — one the\n * 0.38 migration made public — at any status: that is the opt-out the notice offers.\n */\nexport function feedbackPublicSwitchAllowed(\n row: FeedbackPublicSwitchRow,\n { isAdmin, viewerId }: FeedbackPublicSwitchViewer,\n): boolean {\n if (row.category === \"CRASH\") return false;\n if (isAdmin) return true;\n if (!isAuthorOf(row, viewerId)) return false;\n return row.filed_private === true || FEEDBACK_AUTHOR_EDITABLE_STATUSES.includes(row.status);\n}\n\nexport interface FeedbackPublicSwitchProps extends FeedbackPublicSwitchViewer {\n row: FeedbackPublicSwitchRow;\n /** `PATCH /feedback/{id} {\"public\": next}` — the app's mutation. */\n onChange: (next: boolean) => void;\n /** The PATCH is in flight: the switch holds still. */\n pending?: boolean;\n /** Flipping it SAVES: pass `true` to put it under the page's `WriteLockProvider`\n * (Switch's `commit`). Off by default, as on the inbox's status buttons. */\n commit?: CommitScope;\n /** Over the `feedbackPublic` namespace (`visibleToOthers`, `visibleHint`,\n * `visibleLocked`). */\n labels?: LabelOverride<FeedbackPublicLabels>;\n className?: string;\n}\n\n/**\n * **Visible to others** — a report's `public` flag (round 0.38, docs/feedback-harmonization.md\n * §9.3, decision 6), for the row detail (`FeedbackRowDetail`'s `onPublicChange`) or an\n * app's own page.\n *\n * - Drawn for the admin and the author only: nobody else is sent `public` (§9.10). Not\n * drawn on a CRASH, and not when the row carries no `public` at all (a server before\n * 0.38, or an app without public parts — kastlan).\n * - The author past the open window sees it **locked with the reason** (\"Only while the\n * report is open\"), focusable, so the reason reaches a keyboard; a `filed_private`\n * report is never locked for its author ({@link feedbackPublicSwitchAllowed}).\n * - The line under it says what \"visible\" means: the title and the text, never the\n * screenshots or files (decision 1).\n */\nexport function FeedbackPublicSwitch({\n row,\n isAdmin,\n viewerId,\n onChange,\n pending = false,\n commit,\n labels: labelsProp,\n className,\n}: FeedbackPublicSwitchProps) {\n const labels = useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS, labelsProp);\n if (row.category === \"CRASH\" || row.public == null) return null;\n if (!isAdmin && !isAuthorOf(row, viewerId)) return null;\n const allowed = feedbackPublicSwitchAllowed(row, { isAdmin, viewerId });\n return (\n <Switch\n className={className}\n label={labels.visibleToOthers}\n description={labels.visibleHint}\n checked={row.public === true}\n disabled={pending}\n disabledReason={allowed ? undefined : labels.visibleLocked}\n commit={commit}\n onCheckedChange={(next) => onChange(next)}\n data-feedback-public={row.public ? \"on\" : \"off\"}\n />\n );\n}\n"],"mappings":";AAyFI;AAzFJ,SAAS,cAAc;AAEvB,SAAS,oBAAwC;AACjD,SAAS,yCAA8D;AACvE,SAAS,sCAAiE;AAgB1E,SAAS,WAAW,KAA8B,UAA8C;AAC9F,MAAI,IAAI,QAAQ,KAAM,QAAO,IAAI;AACjC,SAAO,IAAI,YAAY,QAAQ,aAAa,UAAa,aAAa,QAAQ,IAAI,YAAY;AAChG;AAYO,SAAS,4BACd,KACA,EAAE,SAAS,SAAS,GACX;AACT,MAAI,IAAI,aAAa,QAAS,QAAO;AACrC,MAAI,QAAS,QAAO;AACpB,MAAI,CAAC,WAAW,KAAK,QAAQ,EAAG,QAAO;AACvC,SAAO,IAAI,kBAAkB,QAAQ,kCAAkC,SAAS,IAAI,MAAM;AAC5F;AA+BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAA8B;AAC5B,QAAM,SAAS,aAAa,kBAAkB,gCAAgC,UAAU;AACxF,MAAI,IAAI,aAAa,WAAW,IAAI,UAAU,KAAM,QAAO;AAC3D,MAAI,CAAC,WAAW,CAAC,WAAW,KAAK,QAAQ,EAAG,QAAO;AACnD,QAAM,UAAU,4BAA4B,KAAK,EAAE,SAAS,SAAS,CAAC;AACtE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,OAAO;AAAA,MACd,aAAa,OAAO;AAAA,MACpB,SAAS,IAAI,WAAW;AAAA,MACxB,UAAU;AAAA,MACV,gBAAgB,UAAU,SAAY,OAAO;AAAA,MAC7C;AAAA,MACA,iBAAiB,CAAC,SAAS,SAAS,IAAI;AAAA,MACxC,wBAAsB,IAAI,SAAS,OAAO;AAAA;AAAA,EAC5C;AAEJ;","names":[]}
@@ -0,0 +1,75 @@
1
+ import type { FeedbackCategory, FeedbackStatus } from "./feedback-vocabulary.js";
2
+ /**
3
+ * The shapes of round 0.38's public feedback (docs/feedback-harmonization.md §9): the
4
+ * admin's replies as a list (§9.7), other people's comments as rows (§9.8), the upvote
5
+ * (§9.6) and the two public views of a report (§9.3). Types only: what the server
6
+ * answers, as the three apps' clients receive it.
7
+ *
8
+ * A name is always the server's (§9.5): `author_name` is a first name for others, the
9
+ * full name for an admin, and `null` when there is none to show (an erased or incomplete
10
+ * account, a loop's reply). The client never builds one from an id.
11
+ */
12
+ /** One answer of the admin's — `FeedbackReplyResponse`, §9.7. Oldest first. */
13
+ export interface FeedbackReply {
14
+ id: number;
15
+ /** `null`: a loop's reply, a migrated `outcome`, or an erased admin — drawn as the
16
+ * app's word for its admin ("Admin"). */
17
+ author_name: string | null;
18
+ body: string;
19
+ /** The status this reply moved the report to; `null` = no status change. */
20
+ status_to: FeedbackStatus | null;
21
+ /** Where it moved from — the admin view only. */
22
+ status_from?: FeedbackStatus | null;
23
+ /** ISO 8601. */
24
+ created_at: string;
25
+ }
26
+ /** One comment by someone who reads the report — `FeedbackCommentResponse`, §9.8. */
27
+ export interface FeedbackComment {
28
+ id: number;
29
+ /** First name for others, the full name for an admin; `null` → "A user". */
30
+ author_name: string | null;
31
+ /** The viewer wrote it (they may delete it). */
32
+ mine: boolean;
33
+ /** keksdose's migrated rows whose writer was an admin (K2): drawn as a staff post. */
34
+ staff: boolean;
35
+ /** `null` when hidden, but for its writer and an admin. */
36
+ body: string | null;
37
+ hidden: boolean;
38
+ /** ISO 8601. */
39
+ created_at: string;
40
+ }
41
+ /** What `PUT` / `DELETE /feedback/{id}/vote` answer — `FeedbackVoteResponse`, §9.6. */
42
+ export interface FeedbackVoteState {
43
+ votes: number;
44
+ voted: boolean;
45
+ }
46
+ /** The public list's server-side sort (§9.6): newest first (default), most votes (then
47
+ * newest), or most recently updated. */
48
+ export type FeedbackPublicSort = "newest" | "votes" | "updated";
49
+ /** One row of `GET /feedback/public` — `FeedbackPublicListItem`, §9.3, §9.9: titles
50
+ * only, no body, no files, no account. */
51
+ export interface FeedbackPublicListItem extends FeedbackVoteState {
52
+ id: number;
53
+ title: string;
54
+ category: FeedbackCategory;
55
+ status: FeedbackStatus;
56
+ /** First name, or `null` → "A user". */
57
+ author_name: string | null;
58
+ /** The viewer filed it. */
59
+ mine: boolean;
60
+ /** Visible comments. */
61
+ comment_count: number;
62
+ /** ISO 8601. */
63
+ created_at: string;
64
+ /** ISO 8601. */
65
+ updated_at: string;
66
+ /** ISO 8601, or `null`. */
67
+ resolved_at: string | null;
68
+ }
69
+ /** `GET /feedback/public/{id}` — `FeedbackPublicResponse`, §9.3: the list row plus the
70
+ * public body (every attachment URL stripped by the server, §9.4) and the replies. The
71
+ * comments are fetched beside it (`GET /feedback/{id}/comments`). */
72
+ export interface FeedbackPublicRecord extends FeedbackPublicListItem {
73
+ body: string;
74
+ replies: FeedbackReply[];
75
+ }
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ //# sourceMappingURL=feedback-public-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,5 @@
1
1
  import type { FeedbackCategory, FeedbackStatus } from "./feedback-vocabulary.js";
2
+ import type { FeedbackReply } from "./feedback-public-types.js";
2
3
  /**
3
4
  * One feedback report as the three apps send it, and the facts the kit reads off it.
4
5
  *
@@ -94,7 +95,9 @@ export interface FeedbackRecord {
94
95
  /** Up to 5 other files; `null` = none. Optional because a server older than the
95
96
  * column sends no key at all (keksdose dev #578 met exactly that). */
96
97
  attachment_urls?: string[] | null;
97
- /** The team's answer; `null` = none written. */
98
+ /** The team's answer; `null` = none written. **Frozen since 0.38** (§9.7): answered
99
+ * as stored for one release, written by nothing, then dropped — the answer is
100
+ * {@link FeedbackRecord.replies} now. */
98
101
  outcome: string | null;
99
102
  /** Set on ENTERING `DONE` / `WONT_DO`, cleared on leaving them. ISO 8601. */
100
103
  resolved_at: string | null;
@@ -102,6 +105,23 @@ export interface FeedbackRecord {
102
105
  created_at: string;
103
106
  /** ISO 8601. */
104
107
  updated_at: string;
108
+ /** The admin: the full name; the author: their own; `null`: none to show. */
109
+ author_name?: string | null;
110
+ /** The viewer filed it. */
111
+ mine?: boolean | null;
112
+ /** Visible to the app's other users (§9.3); never on a CRASH. */
113
+ public?: boolean | null;
114
+ /** Made public by the 0.38 migration: the author may switch it off at any status. */
115
+ filed_private?: boolean | null;
116
+ /** People who want this (the author's own vote included, §9.6). */
117
+ votes?: number | null;
118
+ /** The viewer's vote. */
119
+ voted?: boolean | null;
120
+ /** Comments (an admin's count includes hidden ones). */
121
+ comment_count?: number | null;
122
+ /** The admin's answers, oldest first (§9.7). Absent: a server before 0.38 — read
123
+ * `outcome` instead. */
124
+ replies?: FeedbackReply[] | null;
105
125
  }
106
126
  /** The image types `FeedbackAttachmentField` takes when `accept` is not given. */
107
127
  export declare const DEFAULT_ATTACHMENT_ACCEPT: string[];
@@ -152,6 +172,17 @@ export declare const FEEDBACK_AUTHOR_EDITABLE_STATUSES: readonly FeedbackStatus[
152
172
  * you" toggle narrows the inbox to exactly these (§4.3).
153
173
  */
154
174
  export declare const FEEDBACK_AWAITING_STATUSES: readonly FeedbackStatus[];
175
+ /**
176
+ * The **decided** statuses (§9.7, decision 13): `DONE`, `WONT_DO`, `POSTPONED`. A
177
+ * status-only move into one tells the author nothing (a status alone sends no
178
+ * notification), so the row detail nudges the admin toward a reply until one with that
179
+ * `status_to` exists.
180
+ */
181
+ export declare const FEEDBACK_DECIDED_STATUSES: readonly FeedbackStatus[];
182
+ /** A comment's longest body after trimming (§9.8). */
183
+ export declare const FEEDBACK_COMMENT_MAX = 4000;
184
+ /** A reply's longest body after trimming (§9.7). */
185
+ export declare const FEEDBACK_REPLY_MAX = 8000;
155
186
  /** The body line for one uploaded attachment — what {@link appendRework} writes under
156
187
  * the note. */
157
188
  export declare function feedbackAttachmentLine(url: string): string;
@@ -28,6 +28,13 @@ const FEEDBACK_AWAITING_STATUSES = Object.freeze([
28
28
  "IN_EVALUATION",
29
29
  "NEEDS_LIVE_TEST"
30
30
  ]);
31
+ const FEEDBACK_DECIDED_STATUSES = Object.freeze([
32
+ "DONE",
33
+ "WONT_DO",
34
+ "POSTPONED"
35
+ ]);
36
+ const FEEDBACK_COMMENT_MAX = 4e3;
37
+ const FEEDBACK_REPLY_MAX = 8e3;
31
38
  const ATTACHMENT_URL = /^\/api\/v1\/feedback\/attachments\/[\w.-]+$/;
32
39
  const ATTACHMENT_LINE = /^\[screenshot\]\s+(\/api\/v1\/feedback\/attachments\/[\w.-]+)\s*$/;
33
40
  const REWORK_RULE = /^---\s*REWORK\b.*---$/;
@@ -97,7 +104,10 @@ export {
97
104
  FEEDBACK_ATTACHMENT_ACCEPT,
98
105
  FEEDBACK_AUTHOR_EDITABLE_STATUSES,
99
106
  FEEDBACK_AWAITING_STATUSES,
107
+ FEEDBACK_COMMENT_MAX,
108
+ FEEDBACK_DECIDED_STATUSES,
100
109
  FEEDBACK_PICKABLE_CATEGORIES,
110
+ FEEDBACK_REPLY_MAX,
101
111
  FEEDBACK_REWORKABLE_STATUSES,
102
112
  appendRework,
103
113
  attachmentName,