@eifi1/ui-kit 0.37.0 → 0.38.0

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 (122) 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 +80 -0
  4. package/dist/feedback/feedback-comment-thread.js +162 -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-menu-labels.js +2 -1
  12. package/dist/feedback/feedback-menu-labels.js.map +1 -1
  13. package/dist/feedback/feedback-menu.d.ts +17 -3
  14. package/dist/feedback/feedback-menu.js +11 -1
  15. package/dist/feedback/feedback-menu.js.map +1 -1
  16. package/dist/feedback/feedback-public-labels.d.ts +50 -0
  17. package/dist/feedback/feedback-public-labels.js +26 -0
  18. package/dist/feedback/feedback-public-labels.js.map +1 -0
  19. package/dist/feedback/feedback-public-list.d.ts +118 -0
  20. package/dist/feedback/feedback-public-list.js +248 -0
  21. package/dist/feedback/feedback-public-list.js.map +1 -0
  22. package/dist/feedback/feedback-public-switch.d.ts +51 -0
  23. package/dist/feedback/feedback-public-switch.js +50 -0
  24. package/dist/feedback/feedback-public-switch.js.map +1 -0
  25. package/dist/feedback/feedback-public-types.d.ts +75 -0
  26. package/dist/feedback/feedback-public-types.js +2 -0
  27. package/dist/feedback/feedback-public-types.js.map +1 -0
  28. package/dist/feedback/feedback-record.d.ts +32 -1
  29. package/dist/feedback/feedback-record.js +10 -0
  30. package/dist/feedback/feedback-record.js.map +1 -1
  31. package/dist/feedback/feedback-replies.d.ts +97 -0
  32. package/dist/feedback/feedback-replies.js +114 -0
  33. package/dist/feedback/feedback-replies.js.map +1 -0
  34. package/dist/feedback/feedback-row-detail-labels.js +1 -0
  35. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  36. package/dist/feedback/feedback-row-detail.d.ts +38 -10
  37. package/dist/feedback/feedback-row-detail.js +50 -50
  38. package/dist/feedback/feedback-row-detail.js.map +1 -1
  39. package/dist/feedback/feedback-submit-dialog.d.ts +3 -1
  40. package/dist/feedback/feedback-submit-dialog.js +6 -1
  41. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  42. package/dist/feedback/feedback-submit.d.ts +8 -0
  43. package/dist/feedback/feedback-submit.js +3 -2
  44. package/dist/feedback/feedback-submit.js.map +1 -1
  45. package/dist/feedback/feedback-table.d.ts +15 -5
  46. package/dist/feedback/feedback-table.js +46 -5
  47. package/dist/feedback/feedback-table.js.map +1 -1
  48. package/dist/feedback/feedback-thread-parts-labels.d.ts +6 -0
  49. package/dist/feedback/feedback-thread-parts-labels.js +36 -0
  50. package/dist/feedback/feedback-thread-parts-labels.js.map +1 -0
  51. package/dist/feedback/feedback-thread.d.ts +8 -0
  52. package/dist/feedback/feedback-thread.js +7 -2
  53. package/dist/feedback/feedback-thread.js.map +1 -1
  54. package/dist/feedback/feedback-vote-button.d.ts +48 -0
  55. package/dist/feedback/feedback-vote-button.js +72 -0
  56. package/dist/feedback/feedback-vote-button.js.map +1 -0
  57. package/dist/feedback.d.ts +6 -0
  58. package/dist/feedback.js +6 -0
  59. package/dist/feedback.js.map +1 -1
  60. package/dist/i18n/defaults.js +12 -0
  61. package/dist/i18n/defaults.js.map +1 -1
  62. package/dist/i18n/german.js +64 -2
  63. package/dist/i18n/german.js.map +1 -1
  64. package/dist/i18n/kit-labels.d.ts +16 -0
  65. package/dist/i18n/kit-labels.js.map +1 -1
  66. package/dist/i18n/locales/en.js +79 -2
  67. package/dist/i18n/locales/en.js.map +3 -3
  68. package/dist/i18n/locales/es.js +64 -2
  69. package/dist/i18n/locales/es.js.map +1 -1
  70. package/dist/i18n/locales/fr.js +64 -2
  71. package/dist/i18n/locales/fr.js.map +1 -1
  72. package/dist/i18n/locales/hu.js +64 -2
  73. package/dist/i18n/locales/hu.js.map +1 -1
  74. package/dist/i18n/locales/it.js +64 -2
  75. package/dist/i18n/locales/it.js.map +1 -1
  76. package/dist/i18n/locales/zh.js +64 -2
  77. package/dist/i18n/locales/zh.js.map +1 -1
  78. package/dist/i18n/review.js +4 -0
  79. package/dist/i18n/review.js.map +1 -1
  80. package/dist/index.d.ts +2 -0
  81. package/dist/index.js +6 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/notifications/feedback-notification-types-labels.d.ts +15 -0
  84. package/dist/notifications/feedback-notification-types-labels.js +11 -0
  85. package/dist/notifications/feedback-notification-types-labels.js.map +1 -0
  86. package/dist/notifications/feedback-notification-types.d.ts +28 -0
  87. package/dist/notifications/feedback-notification-types.js +21 -0
  88. package/dist/notifications/feedback-notification-types.js.map +1 -0
  89. package/package.json +1 -1
  90. package/src/feedback/feedback-comment-thread.tsx +255 -0
  91. package/src/feedback/feedback-dialog-labels.ts +1 -0
  92. package/src/feedback/feedback-dialog.tsx +30 -2
  93. package/src/feedback/feedback-menu-labels.ts +1 -0
  94. package/src/feedback/feedback-menu.tsx +29 -3
  95. package/src/feedback/feedback-public-labels.ts +76 -0
  96. package/src/feedback/feedback-public-list.tsx +395 -0
  97. package/src/feedback/feedback-public-switch.tsx +102 -0
  98. package/src/feedback/feedback-public-types.ts +82 -0
  99. package/src/feedback/feedback-record.ts +39 -1
  100. package/src/feedback/feedback-replies.tsx +235 -0
  101. package/src/feedback/feedback-row-detail-labels.ts +1 -0
  102. package/src/feedback/feedback-row-detail.tsx +103 -74
  103. package/src/feedback/feedback-submit-dialog.tsx +9 -0
  104. package/src/feedback/feedback-submit.tsx +10 -1
  105. package/src/feedback/feedback-table.tsx +73 -6
  106. package/src/feedback/feedback-thread-parts-labels.ts +41 -0
  107. package/src/feedback/feedback-thread.tsx +18 -1
  108. package/src/feedback/feedback-vote-button.tsx +122 -0
  109. package/src/feedback.ts +10 -0
  110. package/src/i18n/defaults.ts +12 -0
  111. package/src/i18n/german.ts +62 -0
  112. package/src/i18n/kit-labels.tsx +16 -0
  113. package/src/i18n/locales/en.ts +7 -0
  114. package/src/i18n/locales/es.ts +62 -0
  115. package/src/i18n/locales/fr.ts +62 -0
  116. package/src/i18n/locales/hu.ts +62 -0
  117. package/src/i18n/locales/it.ts +62 -0
  118. package/src/i18n/locales/zh.ts +62 -0
  119. package/src/i18n/review.ts +4 -0
  120. package/src/index.ts +9 -0
  121. package/src/notifications/feedback-notification-types-labels.ts +24 -0
  122. package/src/notifications/feedback-notification-types.ts +46 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/notifications/feedback-notification-types.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport type { NotificationTypeEntry } from \"./notification-types\";\nimport {\n DEFAULT_FEEDBACK_NOTIFICATION_TYPES_LABELS,\n type FeedbackNotificationTypesLabels,\n} from \"./feedback-notification-types-labels\";\n\nexport { DEFAULT_FEEDBACK_NOTIFICATION_TYPES_LABELS };\nexport type { FeedbackNotificationTypesLabels };\n\n/** The two feedback notification ids (§9.11), as server-kit's `FEEDBACK_ANSWERED` and\n * `FEEDBACK_COMMENT` name them. */\nexport type FeedbackNotificationTypeId = \"feedback_answered\" | \"feedback_comment\";\n\n/**\n * The setting words of the two feedback notification types (round 0.38,\n * docs/feedback-harmonization.md §9.11), for `NotificationTypesSetting`'s `types`:\n *\n * ```tsx\n * const feedbackTypes = useFeedbackNotificationTypes();\n * <NotificationTypesSetting types={[...appTypes, ...feedbackTypes]} … />\n * ```\n *\n * - **\"Answers to your reports\"** (`feedback_answered`): a reply from the admin or a\n * loop, to the author and every earlier commenter.\n * - **\"Comments on reports you follow\"** (`feedback_comment`): a visible comment, to the\n * author and the earlier commenters.\n *\n * Both entries are always returned: the card draws a type only when the server answered\n * it (notifications §2.1), so kastlan, which does not declare `feedback_comment` while its\n * public parts are off, shows the first alone. Words: `<UiKitProvider labels={{\n * feedbackNotificationTypes }}>` over English, `labels` over both.\n */\nexport function useFeedbackNotificationTypes(\n labels?: LabelOverride<FeedbackNotificationTypesLabels>,\n): NotificationTypeEntry<FeedbackNotificationTypeId>[] {\n const words = useKitLabels(\"feedbackNotificationTypes\", DEFAULT_FEEDBACK_NOTIFICATION_TYPES_LABELS, labels);\n return useMemo(\n () => [\n { id: \"feedback_answered\", label: words.answered, description: words.answeredDescription },\n { id: \"feedback_comment\", label: words.comment, description: words.commentDescription },\n ],\n [words],\n );\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,oBAAwC;AAEjD;AAAA,EACE;AAAA,OAEK;AA4BA,SAAS,6BACd,QACqD;AACrD,QAAM,QAAQ,aAAa,6BAA6B,4CAA4C,MAAM;AAC1G,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,EAAE,IAAI,qBAAqB,OAAO,MAAM,UAAU,aAAa,MAAM,oBAAoB;AAAA,MACzF,EAAE,IAAI,oBAAoB,OAAO,MAAM,SAAS,aAAa,MAAM,mBAAmB;AAAA,IACxF;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eifi1/ui-kit",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "description": "App-agnostic shared design system: domain-free React components, theme and tokens.",
