@eifi1/ui-kit 0.46.1 → 0.47.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.
- package/README.md +5 -5
- package/dist/components/data-table.js +18 -1
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/row-actions.d.ts +25 -0
- package/dist/components/row-actions.js +13 -3
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/tabs.d.ts +24 -16
- package/dist/components/tabs.js +37 -31
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/ui-labels.js +1 -1
- package/dist/components/ui-labels.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-attachment-download.d.ts +19 -0
- package/dist/feedback/feedback-attachment-download.js +59 -0
- package/dist/feedback/feedback-attachment-download.js.map +1 -0
- package/dist/feedback/feedback-comment-thread.d.ts +17 -6
- package/dist/feedback/feedback-comment-thread.js +21 -2
- package/dist/feedback/feedback-comment-thread.js.map +1 -1
- package/dist/feedback/feedback-entry-file.d.ts +61 -0
- package/dist/feedback/feedback-entry-file.js +76 -0
- package/dist/feedback/feedback-entry-file.js.map +1 -0
- package/dist/feedback/feedback-public-list.d.ts +18 -5
- package/dist/feedback/feedback-public-list.js +8 -0
- package/dist/feedback/feedback-public-list.js.map +1 -1
- package/dist/feedback/feedback-public-types.d.ts +7 -2
- package/dist/feedback/feedback-replies.d.ts +26 -9
- package/dist/feedback/feedback-replies.js +20 -10
- package/dist/feedback/feedback-replies.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.js +0 -1
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +23 -10
- package/dist/feedback/feedback-row-detail.js +10 -54
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback.d.ts +1 -0
- package/dist/feedback.js +1 -0
- package/dist/feedback.js.map +1 -1
- package/dist/i18n/german.js +1 -6
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/locales/en.js +1 -6
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +1 -6
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +1 -6
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +1 -6
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +1 -6
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +1 -6
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +0 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/notifications/device-zone-report.d.ts +1 -1
- package/dist/notifications/device-zone-report.js.map +1 -1
- package/dist/notifications/notification-types.d.ts +0 -3
- package/dist/notifications/notifications-labels.d.ts +2 -15
- package/dist/notifications/notifications-labels.js +0 -4
- package/dist/notifications/notifications-labels.js.map +1 -1
- package/dist/notifications/quiet-hours-setting.d.ts +3 -8
- package/dist/notifications/quiet-hours-setting.js +8 -3
- package/dist/notifications/quiet-hours-setting.js.map +1 -1
- package/dist/theme/theme-store.d.ts +4 -4
- package/dist/theme/theme-store.js +1 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/package.json +2 -2
- package/src/components/data-table.tsx +29 -3
- package/src/components/row-actions.tsx +42 -3
- package/src/components/tabs.tsx +66 -44
- package/src/components/ui-labels.ts +1 -1
- package/src/feedback/feedback-attachment-download.tsx +77 -0
- package/src/feedback/feedback-comment-thread.tsx +42 -7
- package/src/feedback/feedback-entry-file.tsx +150 -0
- package/src/feedback/feedback-public-list.tsx +25 -4
- package/src/feedback/feedback-public-types.ts +7 -2
- package/src/feedback/feedback-replies.tsx +46 -19
- package/src/feedback/feedback-row-detail-labels.ts +0 -1
- package/src/feedback/feedback-row-detail.tsx +35 -86
- package/src/feedback.ts +1 -0
- package/src/i18n/german.ts +1 -6
- package/src/i18n/locales/es.ts +1 -6
- package/src/i18n/locales/fr.ts +1 -6
- package/src/i18n/locales/hu.ts +1 -6
- package/src/i18n/locales/it.ts +1 -6
- package/src/i18n/locales/zh.ts +1 -6
- package/src/i18n/review.ts +0 -1
- package/src/index.ts +10 -3
- package/src/notifications/device-zone-report.ts +1 -1
- package/src/notifications/notification-types.ts +0 -3
- package/src/notifications/notifications-labels.ts +2 -19
- package/src/notifications/quiet-hours-setting.tsx +16 -11
- package/src/theme/theme-store.ts +13 -5
- package/dist/notifications/time-zone-select.d.ts +0 -54
- package/dist/notifications/time-zone-select.js +0 -71
- package/dist/notifications/time-zone-select.js.map +0 -1
- package/src/notifications/time-zone-select.tsx +0 -125
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { AuthedImage } from "../components/authed-image.js";
|
|
5
|
+
import { toast } from "../components/toast.js";
|
|
6
|
+
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
7
|
+
import { cn } from "../lib/cn.js";
|
|
8
|
+
import { DEFAULT_FEEDBACK_ATTACHMENT_LABELS, DEFAULT_MAX_ATTACHMENT_BYTES } from "./feedback-attachment.js";
|
|
9
|
+
import { useFeedbackToastLabels } from "./feedback-labels.js";
|
|
10
|
+
import { FeedbackAttachmentDownload, plainFeedbackFetch } from "./feedback-attachment-download.js";
|
|
11
|
+
import { FEEDBACK_ATTACHMENT_ACCEPT, isImageAttachment } from "./feedback-record.js";
|
|
12
|
+
import { DEFAULT_FEEDBACK_DETAIL_LABELS } from "./feedback-row-detail-labels.js";
|
|
13
|
+
function FeedbackEntryFile({ url, fetcher, className }) {
|
|
14
|
+
const labels = useKitLabels("feedbackDetail", DEFAULT_FEEDBACK_DETAIL_LABELS);
|
|
15
|
+
const fetchFile = fetcher ?? plainFeedbackFetch;
|
|
16
|
+
return /* @__PURE__ */ jsx("span", { className: cn("inline-block min-w-0 max-w-full", className), "data-feedback-entry-file": url, children: isImageAttachment(url) ? /* @__PURE__ */ jsx(
|
|
17
|
+
AuthedImage,
|
|
18
|
+
{
|
|
19
|
+
src: url,
|
|
20
|
+
alt: labels.attachment,
|
|
21
|
+
fetcher: fetchFile,
|
|
22
|
+
link: true,
|
|
23
|
+
stopPropagation: true,
|
|
24
|
+
errorFallback: /* @__PURE__ */ jsx(FeedbackAttachmentDownload, { url, fetcher: fetchFile }),
|
|
25
|
+
wrapperClassName: "inline-block max-w-full",
|
|
26
|
+
className: "max-h-40 max-w-full rounded border border-subtle"
|
|
27
|
+
}
|
|
28
|
+
) : /* @__PURE__ */ jsx(FeedbackAttachmentDownload, { url, fetcher: fetchFile }) });
|
|
29
|
+
}
|
|
30
|
+
function useFeedbackEntryUpload({
|
|
31
|
+
onUpload,
|
|
32
|
+
onCaptureScreenshot,
|
|
33
|
+
attachment
|
|
34
|
+
}) {
|
|
35
|
+
const toasts = useFeedbackToastLabels();
|
|
36
|
+
const fieldLabels = useKitLabels("feedbackAttachment", DEFAULT_FEEDBACK_ATTACHMENT_LABELS);
|
|
37
|
+
const [uploading, setUploading] = useState(false);
|
|
38
|
+
const capture = onCaptureScreenshot ? async () => {
|
|
39
|
+
try {
|
|
40
|
+
return await onCaptureScreenshot();
|
|
41
|
+
} catch {
|
|
42
|
+
toast.error(toasts.captureFailed);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
} : void 0;
|
|
46
|
+
const composerAttachment = onUpload ? {
|
|
47
|
+
accept: FEEDBACK_ATTACHMENT_ACCEPT,
|
|
48
|
+
maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,
|
|
49
|
+
onError: (kind) => {
|
|
50
|
+
toast.error(kind === "type" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);
|
|
51
|
+
},
|
|
52
|
+
onCaptureScreenshot: capture,
|
|
53
|
+
buttonVariant: "ghost",
|
|
54
|
+
buttonSize: "sm",
|
|
55
|
+
...attachment
|
|
56
|
+
} : void 0;
|
|
57
|
+
const upload = async (file) => {
|
|
58
|
+
if (!file || !onUpload) return void 0;
|
|
59
|
+
setUploading(true);
|
|
60
|
+
try {
|
|
61
|
+
return await onUpload(file);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
const failed = fieldLabels.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed;
|
|
64
|
+
toast.error(failed(file.name));
|
|
65
|
+
throw error;
|
|
66
|
+
} finally {
|
|
67
|
+
setUploading(false);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return { composerAttachment, upload, uploading };
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
FeedbackEntryFile,
|
|
74
|
+
useFeedbackEntryUpload
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=feedback-entry-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-entry-file.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { AuthedImage } from \"../components/authed-image\";\nimport { toast } from \"../components/toast\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS, DEFAULT_MAX_ATTACHMENT_BYTES } from \"./feedback-attachment\";\nimport type { FeedbackNoteAttachment } from \"./feedback-inbox\";\nimport { useFeedbackToastLabels } from \"./feedback-labels\";\nimport { FeedbackAttachmentDownload, plainFeedbackFetch } from \"./feedback-attachment-download\";\nimport { FEEDBACK_ATTACHMENT_ACCEPT, isImageAttachment } from \"./feedback-record\";\nimport { DEFAULT_FEEDBACK_DETAIL_LABELS } from \"./feedback-row-detail-labels\";\nimport type { FeedbackComposerAttachment } from \"./feedback-thread\";\n\n/**\n * One file of a conversation entry, and the upload behind an entry's composer\n * (docs/feedback-harmonization.md §12, round 0.47; keksdose run 82 R1, live #447).\n *\n * - {@link FeedbackEntryFile}: a picture drawn INLINE — a thumbnail fetched through the\n * app's authenticated GET, a tap opens it full size in a tab — and any other file a\n * download button, as the row detail's Attachment section draws them. The reply\n * timeline, the rework entries and the comment thread all draw their file with it.\n * - {@link useFeedbackEntryUpload}: the rework note's one-file field (paste from the\n * clipboard, capture, pick; the contract's types and 10 MB, §3.5) for a\n * {@link ChatComposer}, and the upload that runs FIRST on send, so an entry never names\n * a file that did not arrive.\n */\n\nexport interface FeedbackEntryFileProps {\n /** The entry's `attachment_url` — `/api/v1/feedback/attachments/<key>`. */\n url: string;\n /** The app's authenticated GET (`AuthedImage`'s): the attachment route wants the\n * bearer token (§3.5). Left out, the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n className?: string;\n}\n\n/**\n * An entry's one file (§12): a picture (`png`, `jpg`, `webp`, `gif` — by the key's\n * extension, which the server minted from the sniffed bytes) as an inline thumbnail that\n * opens full size in a new tab (`AuthedImage`'s `link`: the `blob:` URL, never the API\n * path); anything else a download button. A picture that will not load falls back to the\n * download button, so a broken file still says it is there. `alt`:\n * `feedbackDetail.attachment`.\n */\nexport function FeedbackEntryFile({ url, fetcher, className }: FeedbackEntryFileProps) {\n const labels = useKitLabels(\"feedbackDetail\", DEFAULT_FEEDBACK_DETAIL_LABELS);\n const fetchFile = fetcher ?? plainFeedbackFetch;\n return (\n <span className={cn(\"inline-block min-w-0 max-w-full\", className)} data-feedback-entry-file={url}>\n {isImageAttachment(url) ? (\n <AuthedImage\n src={url}\n alt={labels.attachment}\n fetcher={fetchFile}\n link\n stopPropagation\n errorFallback={<FeedbackAttachmentDownload url={url} fetcher={fetchFile} />}\n wrapperClassName=\"inline-block max-w-full\"\n className=\"max-h-40 max-w-full rounded border border-subtle\"\n />\n ) : (\n <FeedbackAttachmentDownload url={url} fetcher={fetchFile} />\n )}\n </span>\n );\n}\n\n/* ── The composer's one file ──────────────────────────────────────────────── */\n\n/** `POST /feedback/attachments` — the file, answered with its URL. */\nexport type FeedbackEntryUpload = (file: File) => Promise<string>;\n\nexport interface FeedbackEntryUploadOptions {\n /** The upload. Left out, the composer is text only. */\n onUpload?: FeedbackEntryUpload;\n /** The \"Capture screenshot\" button — the kit's `captureAppScreenshot` or the app's\n * own. A rejection toasts `feedbackToast.captureFailed` and adds nothing. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** Over the field's defaults: the contract's types and 10 MB (§3.5), the\n * `feedbackToast` refusals. The same object the rework section takes. */\n attachment?: Partial<FeedbackNoteAttachment>;\n}\n\nexport interface FeedbackEntryUploadState {\n /** For {@link ChatComposer}'s `attachment`; `undefined` without `onUpload`. */\n composerAttachment: FeedbackComposerAttachment | undefined;\n /** Upload the picked file, if any: its URL, `undefined` for none. Rejects after a\n * toast (`feedbackAttachment.attachmentUploadFailed`) when the upload fails — the\n * send then stops and the composer keeps the draft and the file. */\n upload: (file: File | null) => Promise<string | undefined>;\n /** An upload is running — add it to the composer's `pending`. */\n uploading: boolean;\n}\n\n/**\n * The rework note's file field for a reply or a comment composer (§12): one file, added,\n * captured or pasted from the clipboard into the box, the contract's types and 10 MB; and\n * the upload, awaited before the entry is sent.\n */\nexport function useFeedbackEntryUpload({\n onUpload,\n onCaptureScreenshot,\n attachment,\n}: FeedbackEntryUploadOptions): FeedbackEntryUploadState {\n const toasts = useFeedbackToastLabels();\n const fieldLabels = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS);\n const [uploading, setUploading] = useState(false);\n\n const capture = onCaptureScreenshot\n ? async () => {\n try {\n return await onCaptureScreenshot();\n } catch {\n toast.error(toasts.captureFailed);\n return null;\n }\n }\n : undefined;\n\n const composerAttachment: FeedbackComposerAttachment | undefined = onUpload\n ? {\n accept: FEEDBACK_ATTACHMENT_ACCEPT,\n maxBytes: DEFAULT_MAX_ATTACHMENT_BYTES,\n onError: (kind) => {\n toast.error(kind === \"type\" ? toasts.attachmentUnsupported : toasts.attachmentTooLarge);\n },\n onCaptureScreenshot: capture,\n buttonVariant: \"ghost\",\n buttonSize: \"sm\",\n ...attachment,\n }\n : undefined;\n\n const upload = async (file: File | null) => {\n if (!file || !onUpload) return undefined;\n setUploading(true);\n try {\n return await onUpload(file);\n } catch (error) {\n const failed = fieldLabels.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed!;\n toast.error(failed(file.name));\n throw error;\n } finally {\n setUploading(false);\n }\n };\n\n return { composerAttachment, upload, uploading };\n}\n"],"mappings":";AAyDyB;AAzDzB,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAEtB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oCAAoC,oCAAoC;AAEjF,SAAS,8BAA8B;AACvC,SAAS,4BAA4B,0BAA0B;AAC/D,SAAS,4BAA4B,yBAAyB;AAC9D,SAAS,sCAAsC;AAkCxC,SAAS,kBAAkB,EAAE,KAAK,SAAS,UAAU,GAA2B;AACrF,QAAM,SAAS,aAAa,kBAAkB,8BAA8B;AAC5E,QAAM,YAAY,WAAW;AAC7B,SACE,oBAAC,UAAK,WAAW,GAAG,mCAAmC,SAAS,GAAG,4BAA0B,KAC1F,4BAAkB,GAAG,IACpB;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,SAAS;AAAA,MACT,MAAI;AAAA,MACJ,iBAAe;AAAA,MACf,eAAe,oBAAC,8BAA2B,KAAU,SAAS,WAAW;AAAA,MACzE,kBAAiB;AAAA,MACjB,WAAU;AAAA;AAAA,EACZ,IAEA,oBAAC,8BAA2B,KAAU,SAAS,WAAW,GAE9D;AAEJ;AAkCO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,GAAyD;AACvD,QAAM,SAAS,uBAAuB;AACtC,QAAM,cAAc,aAAa,sBAAsB,kCAAkC;AACzF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,QAAM,UAAU,sBACZ,YAAY;AACV,QAAI;AACF,aAAO,MAAM,oBAAoB;AAAA,IACnC,QAAQ;AACN,YAAM,MAAM,OAAO,aAAa;AAChC,aAAO;AAAA,IACT;AAAA,EACF,IACA;AAEJ,QAAM,qBAA6D,WAC/D;AAAA,IACE,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS,CAAC,SAAS;AACjB,YAAM,MAAM,SAAS,SAAS,OAAO,wBAAwB,OAAO,kBAAkB;AAAA,IACxF;AAAA,IACA,qBAAqB;AAAA,IACrB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,GAAG;AAAA,EACL,IACA;AAEJ,QAAM,SAAS,OAAO,SAAsB;AAC1C,QAAI,CAAC,QAAQ,CAAC,SAAU,QAAO;AAC/B,iBAAa,IAAI;AACjB,QAAI;AACF,aAAO,MAAM,SAAS,IAAI;AAAA,IAC5B,SAAS,OAAO;AACd,YAAM,SAAS,YAAY,0BAA0B,mCAAmC;AACxF,YAAM,MAAM,OAAO,KAAK,IAAI,CAAC;AAC7B,YAAM;AAAA,IACR,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,EAAE,oBAAoB,QAAQ,UAAU;AACjD;","names":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { CommitScope } from "../components/write-lock.js";
|
|
3
|
+
import type { AuthedFetcher } from "../hooks/use-authed-src.js";
|
|
3
4
|
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
4
5
|
import { type FeedbackCommentsLabels } from "./feedback-comment-thread.js";
|
|
6
|
+
import type { FeedbackEntryUploadOptions } from "./feedback-entry-file.js";
|
|
5
7
|
import { DEFAULT_FEEDBACK_PUBLIC_LABELS, type FeedbackPublicLabels } from "./feedback-public-labels.js";
|
|
6
8
|
import type { FeedbackComment, FeedbackPublicListItem, FeedbackPublicRecord, FeedbackPublicSort, FeedbackVoteState } from "./feedback-public-types.js";
|
|
7
9
|
import { type FeedbackPageLabels, type FeedbackRenderDate } from "./feedback-table.js";
|
|
@@ -106,8 +108,18 @@ export interface FeedbackPublicDetailProps {
|
|
|
106
108
|
/** The viewer is the app's admin: Hide / Unhide on the comments. */
|
|
107
109
|
isAdmin?: boolean;
|
|
108
110
|
/** `POST /feedback/{id}/comments`. Left out — a demo, a reader who may not write — no
|
|
109
|
-
* composer.
|
|
110
|
-
|
|
111
|
+
* composer. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with
|
|
112
|
+
* `onUpload`). */
|
|
113
|
+
onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;
|
|
114
|
+
/** 0.47 (§12): `POST /feedback/attachments` — the comment box then takes one file,
|
|
115
|
+
* pasted, captured or picked, as the rework note does. Left out, text only. */
|
|
116
|
+
onUpload?: FeedbackEntryUploadOptions["onUpload"];
|
|
117
|
+
/** 0.47: the comment box's "Capture screenshot". */
|
|
118
|
+
onCaptureScreenshot?: FeedbackEntryUploadOptions["onCaptureScreenshot"];
|
|
119
|
+
/** 0.47: the comment box's file field, over the contract's defaults. */
|
|
120
|
+
attachment?: FeedbackEntryUploadOptions["attachment"];
|
|
121
|
+
/** 0.47: the app's authenticated GET for the comments' pictures, drawn inline. */
|
|
122
|
+
fetcher?: AuthedFetcher | null;
|
|
111
123
|
/** The admin's hide (`PATCH …/comments/{id} {hidden}`). */
|
|
112
124
|
onHide?: (comment: FeedbackComment, hidden: boolean) => void | Promise<unknown>;
|
|
113
125
|
/** The writer's delete (`DELETE …/comments/{id}`), after a confirm. */
|
|
@@ -136,7 +148,8 @@ export interface FeedbackPublicDetailProps {
|
|
|
136
148
|
* add one.
|
|
137
149
|
*
|
|
138
150
|
* What it never draws, because the public record never carries it (§9.10): an address,
|
|
139
|
-
* a last name,
|
|
140
|
-
* server's `public_body` — the client strips nothing and adds nothing.
|
|
151
|
+
* a last name, the report's screenshot or files, the page the report was filed on. The
|
|
152
|
+
* body is the server's `public_body` — the client strips nothing and adds nothing. The
|
|
153
|
+
* one file it shows (0.47, §12) is a comment's own, posted with it to be seen.
|
|
141
154
|
*/
|
|
142
|
-
export declare function FeedbackPublicDetail({ row, comments, onVote, isAdmin, onComment, onHide, onDelete, pending, commit, voteDisabled, renderDate: renderDateProp, now, labels: labelsProp, commentLabels, className, }: FeedbackPublicDetailProps): import("react").JSX.Element;
|
|
155
|
+
export declare function FeedbackPublicDetail({ row, comments, onVote, isAdmin, onComment, onHide, onDelete, onUpload, onCaptureScreenshot, attachment, fetcher, pending, commit, voteDisabled, renderDate: renderDateProp, now, labels: labelsProp, commentLabels, className, }: FeedbackPublicDetailProps): import("react").JSX.Element;
|
|
@@ -254,6 +254,10 @@ function FeedbackPublicDetail({
|
|
|
254
254
|
onComment,
|
|
255
255
|
onHide,
|
|
256
256
|
onDelete,
|
|
257
|
+
onUpload,
|
|
258
|
+
onCaptureScreenshot,
|
|
259
|
+
attachment,
|
|
260
|
+
fetcher,
|
|
257
261
|
pending,
|
|
258
262
|
commit,
|
|
259
263
|
voteDisabled,
|
|
@@ -294,6 +298,10 @@ function FeedbackPublicDetail({
|
|
|
294
298
|
onComment,
|
|
295
299
|
onHide,
|
|
296
300
|
onDelete,
|
|
301
|
+
onUpload,
|
|
302
|
+
onCaptureScreenshot,
|
|
303
|
+
attachment,
|
|
304
|
+
fetcher,
|
|
297
305
|
pending,
|
|
298
306
|
commit,
|
|
299
307
|
now,
|
|
@@ -1 +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 { FILL_HEIGHT_CLASS } from \"../shell/fill-height\";\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 /** 0.40.1: the list fills the window as DataTable's `fillHeight` (page layout §1) — the\n * public feedback page passes §1.2's rule. Below md the page scrolls, as everywhere. */\n fillHeight?: boolean;\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 fillHeight,\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\n className={cn(\"flex flex-col gap-3\", fillHeight && FILL_HEIGHT_CLASS, className)}\n data-feedback-public-list=\"\"\n aria-busy={loading || undefined}\n >\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 fillHeight={fillHeight}\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) — on a server before\n server-kit 0.13; since then each is an entry in the conversation (§10.3). */}\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 // 0.40 (§10.3): the author's rework entries are theirs — at the reading end.\n isAuthor={row.mine}\n onComment={onComment}\n onHide={onHide}\n onDelete={onDelete}\n pending={pending}\n comm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,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AACF,GAA8B;AAC5B,QAAM,SAAS,wBAAwB,UAAU;AACjD,QAAM,aAAa,sBAAsB,cAAc;AACvD,SACE,qBAAC,kBAAe,WACd;AAAA,yBAAC,SAAI,WAAU,+CAA8C,+BAA6B,IAAI,IAC5F;AAAA,0BAAC,UAAK,WAAU,0BAAyB,wBAAqB,IAC3D,iBAAO,QAAQ,IAAI,eAAe,OAAO,SAAS,GACrD;AAAA,MACA,oBAAC,cAAW,OAAO,IAAI,YAAY,YAAwB;AAAA,MAC3D;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,IAAI;AAAA,UACX,OAAO,IAAI;AAAA,UACX,KAAK,IAAI;AAAA,UACT;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,OACF;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,MAGnC,8BAAC,iBAAe,cAAI,MAAK,GAC3B;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,cACnC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,IAAI;AAAA,QACb,UAAU,YAAY,CAAC;AAAA,QACvB,SAAS,aAAa;AAAA,QACtB;AAAA,QAEA,UAAU,IAAI;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
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 type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { FILL_HEIGHT_CLASS } from \"../shell/fill-height\";\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 type { FeedbackEntryUploadOptions } from \"./feedback-entry-file\";\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 /** 0.40.1: the list fills the window as DataTable's `fillHeight` (page layout §1) — the\n * public feedback page passes §1.2's rule. Below md the page scrolls, as everywhere. */\n fillHeight?: boolean;\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 fillHeight,\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\n className={cn(\"flex flex-col gap-3\", fillHeight && FILL_HEIGHT_CLASS, className)}\n data-feedback-public-list=\"\"\n aria-busy={loading || undefined}\n >\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 fillHeight={fillHeight}\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. 0.47 (§12): `attachmentUrl` is the one file uploaded with it (with\n * `onUpload`). */\n onComment?: (body: string, attachmentUrl?: string) => void | Promise<unknown>;\n /** 0.47 (§12): `POST /feedback/attachments` — the comment box then takes one file,\n * pasted, captured or picked, as the rework note does. Left out, text only. */\n onUpload?: FeedbackEntryUploadOptions[\"onUpload\"];\n /** 0.47: the comment box's \"Capture screenshot\". */\n onCaptureScreenshot?: FeedbackEntryUploadOptions[\"onCaptureScreenshot\"];\n /** 0.47: the comment box's file field, over the contract's defaults. */\n attachment?: FeedbackEntryUploadOptions[\"attachment\"];\n /** 0.47: the app's authenticated GET for the comments' pictures, drawn inline. */\n fetcher?: AuthedFetcher | null;\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, the report's screenshot or files, the page the report was filed on. The\n * body is the server's `public_body` — the client strips nothing and adds nothing. The\n * one file it shows (0.47, §12) is a comment's own, posted with it to be seen.\n */\nexport function FeedbackPublicDetail({\n row,\n comments,\n onVote,\n isAdmin = false,\n onComment,\n onHide,\n onDelete,\n onUpload,\n onCaptureScreenshot,\n attachment,\n fetcher,\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) — on a server before\n server-kit 0.13; since then each is an entry in the conversation (§10.3). */}\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 // 0.40 (§10.3): the author's rework entries are theirs — at the reading end.\n isAuthor={row.mine}\n onComment={onComment}\n onHide={onHide}\n onDelete={onDelete}\n onUpload={onUpload}\n onCaptureScreenshot={onCaptureScreenshot}\n attachment={attachment}\n fetcher={fetcher}\n pending={pending}\n commit={commit}\n now={now}\n labels={commentLabels}\n />\n </FeedbackDetailSection>\n </FeedbackDetail>\n );\n}\n"],"mappings":";AA+CqB,cAajB,YAbiB;AA/CrB,SAAS,SAAS,gBAAgB;AAElC,SAAS,aAAa,cAAc,eAAe,gBAAgB;AACnE,SAAS,iBAAuC;AAChD,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAG5B,SAAS,oBAAwC;AACjD,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB,gBAAgB,uBAAuB,eAAe,2BAA2B;AACjH,SAAS,iCAAiC;AAC1C,SAAS,6BAA0D;AAEnE,SAAS,sCAAiE;AAQ1E;AAAA,EACE;AAAA,EACA;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AC;AAAA;AAAA,UACC,OAAO,IAAI;AAAA,UACX,OAAO,IAAI;AAAA,UACX,KAAK,IAAI;AAAA,UACT;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,OACF;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,MAGnC,8BAAC,iBAAe,cAAI,MAAK,GAC3B;AAAA,IACA,oBAAC,yBAAsB,OAAO,OAAO,cACnC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,IAAI;AAAA,QACb,UAAU,YAAY,CAAC;AAAA,QACvB,SAAS,aAAa;AAAA,QACtB;AAAA,QAEA,UAAU,IAAI;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -25,8 +25,9 @@ export interface FeedbackReply {
|
|
|
25
25
|
/** 0.40 (§10.3): `"reply"` (absent: a server before server-kit 0.13, all replies) or
|
|
26
26
|
* `"rework"`, the author's entry. */
|
|
27
27
|
kind?: FeedbackEntryKind;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
28
|
+
/** The entry's one file (`/api/v1/feedback/attachments/<key>`): a rework's (0.40) or,
|
|
29
|
+
* since 0.47 (§12, server-kit 0.18), an admin reply's — the admin and author views
|
|
30
|
+
* only; `null` or absent otherwise (never in the public view, §9.10). */
|
|
30
31
|
attachment_url?: string | null;
|
|
31
32
|
/** The status this reply moved the report to; `null` = no status change — and on a
|
|
32
33
|
* rework migrated out of the body (§10.4), whose move was never recorded. */
|
|
@@ -48,6 +49,10 @@ export interface FeedbackComment {
|
|
|
48
49
|
/** `null` when hidden, but for its writer and an admin. */
|
|
49
50
|
body: string | null;
|
|
50
51
|
hidden: boolean;
|
|
52
|
+
/** 0.47 (§12, server-kit 0.18): the comment's one file, shown with it to whoever reads
|
|
53
|
+
* its body; `null` when it has none or is hidden from this viewer, absent from an
|
|
54
|
+
* older server. */
|
|
55
|
+
attachment_url?: string | null;
|
|
51
56
|
/** ISO 8601. */
|
|
52
57
|
created_at: string;
|
|
53
58
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { CommitScope } from "../components/write-lock.js";
|
|
3
|
+
import type { AuthedFetcher } from "../hooks/use-authed-src.js";
|
|
3
4
|
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
4
5
|
import { type FeedbackStatus } from "./feedback-inbox.js";
|
|
5
6
|
import type { FeedbackReply } from "./feedback-public-types.js";
|
|
7
|
+
import { type FeedbackEntryUploadOptions } from "./feedback-entry-file.js";
|
|
6
8
|
import { DEFAULT_FEEDBACK_REPLIES_LABELS } from "./feedback-thread-parts-labels.js";
|
|
7
9
|
/**
|
|
8
10
|
* The admin's answers as a list (docs/feedback-harmonization.md §9.7, decision 5): each
|
|
@@ -57,10 +59,14 @@ export interface FeedbackReplyTimelineProps {
|
|
|
57
59
|
renderDate?: (iso: string) => string;
|
|
58
60
|
/** Tag bodies and names `data-private` (a host's screen-share blur). Default true. */
|
|
59
61
|
redact?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
62
|
+
/** How an entry's file (`attachment_url` — a rework's since 0.40, an admin reply's
|
|
63
|
+
* since 0.47) is drawn under its text. Default (0.47, §12): {@link FeedbackEntryFile} —
|
|
64
|
+
* a picture inline as a thumbnail that opens full size, any other file a download —
|
|
65
|
+
* through `fetcher`. */
|
|
63
66
|
renderAttachment?: (url: string) => ReactNode;
|
|
67
|
+
/** 0.47: the app's authenticated GET (`AuthedImage`'s) for the entries' files. Left
|
|
68
|
+
* out, the browser's own fetch with same-origin cookies. */
|
|
69
|
+
fetcher?: AuthedFetcher | null;
|
|
64
70
|
labels?: LabelOverride<FeedbackRepliesLabels>;
|
|
65
71
|
className?: string;
|
|
66
72
|
}
|
|
@@ -72,17 +78,21 @@ export interface FeedbackReplyTimelineProps {
|
|
|
72
78
|
* 0.40 (§10.3): an author's **rework** entry (`kind: "rework"`) stands among them as the
|
|
73
79
|
* author's — their name (`null` → "A user", never "Admin"), the **Rework** chip, the
|
|
74
80
|
* status it moved the report to (none on a migrated one) and its file.
|
|
81
|
+
*
|
|
82
|
+
* 0.47 (§12): any entry's file — a rework's, an admin reply's — is drawn under its text,
|
|
83
|
+
* a picture INLINE ({@link FeedbackEntryFile}).
|
|
75
84
|
*/
|
|
76
|
-
export declare function FeedbackReplyTimeline({ replies, renderDate, redact, renderAttachment, labels: labelsProp, className, }: FeedbackReplyTimelineProps): import("react").JSX.Element;
|
|
77
|
-
export interface FeedbackReplyComposerProps {
|
|
85
|
+
export declare function FeedbackReplyTimeline({ replies, renderDate, redact, renderAttachment, fetcher, labels: labelsProp, className, }: FeedbackReplyTimelineProps): import("react").JSX.Element;
|
|
86
|
+
export interface FeedbackReplyComposerProps extends FeedbackEntryUploadOptions {
|
|
78
87
|
/** The report's status now — what "No change" keeps. */
|
|
79
88
|
status: FeedbackStatus;
|
|
80
89
|
/**
|
|
81
90
|
* `POST /feedback/{id}/replies` — the body (1–{@link FEEDBACK_REPLY_MAX} after
|
|
82
|
-
* trimming)
|
|
83
|
-
* the
|
|
91
|
+
* trimming), the status picked, `undefined` for "No change", and (0.47, §12) the URL
|
|
92
|
+
* of the one file uploaded with it, `undefined` for none. Return the promise: the box
|
|
93
|
+
* clears when it resolves, and keeps everything on a rejection.
|
|
84
94
|
*/
|
|
85
|
-
onReply: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;
|
|
95
|
+
onReply: (body: string, status?: FeedbackStatus, attachmentUrl?: string) => void | Promise<unknown>;
|
|
86
96
|
/** The reply is in flight. */
|
|
87
97
|
pending?: boolean;
|
|
88
98
|
/** Preselect this status and say the author has not been told (§9.7, the nudge) —
|
|
@@ -104,5 +114,12 @@ export interface FeedbackReplyComposerProps {
|
|
|
104
114
|
* With `suggestedStatus` the line "The author has not been told. Add a reply." stands
|
|
105
115
|
* above it and that status is picked, so the reply that answers it records the status
|
|
106
116
|
* and the nudge goes away.
|
|
117
|
+
*
|
|
118
|
+
* 0.47 (§12, keksdose live #447): with `onUpload`, one file as the rework note takes it —
|
|
119
|
+
* a screenshot pasted into the box, a capture (`onCaptureScreenshot`), or a pick; the
|
|
120
|
+
* contract's types and 10 MB. It is uploaded FIRST; a failed upload toasts and sends
|
|
121
|
+
* nothing, and the draft and the file stay. `onUpload` here is the composer's own opt-in
|
|
122
|
+
* (new in 0.47, so no page passed it before); `FeedbackRowDetail` hands it on only with
|
|
123
|
+
* `replyAttachments`, since its `onUpload` is the rework note's too.
|
|
107
124
|
*/
|
|
108
|
-
export declare function FeedbackReplyComposer({ status, onReply, pending, suggestedStatus, commit, labels: labelsProp, className, }: FeedbackReplyComposerProps): import("react").JSX.Element;
|
|
125
|
+
export declare function FeedbackReplyComposer({ status, onReply, pending, suggestedStatus, commit, onUpload, onCaptureScreenshot, attachment, labels: labelsProp, className, }: FeedbackReplyComposerProps): import("react").JSX.Element;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { BellOff
|
|
4
|
+
import { BellOff } from "lucide-react";
|
|
5
5
|
import { Select } from "../components/select.js";
|
|
6
6
|
import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
|
|
7
7
|
import { cn } from "../lib/cn.js";
|
|
8
8
|
import { formatDate } from "../lib/format.js";
|
|
9
9
|
import { FeedbackStatusBadge, selectableFeedbackStatuses } from "./feedback-inbox.js";
|
|
10
10
|
import { useFeedbackStatusLabels } from "./feedback-labels.js";
|
|
11
|
-
import { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX
|
|
11
|
+
import { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX } from "./feedback-record.js";
|
|
12
|
+
import { FeedbackEntryFile, useFeedbackEntryUpload } from "./feedback-entry-file.js";
|
|
12
13
|
import { ChatComposer } from "./feedback-thread.js";
|
|
13
14
|
import { DEFAULT_FEEDBACK_REPLIES_LABELS } from "./feedback-thread-parts-labels.js";
|
|
14
15
|
import { FeedbackReworkEntryChip } from "./feedback-rework-entry-chip.js";
|
|
@@ -37,6 +38,7 @@ function FeedbackReplyTimeline({
|
|
|
37
38
|
renderDate,
|
|
38
39
|
redact = true,
|
|
39
40
|
renderAttachment,
|
|
41
|
+
fetcher,
|
|
40
42
|
labels: labelsProp,
|
|
41
43
|
className
|
|
42
44
|
}) {
|
|
@@ -64,10 +66,7 @@ function FeedbackReplyTimeline({
|
|
|
64
66
|
/* @__PURE__ */ jsx(EntryStatus, { reply, statusChanged: labels.statusChanged })
|
|
65
67
|
] }),
|
|
66
68
|
/* @__PURE__ */ jsx("p", { "data-private": priv, dir: "auto", className: "mt-0.5 whitespace-pre-wrap break-words text-start text-primary", children: reply.body }),
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ jsx(Paperclip, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
69
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 break-all", children: attachmentName(reply.attachment_url) })
|
|
70
|
-
] }) })
|
|
69
|
+
reply.attachment_url && /* @__PURE__ */ jsx("div", { className: "mt-1 min-w-0", "data-private": priv, "data-feedback-entry-attachment": "", children: renderAttachment ? renderAttachment(reply.attachment_url) : /* @__PURE__ */ jsx(FeedbackEntryFile, { url: reply.attachment_url, fetcher }) })
|
|
71
70
|
]
|
|
72
71
|
},
|
|
73
72
|
reply.id
|
|
@@ -85,19 +84,29 @@ function FeedbackReplyComposer({
|
|
|
85
84
|
pending = false,
|
|
86
85
|
suggestedStatus,
|
|
87
86
|
commit,
|
|
87
|
+
onUpload,
|
|
88
|
+
onCaptureScreenshot,
|
|
89
|
+
attachment,
|
|
88
90
|
labels: labelsProp,
|
|
89
91
|
className
|
|
90
92
|
}) {
|
|
91
93
|
const labels = useFeedbackRepliesLabels(labelsProp);
|
|
94
|
+
const { composerAttachment, upload, uploading } = useFeedbackEntryUpload({
|
|
95
|
+
onUpload,
|
|
96
|
+
onCaptureScreenshot,
|
|
97
|
+
attachment
|
|
98
|
+
});
|
|
92
99
|
const statusNames = useFeedbackStatusLabels();
|
|
93
100
|
const [pick, setPick] = useState({
|
|
94
101
|
under: suggestedStatus,
|
|
95
102
|
value: suggestedStatus ?? ""
|
|
96
103
|
});
|
|
97
104
|
const picked = pick.under === suggestedStatus ? pick.value : suggestedStatus ?? "";
|
|
98
|
-
const send = (body) => {
|
|
105
|
+
const send = async (body, file) => {
|
|
99
106
|
const sent = picked;
|
|
100
|
-
|
|
107
|
+
const url = await upload(file);
|
|
108
|
+
const replied = url === void 0 ? onReply(body, sent || void 0) : onReply(body, sent || void 0, url);
|
|
109
|
+
return Promise.resolve(replied).then(() => {
|
|
101
110
|
setPick((current) => current.value === sent ? { under: suggestedStatus, value: "" } : current);
|
|
102
111
|
});
|
|
103
112
|
};
|
|
@@ -110,7 +119,8 @@ function FeedbackReplyComposer({
|
|
|
110
119
|
ChatComposer,
|
|
111
120
|
{
|
|
112
121
|
onSend: send,
|
|
113
|
-
pending,
|
|
122
|
+
pending: pending || uploading,
|
|
123
|
+
attachment: composerAttachment,
|
|
114
124
|
commit,
|
|
115
125
|
maxLength: FEEDBACK_REPLY_MAX,
|
|
116
126
|
showCount: true,
|
|
@@ -124,7 +134,7 @@ function FeedbackReplyComposer({
|
|
|
124
134
|
{
|
|
125
135
|
"aria-label": labels.status,
|
|
126
136
|
value: picked,
|
|
127
|
-
disabled: pending,
|
|
137
|
+
disabled: pending || uploading,
|
|
128
138
|
onChange: (event) => setPick({ under: suggestedStatus, value: event.target.value }),
|
|
129
139
|
"data-feedback-reply-status-pick": "",
|
|
130
140
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-replies.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { BellOff, Paperclip } from \"lucide-react\";\nimport { Select } from \"../components/select\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatDate } from \"../lib/format\";\nimport { FeedbackStatusBadge, selectableFeedbackStatuses, type FeedbackStatus } from \"./feedback-inbox\";\nimport { useFeedbackStatusLabels } from \"./feedback-labels\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\nimport { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX, attachmentName } from \"./feedback-record\";\nimport { ChatComposer } from \"./feedback-thread\";\nimport { DEFAULT_FEEDBACK_REPLIES_LABELS } from \"./feedback-thread-parts-labels\";\nimport { FeedbackReworkEntryChip } from \"./feedback-rework-entry-chip\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS } from \"./feedback-public-labels\";\n\n/**\n * The admin's answers as a list (docs/feedback-harmonization.md §9.7, decision 5): each\n * reply its own row — who, when, what, and the status it moved the report to — where\n * 0.37 had one `outcome` field that every answer overwrote. {@link FeedbackReplyTimeline}\n * draws them; {@link FeedbackReplyComposer} writes the next one, with the status picker\n * beside it (decision 13: a reply notifies the author, a status alone does not, so the\n * status belongs with the words).\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackReplies` namespace of `<UiKitProvider labels>`. */\nexport interface FeedbackRepliesLabels {\n /** The timeline's accessible name. de-CH: \"Antworten\" */\n replies: string;\n /** No reply yet. de-CH: \"Noch keine Antwort\" */\n empty: string;\n /** A reply without an author — a loop's, a migrated outcome, an erased admin (§9.7).\n * The app's word for its admin; never \"the team\". de-CH: \"Admin\" */\n admin: string;\n /** Read before a reply's status chip (\"→ Done\"). de-CH: \"Status geändert auf\" */\n statusChanged: string;\n /** The reply box's accessible name. de-CH: \"Antwort schreiben\" */\n field: string;\n /** de-CH: \"Antwort schreiben…\" */\n placeholder: string;\n /** The send button. de-CH: \"Antworten\" */\n reply: string;\n /** The status picker's accessible name. de-CH: \"Status mit der Antwort\" */\n status: string;\n /** The picker's first option: the reply changes no status. de-CH: \"Keine Änderung\" */\n noChange: string;\n /** Above the composer when a decided status was set without a reply (§9.7, B2).\n * de-CH: \"Die meldende Person wurde nicht benachrichtigt. Schreiben Sie eine Antwort.\" */\n nudge: string;\n}\n\nexport { DEFAULT_FEEDBACK_REPLIES_LABELS };\n\n/** `feedbackReplies` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackRepliesLabels(labels?: LabelOverride<FeedbackRepliesLabels>): FeedbackRepliesLabels {\n return useKitLabels(\"feedbackReplies\", DEFAULT_FEEDBACK_REPLIES_LABELS, labels);\n}\n\n/**\n * The status a row detail should nudge toward (§9.7, B2), or `undefined`: the row's\n * status when it is decided ({@link FEEDBACK_DECIDED_STATUSES}) and no reply carries it\n * as its `status_to` — a status-only move from the table, a swipe or the pills told the\n * author nothing. `undefined` too without `replies` (a server before 0.38).\n */\nexport function feedbackReplyNudge(row: {\n status: FeedbackStatus;\n replies?: readonly Pick<FeedbackReply, \"status_to\">[] | null;\n}): FeedbackStatus | undefined {\n if (!row.replies || !FEEDBACK_DECIDED_STATUSES.includes(row.status)) return undefined;\n return row.replies.some((reply) => reply.status_to === row.status) ? undefined : row.status;\n}\n\n/* ── The timeline ─────────────────────────────────────────────────────────── */\n\nexport interface FeedbackReplyTimelineProps {\n /** Oldest first, as the server sends them. */\n replies: readonly FeedbackReply[];\n /** How a reply's time reads. Default: the date and time in the provider's locale. */\n renderDate?: (iso: string) => string;\n /** Tag bodies and names `data-private` (a host's screen-share blur). Default true. */\n redact?: boolean;\n /** 0.40: how a rework entry's file (`attachment_url`) is drawn under its text. Default:\n * its name beside a paperclip — the file itself is in the row detail's Attachment\n * section, fetched with the app's credentials. */\n renderAttachment?: (url: string) => ReactNode;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/** The status an entry moved the report to — \"→ Done\", with where from in the admin view.\n * Nothing on an entry with no `status_to`: a status-less reply, or a rework migrated out\n * of the body, whose move was never recorded (0.40, §10.3). */\nfunction EntryStatus({ reply, statusChanged }: { reply: FeedbackReply; statusChanged: string }) {\n if (!reply.status_to) return null;\n return (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{statusChanged}</span>\n {reply.status_from && reply.status_from !== reply.status_to && (\n <>\n <FeedbackStatusBadge status={reply.status_from} />\n <span aria-hidden>→</span>\n </>\n )}\n {!reply.status_from && <span aria-hidden>→</span>}\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n );\n}\n\n/**\n * The replies, oldest first, down a rule: each with its author (`null` → \"Admin\"), its\n * time, the status it set (\"→ Done\"; the admin view adds where from) and its text. No\n * edit and no delete (§9.7): a correction is a new reply.\n *\n * 0.40 (§10.3): an author's **rework** entry (`kind: \"rework\"`) stands among them as the\n * author's — their name (`null` → \"A user\", never \"Admin\"), the **Rework** chip, the\n * status it moved the report to (none on a migrated one) and its file.\n */\nexport function FeedbackReplyTimeline({\n replies,\n renderDate,\n redact = true,\n renderAttachment,\n labels: labelsProp,\n className,\n}: FeedbackReplyTimelineProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const anonymous = useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;\n const locale = useKitLocale();\n const priv = redact ? \"\" : undefined;\n if (replies.length === 0) {\n return <p className={cn(\"text-sm text-placeholder\", className)}>{labels.empty}</p>;\n }\n const dateText = (iso: string) =>\n renderDate ? renderDate(iso) : formatDate(iso, { dateStyle: \"medium\", timeStyle: \"short\" }, { locale });\n return (\n <ol aria-label={labels.replies} className={cn(\"space-y-3 border-s-2 border-subtle ps-3\", className)}>\n {replies.map((reply) => {\n const rework = reply.kind === \"rework\";\n return (\n <li\n key={reply.id}\n data-feedback-reply={reply.id}\n data-feedback-entry-kind={rework ? \"rework\" : undefined}\n className=\"min-w-0 text-sm\"\n >\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-caption text-muted\">\n <span data-private={priv} className=\"font-medium text-secondary\">\n {reply.author_name ?? (rework ? anonymous : labels.admin)}\n </span>\n {rework && <FeedbackReworkEntryChip />}\n <time dateTime={reply.created_at} className=\"tabular-nums\">\n {dateText(reply.created_at)}\n </time>\n <EntryStatus reply={reply} statusChanged={labels.statusChanged} />\n </div>\n <p data-private={priv} dir=\"auto\" className=\"mt-0.5 whitespace-pre-wrap break-words text-start text-primary\">\n {reply.body}\n </p>\n {rework && reply.attachment_url && (\n <div className=\"mt-1 min-w-0\" data-private={priv} data-feedback-entry-file=\"\">\n {renderAttachment ? (\n renderAttachment(reply.attachment_url)\n ) : (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-1 text-xs text-secondary\">\n <Paperclip className=\"size-3.5 shrink-0\" aria-hidden />\n <span className=\"min-w-0 break-all\">{attachmentName(reply.attachment_url)}</span>\n </span>\n )}\n </div>\n )}\n </li>\n );\n })}\n </ol>\n );\n}\n\n/* ── The composer ─────────────────────────────────────────────────────────── */\n\n/**\n * The status Select and Reply on one line, one height (keksdose live #417, Android, dark).\n *\n * A field and a button of the same padding are not the same height everywhere: on a touch\n * screen the field's type grows to 16 px (FIELD_TOUCH_TEXT, so iOS does not zoom) and its\n * box with it, while the button keeps its 14 px line — and at Large the button takes its\n * 48 px touch floor, which the field has not. So the composer's action row stretches its\n * two halves to one height and Reply fills it (Button's `stretch`, which is the kit's\n * answer for a button beside a taller field). Scoped to this composer through the marks\n * ChatComposer puts on its row: a host slot with an attachment preview must not drag the\n * send button to the preview's 80 px.\n *\n * On a touch screen the \"Ctrl+Enter to send\" hint has no keyboard to speak of, and beside\n * a field-height select it pushed Reply onto a line of its own on a phone — it is\n * visually hidden there (still read in order). At Large the button's 48 px floor is\n * taller than any field, here as in every form row of the kit.\n */\nconst REPLY_ROW_ALIGN = cn(\n \"[&_[data-chat-composer-actions]]:items-stretch\",\n \"[&_[data-chat-composer-send]]:self-stretch\",\n \"pointer-coarse:[&_[data-chat-composer-hint]]:sr-only\",\n);\n\nexport interface FeedbackReplyComposerProps {\n /** The report's status now — what \"No change\" keeps. */\n status: FeedbackStatus;\n /**\n * `POST /feedback/{id}/replies` — the body (1–{@link FEEDBACK_REPLY_MAX} after\n * trimming) and the status picked, `undefined` for \"No change\". Return the promise:\n * the box clears when it resolves, and keeps everything on a rejection.\n */\n onReply: (body: string, status?: FeedbackStatus) => void | Promise<unknown>;\n /** The reply is in flight. */\n pending?: boolean;\n /** Preselect this status and say the author has not been told (§9.7, the nudge) —\n * {@link feedbackReplyNudge}. */\n suggestedStatus?: FeedbackStatus;\n /** Reply COMMITS — see ChatComposer's `commit`. */\n commit?: CommitScope;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/**\n * The admin's reply box (§9.7): the text, the **status** to set with it (\"No change\"\n * first, then every status — {@link selectableFeedbackStatuses}, `REWORK` among them\n * since 0.40: how an admin sends any report back, their own included, §10.2 decision 6),\n * and **Reply**. A\n * {@link ChatComposer} underneath: Ctrl/⌘+Enter sends, the count runs to 8 000, a draft\n * typed while a reply is in flight stays.\n *\n * With `suggestedStatus` the line \"The author has not been told. Add a reply.\" stands\n * above it and that status is picked, so the reply that answers it records the status\n * and the nudge goes away.\n */\nexport function FeedbackReplyComposer({\n status,\n onReply,\n pending = false,\n suggestedStatus,\n commit,\n labels: labelsProp,\n className,\n}: FeedbackReplyComposerProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const statusNames = useFeedbackStatusLabels();\n // The pick, valid for the suggestion it was made under: a new suggestion (another\n // status set from the table) picks itself again.\n const [pick, setPick] = useState<{ under: FeedbackStatus | undefined; value: FeedbackStatus | \"\" }>({\n under: suggestedStatus,\n value: suggestedStatus ?? \"\",\n });\n const picked = pick.under === suggestedStatus ? pick.value : (suggestedStatus ?? \"\");\n\n const send = (body: string) => {\n const sent = picked;\n return Promise.resolve(onReply(body, sent || undefined)).then(() => {\n setPick((current) => (current.value === sent ? { under: suggestedStatus, value: \"\" } : current));\n });\n };\n\n return (\n <div className={cn(\"space-y-2\", REPLY_ROW_ALIGN, className)} data-feedback-reply-composer=\"\">\n {suggestedStatus && (\n <p className=\"flex items-start gap-1.5 text-xs text-secondary\" data-feedback-nudge={suggestedStatus}>\n <BellOff className=\"mt-0.5 size-3.5 shrink-0 text-warning\" aria-hidden />\n <span>{labels.nudge}</span>\n </p>\n )}\n <ChatComposer\n onSend={send}\n pending={pending}\n commit={commit}\n maxLength={FEEDBACK_REPLY_MAX}\n showCount\n labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.reply }}\n attachmentSlot={\n // The kit's standard Select at field height (#417: \"not invent new things where\n // there are usable ones already\") — `size=\"sm\"` was a 28 px box beside the\n // 38 px Reply. See REPLY_ROW_ALIGN for how the two keep one height.\n <Select\n aria-label={labels.status}\n value={picked}\n disabled={pending}\n onChange={(event) =>\n setPick({ under: suggestedStatus, value: event.target.value as FeedbackStatus | \"\" })\n }\n data-feedback-reply-status-pick=\"\"\n >\n <option value=\"\">{labels.noChange}</option>\n {selectableFeedbackStatuses(status).map((value) => (\n <option key={value} value={value}>\n {statusNames[value]}\n </option>\n ))}\n </Select>\n }\n />\n </div>\n );\n}\n"],"mappings":";AAmGM,SAEE,UAFF,KAEE,YAFF;AAnGN,SAAS,gBAAgB;AAEzB,SAAS,SAAS,iBAAiB;AACnC,SAAS,cAAc;AAEvB,SAAS,cAAc,oBAAwC;AAC/D,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB,kCAAuD;AACrF,SAAS,+BAA+B;AAExC,SAAS,2BAA2B,oBAAoB,sBAAsB;AAC9E,SAAS,oBAAoB;AAC7B,SAAS,uCAAuC;AAChD,SAAS,+BAA+B;AACxC,SAAS,sCAAsC;AA0CxC,SAAS,yBAAyB,QAAs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1
|
+
{"version":3,"sources":["../../src/feedback/feedback-replies.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { BellOff } from \"lucide-react\";\nimport { Select } from \"../components/select\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatDate } from \"../lib/format\";\nimport { FeedbackStatusBadge, selectableFeedbackStatuses, type FeedbackStatus } from \"./feedback-inbox\";\nimport { useFeedbackStatusLabels } from \"./feedback-labels\";\nimport type { FeedbackReply } from \"./feedback-public-types\";\nimport { FEEDBACK_DECIDED_STATUSES, FEEDBACK_REPLY_MAX } from \"./feedback-record\";\nimport { FeedbackEntryFile, useFeedbackEntryUpload, type FeedbackEntryUploadOptions } from \"./feedback-entry-file\";\nimport { ChatComposer } from \"./feedback-thread\";\nimport { DEFAULT_FEEDBACK_REPLIES_LABELS } from \"./feedback-thread-parts-labels\";\nimport { FeedbackReworkEntryChip } from \"./feedback-rework-entry-chip\";\nimport { DEFAULT_FEEDBACK_PUBLIC_LABELS } from \"./feedback-public-labels\";\n\n/**\n * The admin's answers as a list (docs/feedback-harmonization.md §9.7, decision 5): each\n * reply its own row — who, when, what, and the status it moved the report to — where\n * 0.37 had one `outcome` field that every answer overwrote. {@link FeedbackReplyTimeline}\n * draws them; {@link FeedbackReplyComposer} writes the next one, with the status picker\n * beside it (decision 13: a reply notifies the author, a status alone does not, so the\n * status belongs with the words).\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackReplies` namespace of `<UiKitProvider labels>`. */\nexport interface FeedbackRepliesLabels {\n /** The timeline's accessible name. de-CH: \"Antworten\" */\n replies: string;\n /** No reply yet. de-CH: \"Noch keine Antwort\" */\n empty: string;\n /** A reply without an author — a loop's, a migrated outcome, an erased admin (§9.7).\n * The app's word for its admin; never \"the team\". de-CH: \"Admin\" */\n admin: string;\n /** Read before a reply's status chip (\"→ Done\"). de-CH: \"Status geändert auf\" */\n statusChanged: string;\n /** The reply box's accessible name. de-CH: \"Antwort schreiben\" */\n field: string;\n /** de-CH: \"Antwort schreiben…\" */\n placeholder: string;\n /** The send button. de-CH: \"Antworten\" */\n reply: string;\n /** The status picker's accessible name. de-CH: \"Status mit der Antwort\" */\n status: string;\n /** The picker's first option: the reply changes no status. de-CH: \"Keine Änderung\" */\n noChange: string;\n /** Above the composer when a decided status was set without a reply (§9.7, B2).\n * de-CH: \"Die meldende Person wurde nicht benachrichtigt. Schreiben Sie eine Antwort.\" */\n nudge: string;\n}\n\nexport { DEFAULT_FEEDBACK_REPLIES_LABELS };\n\n/** `feedbackReplies` resolved: English, then `<UiKitProvider labels>`, then `labels`. */\nexport function useFeedbackRepliesLabels(labels?: LabelOverride<FeedbackRepliesLabels>): FeedbackRepliesLabels {\n return useKitLabels(\"feedbackReplies\", DEFAULT_FEEDBACK_REPLIES_LABELS, labels);\n}\n\n/**\n * The status a row detail should nudge toward (§9.7, B2), or `undefined`: the row's\n * status when it is decided ({@link FEEDBACK_DECIDED_STATUSES}) and no reply carries it\n * as its `status_to` — a status-only move from the table, a swipe or the pills told the\n * author nothing. `undefined` too without `replies` (a server before 0.38).\n */\nexport function feedbackReplyNudge(row: {\n status: FeedbackStatus;\n replies?: readonly Pick<FeedbackReply, \"status_to\">[] | null;\n}): FeedbackStatus | undefined {\n if (!row.replies || !FEEDBACK_DECIDED_STATUSES.includes(row.status)) return undefined;\n return row.replies.some((reply) => reply.status_to === row.status) ? undefined : row.status;\n}\n\n/* ── The timeline ─────────────────────────────────────────────────────────── */\n\nexport interface FeedbackReplyTimelineProps {\n /** Oldest first, as the server sends them. */\n replies: readonly FeedbackReply[];\n /** How a reply's time reads. Default: the date and time in the provider's locale. */\n renderDate?: (iso: string) => string;\n /** Tag bodies and names `data-private` (a host's screen-share blur). Default true. */\n redact?: boolean;\n /** How an entry's file (`attachment_url` — a rework's since 0.40, an admin reply's\n * since 0.47) is drawn under its text. Default (0.47, §12): {@link FeedbackEntryFile} —\n * a picture inline as a thumbnail that opens full size, any other file a download —\n * through `fetcher`. */\n renderAttachment?: (url: string) => ReactNode;\n /** 0.47: the app's authenticated GET (`AuthedImage`'s) for the entries' files. Left\n * out, the browser's own fetch with same-origin cookies. */\n fetcher?: AuthedFetcher | null;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/** The status an entry moved the report to — \"→ Done\", with where from in the admin view.\n * Nothing on an entry with no `status_to`: a status-less reply, or a rework migrated out\n * of the body, whose move was never recorded (0.40, §10.3). */\nfunction EntryStatus({ reply, statusChanged }: { reply: FeedbackReply; statusChanged: string }) {\n if (!reply.status_to) return null;\n return (\n <span className=\"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1\" data-feedback-reply-status={reply.status_to}>\n <span className=\"sr-only\">{statusChanged}</span>\n {reply.status_from && reply.status_from !== reply.status_to && (\n <>\n <FeedbackStatusBadge status={reply.status_from} />\n <span aria-hidden>→</span>\n </>\n )}\n {!reply.status_from && <span aria-hidden>→</span>}\n <FeedbackStatusBadge status={reply.status_to} />\n </span>\n );\n}\n\n/**\n * The replies, oldest first, down a rule: each with its author (`null` → \"Admin\"), its\n * time, the status it set (\"→ Done\"; the admin view adds where from) and its text. No\n * edit and no delete (§9.7): a correction is a new reply.\n *\n * 0.40 (§10.3): an author's **rework** entry (`kind: \"rework\"`) stands among them as the\n * author's — their name (`null` → \"A user\", never \"Admin\"), the **Rework** chip, the\n * status it moved the report to (none on a migrated one) and its file.\n *\n * 0.47 (§12): any entry's file — a rework's, an admin reply's — is drawn under its text,\n * a picture INLINE ({@link FeedbackEntryFile}).\n */\nexport function FeedbackReplyTimeline({\n replies,\n renderDate,\n redact = true,\n renderAttachment,\n fetcher,\n labels: labelsProp,\n className,\n}: FeedbackReplyTimelineProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const anonymous = useKitLabels(\"feedbackPublic\", DEFAULT_FEEDBACK_PUBLIC_LABELS).anonymous;\n const locale = useKitLocale();\n const priv = redact ? \"\" : undefined;\n if (replies.length === 0) {\n return <p className={cn(\"text-sm text-placeholder\", className)}>{labels.empty}</p>;\n }\n const dateText = (iso: string) =>\n renderDate ? renderDate(iso) : formatDate(iso, { dateStyle: \"medium\", timeStyle: \"short\" }, { locale });\n return (\n <ol aria-label={labels.replies} className={cn(\"space-y-3 border-s-2 border-subtle ps-3\", className)}>\n {replies.map((reply) => {\n const rework = reply.kind === \"rework\";\n return (\n <li\n key={reply.id}\n data-feedback-reply={reply.id}\n data-feedback-entry-kind={rework ? \"rework\" : undefined}\n className=\"min-w-0 text-sm\"\n >\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-caption text-muted\">\n <span data-private={priv} className=\"font-medium text-secondary\">\n {reply.author_name ?? (rework ? anonymous : labels.admin)}\n </span>\n {rework && <FeedbackReworkEntryChip />}\n <time dateTime={reply.created_at} className=\"tabular-nums\">\n {dateText(reply.created_at)}\n </time>\n <EntryStatus reply={reply} statusChanged={labels.statusChanged} />\n </div>\n <p data-private={priv} dir=\"auto\" className=\"mt-0.5 whitespace-pre-wrap break-words text-start text-primary\">\n {reply.body}\n </p>\n {reply.attachment_url && (\n <div className=\"mt-1 min-w-0\" data-private={priv} data-feedback-entry-attachment=\"\">\n {renderAttachment ? (\n renderAttachment(reply.attachment_url)\n ) : (\n <FeedbackEntryFile url={reply.attachment_url} fetcher={fetcher} />\n )}\n </div>\n )}\n </li>\n );\n })}\n </ol>\n );\n}\n\n/* ── The composer ─────────────────────────────────────────────────────────── */\n\n/**\n * The status Select and Reply on one line, one height (keksdose live #417, Android, dark).\n *\n * A field and a button of the same padding are not the same height everywhere: on a touch\n * screen the field's type grows to 16 px (FIELD_TOUCH_TEXT, so iOS does not zoom) and its\n * box with it, while the button keeps its 14 px line — and at Large the button takes its\n * 48 px touch floor, which the field has not. So the composer's action row stretches its\n * two halves to one height and Reply fills it (Button's `stretch`, which is the kit's\n * answer for a button beside a taller field). Scoped to this composer through the marks\n * ChatComposer puts on its row: a host slot with an attachment preview must not drag the\n * send button to the preview's 80 px.\n *\n * On a touch screen the \"Ctrl+Enter to send\" hint has no keyboard to speak of, and beside\n * a field-height select it pushed Reply onto a line of its own on a phone — it is\n * visually hidden there (still read in order). At Large the button's 48 px floor is\n * taller than any field, here as in every form row of the kit.\n */\nconst REPLY_ROW_ALIGN = cn(\n \"[&_[data-chat-composer-actions]]:items-stretch\",\n \"[&_[data-chat-composer-send]]:self-stretch\",\n \"pointer-coarse:[&_[data-chat-composer-hint]]:sr-only\",\n);\n\nexport interface FeedbackReplyComposerProps extends FeedbackEntryUploadOptions {\n /** The report's status now — what \"No change\" keeps. */\n status: FeedbackStatus;\n /**\n * `POST /feedback/{id}/replies` — the body (1–{@link FEEDBACK_REPLY_MAX} after\n * trimming), the status picked, `undefined` for \"No change\", and (0.47, §12) the URL\n * of the one file uploaded with it, `undefined` for none. Return the promise: the box\n * clears when it resolves, and keeps everything on a rejection.\n */\n onReply: (body: string, status?: FeedbackStatus, attachmentUrl?: string) => void | Promise<unknown>;\n /** The reply is in flight. */\n pending?: boolean;\n /** Preselect this status and say the author has not been told (§9.7, the nudge) —\n * {@link feedbackReplyNudge}. */\n suggestedStatus?: FeedbackStatus;\n /** Reply COMMITS — see ChatComposer's `commit`. */\n commit?: CommitScope;\n labels?: LabelOverride<FeedbackRepliesLabels>;\n className?: string;\n}\n\n/**\n * The admin's reply box (§9.7): the text, the **status** to set with it (\"No change\"\n * first, then every status — {@link selectableFeedbackStatuses}, `REWORK` among them\n * since 0.40: how an admin sends any report back, their own included, §10.2 decision 6),\n * and **Reply**. A\n * {@link ChatComposer} underneath: Ctrl/⌘+Enter sends, the count runs to 8 000, a draft\n * typed while a reply is in flight stays.\n *\n * With `suggestedStatus` the line \"The author has not been told. Add a reply.\" stands\n * above it and that status is picked, so the reply that answers it records the status\n * and the nudge goes away.\n *\n * 0.47 (§12, keksdose live #447): with `onUpload`, one file as the rework note takes it —\n * a screenshot pasted into the box, a capture (`onCaptureScreenshot`), or a pick; the\n * contract's types and 10 MB. It is uploaded FIRST; a failed upload toasts and sends\n * nothing, and the draft and the file stay. `onUpload` here is the composer's own opt-in\n * (new in 0.47, so no page passed it before); `FeedbackRowDetail` hands it on only with\n * `replyAttachments`, since its `onUpload` is the rework note's too.\n */\nexport function FeedbackReplyComposer({\n status,\n onReply,\n pending = false,\n suggestedStatus,\n commit,\n onUpload,\n onCaptureScreenshot,\n attachment,\n labels: labelsProp,\n className,\n}: FeedbackReplyComposerProps) {\n const labels = useFeedbackRepliesLabels(labelsProp);\n const { composerAttachment, upload, uploading } = useFeedbackEntryUpload({\n onUpload,\n onCaptureScreenshot,\n attachment,\n });\n const statusNames = useFeedbackStatusLabels();\n // The pick, valid for the suggestion it was made under: a new suggestion (another\n // status set from the table) picks itself again.\n const [pick, setPick] = useState<{ under: FeedbackStatus | undefined; value: FeedbackStatus | \"\" }>({\n under: suggestedStatus,\n value: suggestedStatus ?? \"\",\n });\n const picked = pick.under === suggestedStatus ? pick.value : (suggestedStatus ?? \"\");\n\n const send = async (body: string, file: File | null) => {\n const sent = picked;\n const url = await upload(file);\n // The third argument only with a file, so a text reply calls as before 0.47.\n const replied = url === undefined ? onReply(body, sent || undefined) : onReply(body, sent || undefined, url);\n return Promise.resolve(replied).then(() => {\n setPick((current) => (current.value === sent ? { under: suggestedStatus, value: \"\" } : current));\n });\n };\n\n return (\n <div className={cn(\"space-y-2\", REPLY_ROW_ALIGN, className)} data-feedback-reply-composer=\"\">\n {suggestedStatus && (\n <p className=\"flex items-start gap-1.5 text-xs text-secondary\" data-feedback-nudge={suggestedStatus}>\n <BellOff className=\"mt-0.5 size-3.5 shrink-0 text-warning\" aria-hidden />\n <span>{labels.nudge}</span>\n </p>\n )}\n <ChatComposer\n onSend={send}\n pending={pending || uploading}\n attachment={composerAttachment}\n commit={commit}\n maxLength={FEEDBACK_REPLY_MAX}\n showCount\n labels={{ field: labels.field, placeholder: labels.placeholder, send: labels.reply }}\n attachmentSlot={\n // The kit's standard Select at field height (#417: \"not invent new things where\n // there are usable ones already\") — `size=\"sm\"` was a 28 px box beside the\n // 38 px Reply. See REPLY_ROW_ALIGN for how the two keep one height.\n <Select\n aria-label={labels.status}\n value={picked}\n disabled={pending || uploading}\n onChange={(event) =>\n setPick({ under: suggestedStatus, value: event.target.value as FeedbackStatus | \"\" })\n }\n data-feedback-reply-status-pick=\"\"\n >\n <option value=\"\">{labels.noChange}</option>\n {selectableFeedbackStatuses(status).map((value) => (\n <option key={value} value={value}>\n {statusNames[value]}\n </option>\n ))}\n </Select>\n }\n />\n </div>\n );\n}\n"],"mappings":";AAyGM,SAEE,UAFF,KAEE,YAFF;AAzGN,SAAS,gBAAgB;AAEzB,SAAS,eAAe;AACxB,SAAS,cAAc;AAGvB,SAAS,cAAc,oBAAwC;AAC/D,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB,kCAAuD;AACrF,SAAS,+BAA+B;AAExC,SAAS,2BAA2B,0BAA0B;AAC9D,SAAS,mBAAmB,8BAA+D;AAC3F,SAAS,oBAAoB;AAC7B,SAAS,uCAAuC;AAChD,SAAS,+BAA+B;AACxC,SAAS,sCAAsC;AA0CxC,SAAS,yBAAyB,QAAsE;AAC7G,SAAO,aAAa,mBAAmB,iCAAiC,MAAM;AAChF;AAQO,SAAS,mBAAmB,KAGJ;AAC7B,MAAI,CAAC,IAAI,WAAW,CAAC,0BAA0B,SAAS,IAAI,MAAM,EAAG,QAAO;AAC5E,SAAO,IAAI,QAAQ,KAAK,CAAC,UAAU,MAAM,cAAc,IAAI,MAAM,IAAI,SAAY,IAAI;AACvF;AA0BA,SAAS,YAAY,EAAE,OAAO,cAAc,GAAoD;AAC9F,MAAI,CAAC,MAAM,UAAW,QAAO;AAC7B,SACE,qBAAC,UAAK,WAAU,+DAA8D,8BAA4B,MAAM,WAC9G;AAAA,wBAAC,UAAK,WAAU,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Q,UAAU,OAAO,EAAE,OAAO,iBAAiB,OAAO,GAAG,IAAI,OAAQ;AAAA,IACjG,CAAC;AAAA,EACH;AAEA,SACE,qBAAC,SAAI,WAAW,GAAG,aAAa,iBAAiB,SAAS,GAAG,gCAA6B,IACvF;AAAA,uBACC,qBAAC,OAAE,WAAU,mDAAkD,uBAAqB,iBAClF;AAAA,0BAAC,WAAQ,WAAU,yCAAwC,eAAW,MAAC;AAAA,MACvE,oBAAC,UAAM,iBAAO,OAAM;AAAA,OACtB;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,WAAW;AAAA,QACpB,YAAY;AAAA,QACZ;AAAA,QACA,WAAW;AAAA,QACX,WAAS;AAAA,QACT,QAAQ,EAAE,OAAO,OAAO,OAAO,aAAa,OAAO,aAAa,MAAM,OAAO,MAAM;AAAA,QACnF;AAAA;AAAA;AAAA;AAAA,UAIE;AAAA,YAAC;AAAA;AAAA,cACC,cAAY,OAAO;AAAA,cACnB,OAAO;AAAA,cACP,UAAU,WAAW;AAAA,cACrB,UAAU,CAAC,UACT,QAAQ,EAAE,OAAO,iBAAiB,OAAO,MAAM,OAAO,MAA6B,CAAC;AAAA,cAEtF,mCAAgC;AAAA,cAEhC;AAAA,oCAAC,YAAO,OAAM,IAAI,iBAAO,UAAS;AAAA,gBACjC,2BAA2B,MAAM,EAAE,IAAI,CAAC,UACvC,oBAAC,YAAmB,OACjB,sBAAY,KAAK,KADP,KAEb,CACD;AAAA;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -18,7 +18,6 @@ const DEFAULT_FEEDBACK_DETAIL_LABELS = {
|
|
|
18
18
|
outcomeUpdate: "Update",
|
|
19
19
|
outcomePlaceholder: "What was done, decided, or why this won't be addressed.",
|
|
20
20
|
rework: "Rework",
|
|
21
|
-
openPage: "Open page",
|
|
22
21
|
reworkTitle: "Send for rework",
|
|
23
22
|
reworkSend: "Send rework",
|
|
24
23
|
reworkPlaceholder: "What still needs refinement? Any new constraints or change of direction.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\n body: \"Description\",\n edit: \"Edit\",\n editDescription: \"Edit description\",\n save: \"Save\",\n cancel: \"Cancel\",\n url: \"URL\",\n copyUrl: \"Copy URL\",\n attachment: \"Attachment\",\n download: (name) => `Download ${name}`,\n downloadFailed: \"The attachment could not be downloaded.\",\n outcome: \"Outcome\",\n replies: \"Replies\",\n resolvedAt: (date) => `Resolved: ${date}`,\n outcomeAdd: \"Add outcome\",\n outcomeUpdate: \"Update\",\n outcomePlaceholder: \"What was done, decided, or why this won't be addressed.\",\n rework: \"Rework\",\n
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/feedback-row-detail-labels.ts"],"sourcesContent":["// The English words of ./feedback-row-detail, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./feedback-row-detail\n// re-exports them.\n\nimport type { FeedbackDetailLabels } from \"./feedback-row-detail\";\n\nexport const DEFAULT_FEEDBACK_DETAIL_LABELS: FeedbackDetailLabels = {\n subject: \"Subject\",\n body: \"Description\",\n edit: \"Edit\",\n editDescription: \"Edit description\",\n save: \"Save\",\n cancel: \"Cancel\",\n url: \"URL\",\n copyUrl: \"Copy URL\",\n attachment: \"Attachment\",\n download: (name) => `Download ${name}`,\n downloadFailed: \"The attachment could not be downloaded.\",\n outcome: \"Outcome\",\n replies: \"Replies\",\n resolvedAt: (date) => `Resolved: ${date}`,\n outcomeAdd: \"Add outcome\",\n outcomeUpdate: \"Update\",\n outcomePlaceholder: \"What was done, decided, or why this won't be addressed.\",\n rework: \"Rework\",\n reworkTitle: \"Send for rework\",\n reworkSend: \"Send rework\",\n reworkPlaceholder: \"What still needs refinement? Any new constraints or change of direction.\",\n reworkUploadFailed: \"The file could not be uploaded. The rework was not sent.\",\n status: \"Status\",\n note: \"Note\",\n};\n"],"mappings":";AAOO,MAAM,iCAAuD;AAAA,EAClE,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU,CAAC,SAAS,YAAY,IAAI;AAAA,EACpC,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY,CAAC,SAAS,aAAa,IAAI;AAAA,EACvC,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,MAAM;AACR;","names":[]}
|