6
6
  "_sideEffects": "The barrel (src/index.ts) re-exports EVERY component, including components/chart, which statically imports recharts. Without this field a bundler must assume each of those modules has side effects, so it cannot drop the unused ones: importing a Button from '@eifi1/ui-kit' dragged all 433KB of recharts into the consumer's ENTRY chunk, and Keksdose was preloading it on every page load, login included. Nothing in src/ imports for side effects (no bare imports, no CSS imports from JS, no module-level global writes) — the token stylesheet is its own './tokens.css' export — so this is safe. CSS is still listed so any future stylesheet survives. Re-checked when `flag-icons` left `dependencies` and tsup started emitting a `\"use client\"` banner: neither touches this. The flag stylesheet was never imported from JS in the first place (that was the finding), and a directive prologue is a string literal every bundler lifts out before it decides whether a module is inert.",
@@ -0,0 +1,255 @@
1
+ import type { ReactNode } from "react";
2
+ import { EyeOff } from "lucide-react";
3
+ import { Button } from "../components/button";
4
+ import { useConfirm } from "../components/confirm-dialog";
5
+ import type { CommitScope } from "../components/write-lock";
6
+ import { useKitLabels, type LabelOverride } from "../i18n/kit-labels";
7
+ import { FeedbackStatusBadge } from "./feedback-inbox";
8
+ import type { FeedbackComment, FeedbackReply } from "./feedback-public-types";
9
+ import { DEFAULT_FEEDBACK_PUBLIC_LABELS } from "./feedback-public-labels";
10
+ import { FEEDBACK_COMMENT_MAX } from "./feedback-record";
11
+ import { useFeedbackRepliesLabels } from "./feedback-replies";
12
+ import { ChatComposer, FeedbackThread } from "./feedback-thread";
13
+ import type { FeedbackThreadMessage } from "./feedback-thread";
14
+ import { DEFAULT_FEEDBACK_COMMENTS_LABELS } from "./feedback-thread-parts-labels";
15
+
16
+ /**
17
+ * A report's conversation as everyone who may read it sees it
18
+ * (docs/feedback-harmonization.md §9.8): the admin's replies and other people's
19
+ * comments, each its own row, oldest first — merged by time, on the
20
+ * {@link FeedbackThread} look — and the box to add one.
21
+ *
22
+ * - **Replies** are drawn as staff posts with the status they set ("→ Done"); a reply
23
+ * without an author is "Admin" (§9.7).
24
+ * - **Comments**: the viewer's own at the reading end ("You"); someone else's under the
25
+ * first name the server sent, `null` as "A user" (§9.5, `feedbackPublic.anonymous`).
26
+ * - **Hidden** (§9.8): others see "Hidden by an admin" and no name, no text; the writer
27
+ * sees their text with that line; the admin sees it struck through, with **Unhide**.
28
+ * An admin has **Hide** on every visible comment; the writer **Delete** on their own,
29
+ * after a confirm (it is a hard delete). Nobody edits a comment.
30
+ * - **The composer** (1–4 000 characters, no files) only with `onComment`: left out for
31
+ * a reader who may not write (a demo, a CRASH report — the app knows).
32
+ *
33
+ * Delete asks through `useConfirm`, so a thread with `onDelete` and a comment of the
34
+ * viewer's needs the app's `ConfirmProvider` (each app mounts one already).
35
+ */
36
+
37
+ /* ── Labels ───────────────────────────────────────────────────────────────── */
38
+
39
+ /** The `feedbackComments` namespace of `<UiKitProvider labels>`. A `null` name is
40
+ * `feedbackPublic.anonymous`, the public pages' word, so the two say the same. */
41
+ export interface FeedbackCommentsLabels {
42
+ /** The thread's accessible name. de-CH: "Kommentare" */
43
+ comments: string;
44
+ /** Nothing yet. de-CH: "Noch keine Kommentare" */
45
+ empty: string;
46
+ /** In place of a hidden comment. de-CH: "Von einem Admin ausgeblendet" */
47
+ hidden: string;
48
+ /** The admin's button. de-CH: "Ausblenden" */
49
+ hide: string;
50
+ /** The admin's button on a hidden comment. de-CH: "Einblenden" */
51
+ unhide: string;
52
+ /** The writer's button. de-CH: "Löschen" */
53
+ delete: string;
54
+ /** The confirm's question. de-CH: "Diesen Kommentar löschen?" */
55
+ deleteTitle: string;
56
+ /** The confirm's line. de-CH: "Er wird für alle entfernt. Das kann nicht rückgängig
57
+ * gemacht werden." */
58
+ deleteBody: string;
59
+ /** The box's accessible name. de-CH: "Kommentar schreiben" */
60
+ field: string;
61
+ /** de-CH: "Kommentar schreiben…" */
62
+ placeholder: string;
63
+ /** The send button. de-CH: "Kommentieren" */
64
+ send: string;
65
+ }
66
+
67
+ export { DEFAULT_FEEDBACK_COMMENTS_LABELS };
68
+
69
+ /* ── The thread ───────────────────────────────────────────────────────────── */
70
+
71
+ export interface FeedbackCommentThreadProps {
72
+ /** The report's replies (§9.7), oldest first. `[]` when it has none. */
73
+ replies: readonly FeedbackReply[];
74
+ /** `GET /feedback/{id}/comments`, oldest first. */
75
+ comments: readonly FeedbackComment[];
76
+ /** The viewer is the app's admin: Hide / Unhide, the hidden text struck through. */
77
+ isAdmin: boolean;
78
+ /** `POST /feedback/{id}/comments`. Return the promise: the box clears when it
79
+ * resolves. Left out, no composer. */
80
+ onComment?: (body: string) => void | Promise<unknown>;
81
+ /** `PATCH /feedback/{id}/comments/{comment_id} {hidden}` — the admin's. Left out, no
82
+ * Hide / Unhide. */
83
+ onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;
84
+ /** `DELETE /feedback/{id}/comments/{comment_id}` — the writer's own, after the
85
+ * confirm. Left out, no Delete. */
86
+ onDelete?: (comment: FeedbackComment) => void | Promise<unknown>;
87
+ /** A comment is being sent. */
88
+ pending?: boolean;
89
+ /** The comments are loading. */
90
+ loading?: boolean;
91
+ /** Comment, Hide and Delete COMMIT — see Button's `commit`. */
92
+ commit?: CommitScope;
93
+ /** "Now" for the relative times — pin it in tests and stories. */
94
+ now?: Date | number;
95
+ labels?: LabelOverride<FeedbackCommentsLabels>;
96
+ className?: string;
97
+ }
98
+
99
+ type Entry = { at: number; order: number; message: FeedbackThreadMessage };
100
+
101
+ const instant = (iso: string) => {
102
+ const ms = Date.parse(iso);
103
+ return Number.isNaN(ms) ? 0 : ms;
104
+ };
105
+
106
+ export function FeedbackCommentThread({
107
+ replies,
108
+ comments,
109
+ isAdmin,
110
+ onComment,
111
+ onHide,
112
+ onDelete,
113
+ pending = false,
114
+ loading = false,
115
+ commit,
116
+ now,
117
+ labels: labelsProp,
118
+ className,
119
+ }: FeedbackCommentThreadProps) {
120
+ const labels = useKitLabels("feedbackComments", DEFAULT_FEEDBACK_COMMENTS_LABELS, labelsProp);
121
+ const anonymous = useKitLabels("feedbackPublic", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;
122
+ const replyLabels = useFeedbackRepliesLabels();
123
+
124
+ const entries: Entry[] = [];
125
+ replies.forEach((reply, order) => {
126
+ entries.push({
127
+ at: instant(reply.created_at),
128
+ order,
129
+ message: {
130
+ id: `reply-${reply.id}`,
131
+ author: reply.author_name ?? replyLabels.admin,
132
+ createdAt: reply.created_at,
133
+ body: reply.body,
134
+ staff: true,
135
+ badge: reply.status_to ? (
136
+ <span className="inline-flex min-w-0 max-w-full flex-wrap items-center gap-1" data-feedback-reply-status={reply.status_to}>
137
+ <span className="sr-only">{replyLabels.statusChanged}</span>
138
+ <span aria-hidden>→</span>
139
+ <FeedbackStatusBadge status={reply.status_to} />
140
+ </span>
141
+ ) : undefined,
142
+ },
143
+ });
144
+ });
145
+ comments.forEach((comment, index) => {
146
+ // Shown as hidden — no name, no text — to anyone but its writer and an admin.
147
+ const veiled = comment.hidden && !comment.mine && !isAdmin;
148
+ const actions: ReactNode[] = [];
149
+ if (comment.hidden) {
150
+ actions.push(
151
+ <span key="hidden" className="inline-flex items-center gap-1" data-feedback-comment-hidden="">
152
+ <EyeOff className="size-3" aria-hidden />
153
+ {labels.hidden}
154
+ </span>,
155
+ );
156
+ }
157
+ if (isAdmin && onHide) {
158
+ actions.push(
159
+ <Button
160
+ key="hide"
161
+ type="button"
162
+ variant="link"
163
+ tone="muted"
164
+ size="sm"
165
+ commit={commit}
166
+ onClick={() => void onHide(comment, !comment.hidden)}
167
+ >
168
+ {comment.hidden ? labels.unhide : labels.hide}
169
+ </Button>,
170
+ );
171
+ }
172
+ if (comment.mine && onDelete) {
173
+ actions.push(
174
+ <DeleteCommentButton key="delete" comment={comment} onDelete={onDelete} commit={commit} labels={labels} />,
175
+ );
176
+ }
177
+ entries.push({
178
+ at: instant(comment.created_at),
179
+ // Replies first on a tie, then the comments in their order.
180
+ order: replies.length + index,
181
+ message: {
182
+ id: `comment-${comment.id}`,
183
+ own: comment.mine,
184
+ author: veiled ? undefined : comment.mine ? undefined : (comment.author_name ?? anonymous),
185
+ createdAt: comment.created_at,
186
+ body: veiled ? "" : (comment.body ?? ""),
187
+ staff: !veiled && comment.staff,
188
+ struck: comment.hidden && isAdmin && !veiled,
189
+ footer: actions.length > 0 ? actions : undefined,
190
+ },
191
+ });
192
+ });
193
+ entries.sort((a, b) => a.at - b.at || a.order - b.order);
194
+
195
+ return (
196
+ <div className={className} data-feedback-comment-thread="">
197
+ <FeedbackThread
198
+ messages={entries.map((entry) => entry.message)}
199
+ loading={loading}
200
+ now={now}
201
+ labels={{ thread: labels.comments, empty: labels.empty }}
202
+ />
203
+ {onComment && (
204
+ <ChatComposer
205
+ className="mt-3"
206
+ onSend={(body) => onComment(body)}
207
+ pending={pending}
208
+ commit={commit}
209
+ maxLength={FEEDBACK_COMMENT_MAX}
210
+ showCount
211
+ labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.send }}
212
+ />
213
+ )}
214
+ </div>
215
+ );
216
+ }
217
+
218
+ /** The writer's Delete: a confirm (danger tone, focus on Cancel), then `onDelete`. Its
219
+ * own component, so `useConfirm` — which needs a `ConfirmProvider` — is only called
220
+ * where there is something to delete. */
221
+ function DeleteCommentButton({
222
+ comment,
223
+ onDelete,
224
+ commit,
225
+ labels,
226
+ }: {
227
+ comment: FeedbackComment;
228
+ onDelete: (comment: FeedbackComment) => void | Promise<unknown>;
229
+ commit?: CommitScope;
230
+ labels: FeedbackCommentsLabels;
231
+ }) {
232
+ const confirm = useConfirm();
233
+ const remove = async () => {
234
+ const ok = await confirm({
235
+ title: labels.deleteTitle,
236
+ body: labels.deleteBody,
237
+ confirmLabel: labels.delete,
238
+ tone: "danger",
239
+ commit,
240
+ });
241
+ if (ok) await onDelete(comment);
242
+ };
243
+ return (
244
+ <Button
245
+ type="button"
246
+ variant="link"
247
+ tone="danger"
248
+ size="sm"
249
+ commit={commit}
250
+ onClick={() => void remove().catch(() => {})}
251
+ >
252
+ {labels.delete}
253
+ </Button>
254
+ );
255
+ }
@@ -25,4 +25,5 @@ export const DEFAULT_FEEDBACK_DIALOG_LABELS: FeedbackDialogTextLabels = {
25
25
  submitHint: (apple) => (apple ? "⌘ Enter to send" : "Ctrl+Enter to send"),
26
26
  cancel: "Cancel",
27
27
  save: "Send",
28
+ publicNotice: "Other users will see the title and text (never your screenshots or files).",
28
29
  };
@@ -1,4 +1,4 @@
1
- import { useState } from "react";
1
+ import { useId, useState } from "react";
2
2
  import type { ReactNode } from "react";
3
3
  import { Button } from "../components/button";
4
4
  import { Input } from "../components/input";
@@ -93,6 +93,11 @@ export interface FeedbackDialogTextLabels {
93
93
  submitHint: FeedbackSubmitHint;
94
94
  cancel: string;
95
95
  save: string;
96
+ /** 0.38 (docs/feedback-harmonization.md §9.2 decision 6): the line under the body when
97
+ * reports are public — `useFeedbackSubmit({ publicNotice: true })` shows it. Optional,
98
+ * so a complete `UiKitLabels` typed before 0.38 still compiles. de-CH "Andere Personen
99
+ * sehen Titel und Text (nie Ihre Screenshots oder Dateien)." */
100
+ publicNotice?: string;
96
101
  }
97
102
 
98
103
  // Defined in ./feedback-dialog-labels, which holds no component code (0.34, KS U8).
@@ -161,6 +166,14 @@ interface FeedbackDialogBaseProps {
161
166
  /** The attachment field's `buttonSize` (0.25.0) — with {@link attachmentButtonVariant}.
162
167
  * Default `"md"`; `"sm"` draws the paperclip and camera at 14px. */
163
168
  attachmentButtonSize?: ButtonSize;
169
+ /**
170
+ * A muted line under the body saying who will read it (0.38, docs/feedback-harmonization.md
171
+ * §9.2 decision 6) — the kit's sentence is `feedbackDialog.publicNotice`, "Other users
172
+ * will see the title and text (never your screenshots or files)", which
173
+ * `useFeedbackSubmit({ publicNotice: true })` passes. Attached to the body field with
174
+ * `aria-describedby`, so it is heard where the text is written. Left out: no line.
175
+ */
176
+ publicNotice?: ReactNode;
164
177
  }
165
178
 
166
179
  /** One attachment — a screenshot, a picked or a pasted image; a second replaces
@@ -228,6 +241,7 @@ export function FeedbackDialog(props: FeedbackDialogProps) {
228
241
  requireBody = true,
229
242
  attachmentButtonVariant,
230
243
  attachmentButtonSize,
244
+ publicNotice,
231
245
  } = props;
232
246
  const [title, setTitle] = useState("");
233
247
  const [body, setBody] = useState("");
@@ -236,6 +250,8 @@ export function FeedbackDialog(props: FeedbackDialogProps) {
236
250
  const [screenshot, setScreenshot] = useState<File | null>(null);
237
251
  const [files, setFiles] = useState<File[]>([]);
238
252
  const isMobile = usePhoneLayout();
253
+ const noticeId = useId();
254
+ const hasNotice = publicNotice !== undefined && publicNotice !== null && publicNotice !== false && publicNotice !== "";
239
255
  const labels = useKitLabels("feedbackDialog", DEFAULT_FEEDBACK_DIALOG_LABELS, labelsProp);
240
256
  const attachmentText = useKitLabels("feedbackAttachment", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);
241
257
  // Under `multiple` the heading is `attachmentList` — a screenshot AND photos — which
@@ -295,14 +311,26 @@ export function FeedbackDialog(props: FeedbackDialogProps) {
295
311
  const subjectField = (
296
312
  <Input label={labels.subject} value={title} onChange={(e) => setTitle(e.target.value)} variant="display" />
297
313
  );
298
- const bodyField = (
314
+ const bodyTextarea = (
299
315
  <Textarea
300
316
  rows={5}
301
317
  label={requireBody ? labels.body : (labelsProp?.body ?? labels.bodyOptional ?? labels.body)}
302
318
  value={body}
303
319
  onChange={(e) => setBody(e.target.value)}
320
+ aria-describedby={hasNotice ? noticeId : undefined}
304
321
  />
305
322
  );
323
+ // 0.38: who will read it, right under what they are writing (§9.2 decision 6).
324
+ const bodyField = hasNotice ? (
325
+ <div className="space-y-1">
326
+ {bodyTextarea}
327
+ <p id={noticeId} className="text-xs text-muted" data-feedback-public-notice="">
328
+ {publicNotice}
329
+ </p>
330
+ </div>
331
+ ) : (
332
+ bodyTextarea
333
+ );
306
334
  const fieldProps = {
307
335
  labels: attachmentLabels,
308
336
  accept: attachmentAccept,
@@ -8,4 +8,5 @@ export const DEFAULT_FEEDBACK_MENU_LABELS: FeedbackMenuLabels = {
8
8
  trigger: "Send feedback",
9
9
  myFeedback: "My feedback",
10
10
  viewFeedback: "View feedback",
11
+ allFeedback: "All feedback",
11
12
  };
@@ -1,4 +1,4 @@
1
- import { Inbox, MessageSquare } from "lucide-react";
1
+ import { Inbox, MessageSquare, Users } from "lucide-react";
2
2
  import type { UserAvatarBadge } from "../components/user-avatar";
3
3
  import { useKitLabels, type LabelOverride } from "../i18n/kit-labels";
4
4
  import { TopBarActionMenu, type TopBarMenuEntry } from "../shell/topbar-action-menu";
@@ -25,6 +25,10 @@ export interface FeedbackMenuLabels {
25
25
  /** The link to the inbox — an admin's one list link, in place of "My feedback".
26
26
  * keksdose `feedback.view_all`. */
27
27
  viewFeedback: string;
28
+ /** The link to every public report, {@link FeedbackMenuProps.publicHref} (0.38,
29
+ * docs/feedback-harmonization.md §9.2 decision 21). Optional, so a complete
30
+ * `UiKitLabels` typed before 0.38 still compiles. de-CH "Alle Rückmeldungen". */
31
+ allFeedback?: string;
28
32
  }
29
33
 
30
34
  // Defined in ./feedback-menu-labels, which holds no component code (0.34, KS U8).
@@ -43,7 +47,7 @@ export interface FeedbackMenuProps {
43
47
  * `Sparkles` Help assistant → `/assistant` and `MessagesSquare` Support chat →
44
48
  * `/support` with its unread chip. Any {@link TopBarMenuEntry}; keep their `key`s clear
45
49
  * of the menu's own (`BUG`, `IDEA`, `QUESTION`, `OTHER`, `feedback-divider`,
46
- * `my-feedback`, `view-feedback`).
50
+ * `all-feedback`, `my-feedback`, `view-feedback`).
47
51
  */
48
52
  extraEntries?: TopBarMenuEntry[];
49
53
  /** The user's own reports, linked for everyone but an admin. Default `"/my-feedback"`
@@ -51,6 +55,15 @@ export interface FeedbackMenuProps {
51
55
  myFeedbackHref?: string;
52
56
  /** The admin inbox, linked for an admin. Default `"/feedback"` (§2.3). */
53
57
  inboxHref?: string;
58
+ /**
59
+ * The public list (0.38, docs/feedback-harmonization.md §9.2 decision 21): when passed,
60
+ * an **All feedback** row (`Users`, key `all-feedback`) above the list link, for
61
+ * everyone — the admin too, who reads what the others read there. keksdose:
62
+ * `"/all-feedback"`; "My feedback" stays as it is. Leave it out where the app has no
63
+ * public parts (kastlan) or the viewer may not see them (a Kurvenschmiede customer, a
64
+ * demo — §9.2 decisions 7, 8).
65
+ */
66
+ publicHref?: string;
54
67
  /** A dot on the trigger — keksdose's unread support replies (`tone: "danger"`). Its
55
68
  * `label` joins the trigger's name ("Send feedback 2 unread"). The words are the app's. */
56
69
  iconBadge?: UserAvatarBadge | null;
@@ -70,7 +83,8 @@ export interface FeedbackMenuProps {
70
83
  * the category badges' own glyphs), each calling `onFile(category)`;
71
84
  * 3. a divider, always;
72
85
  * 4. the app's `extraEntries`;
73
- * 5. ONE list link, `Inbox`: an admin's is "View feedback" → `/feedback`, everyone
86
+ * 5. with `publicHref` (0.38), **All feedback** → the public list, for everyone;
87
+ * 6. ONE list link, `Inbox`: an admin's is "View feedback" → `/feedback`, everyone
74
88
  * else's "My feedback" → `/my-feedback` — keksdose's (`top-bar.tsx:205-214`, feedback
75
89
  * #331: admins get the management view, everyone else their own submissions).
76
90
  *
@@ -96,6 +110,7 @@ export function FeedbackMenu({
96
110
  extraEntries,
97
111
  myFeedbackHref = "/my-feedback",
98
112
  inboxHref = "/feedback",
113
+ publicHref,
99
114
  iconBadge,
100
115
  labels: labelsProp,
101
116
  align,
@@ -114,6 +129,17 @@ export function FeedbackMenu({
114
129
  }),
115
130
  { kind: "divider", key: "feedback-divider" },
116
131
  ...(extraEntries ?? []),
132
+ ...(publicHref
133
+ ? [
134
+ {
135
+ kind: "link",
136
+ key: "all-feedback",
137
+ to: publicHref,
138
+ icon: <Users className="size-4" />,
139
+ label: labels.allFeedback ?? DEFAULT_FEEDBACK_MENU_LABELS.allFeedback!,
140
+ } satisfies TopBarMenuEntry,
141
+ ]
142
+ : []),
117
143
  {
118
144
  kind: "link",
119
145
  key: isAdmin ? "view-feedback" : "my-feedback",
@@ -0,0 +1,76 @@
1
+ // The English words of the public feedback pages (round 0.38, docs/feedback-harmonization.md
2
+ // §9.15) — `FeedbackPublicList`, `FeedbackPublicDetail` and `FeedbackPublicSwitch` — in a
3
+ // module with no component code: the English catalogue (src/i18n/defaults.ts) imports
4
+ // them without the components, as every `*-labels.ts` (0.34, KS U8).
5
+
6
+ /**
7
+ * `feedbackPublic` — the words of the pages every user reads (§9.3, §9.9): the list's
8
+ * sort, search and count, the detail's sections and the "Visible to others" switch. The
9
+ * table's column names that the inbox already has (#, Date, Category, Subject, Status)
10
+ * stay `feedbackPage`'s, so the two lists cannot disagree; the vote button's words are
11
+ * `feedbackVote`'s, the thread's `feedbackComments`'.
12
+ *
13
+ * de-CH canon (§9.2, §9.5): `title` "Alle Rückmeldungen", `anonymous` "Eine Person".
14
+ */
15
+ export interface FeedbackPublicLabels {
16
+ /** The page's heading — keksdose's `/all-feedback`, the menu's "All feedback". */
17
+ title: string;
18
+ /** The sort toggle's accessible name. */
19
+ sort: string;
20
+ /** `sort=newest`, the server's default. */
21
+ sortNewest: string;
22
+ /** `sort=votes`: most votes, then newest. */
23
+ sortVotes: string;
24
+ /** `sort=updated`. */
25
+ sortUpdated: string;
26
+ /** The search box's accessible name: it searches titles only (§9.9). */
27
+ search: string;
28
+ /** The Votes column's header. */
29
+ columnVotes: string;
30
+ /** How many reports the server has for this query (`total`). */
31
+ total: (count: number) => string;
32
+ /** A row's visible comments, the chip beside its title. */
33
+ comments: (count: number) => string;
34
+ /** A row's votes, the count on a phone card (the button is in the opened report). */
35
+ votes: (count: number) => string;
36
+ /** A `null` name (§9.5): an incomplete or erased account. */
37
+ anonymous: string;
38
+ /** Who filed it, with the server's first name (or {@link anonymous}). */
39
+ filedBy: (name: string) => string;
40
+ /** The detail's public body section. */
41
+ body: string;
42
+ /** The detail's merged replies and comments (§9.8, "Order"). */
43
+ conversation: string;
44
+ /** While the list or the comments load. */
45
+ loading: string;
46
+ /** No public report (yet, or for this search). */
47
+ empty: string;
48
+ /** `FeedbackPublicSwitch`'s label (§9.3, decision 6). */
49
+ visibleToOthers: string;
50
+ /** The line under it: what others see, and what never. */
51
+ visibleHint: string;
52
+ /** Why the author cannot flip it now: the report is past its open window (§9.3). */
53
+ visibleLocked: string;
54
+ }
55
+
56
+ export const DEFAULT_FEEDBACK_PUBLIC_LABELS: FeedbackPublicLabels = {
57
+ title: "All feedback",
58
+ sort: "Sort",
59
+ sortNewest: "Newest",
60
+ sortVotes: "Most wanted",
61
+ sortUpdated: "Recently updated",
62
+ search: "Search titles",
63
+ columnVotes: "Votes",
64
+ total: (count) => (count === 1 ? "1 report" : `${count} reports`),
65
+ comments: (count) => (count === 1 ? "1 comment" : `${count} comments`),
66
+ votes: (count) => (count === 1 ? "1 vote" : `${count} votes`),
67
+ anonymous: "A user",
68
+ filedBy: (name) => `From ${name}`,
69
+ body: "Description",
70
+ conversation: "Answers and comments",
71
+ loading: "Loading…",
72
+ empty: "No reports yet",
73
+ visibleToOthers: "Visible to others",
74
+ visibleHint: "Other users see the title and text, never your screenshots or files.",
75
+ visibleLocked: "Only while the report is still open.",
76
+ };