@cosmicdrift/kumiko-document-designer 0.406.0 → 0.409.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/dist/web/cells.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { formatWhen, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
2
|
+
import { formatWhen, useLocale, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
3
3
|
import { EMPTY_VALUE_PLACEHOLDER, toInstant } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
4
|
import { StatusBadge } from "@cosmicdrift/kumiko-renderer/web";
|
|
5
5
|
import { parseOverviewRow } from "./overview-row.js";
|
|
@@ -54,16 +54,17 @@ export function UsedByCell({ row }) {
|
|
|
54
54
|
}
|
|
55
55
|
// Date only keeps the column narrow enough for the overview to fit without
|
|
56
56
|
// horizontal scroll; the full timestamp stays reachable via the tooltip.
|
|
57
|
-
function formatModifiedDate(value) {
|
|
57
|
+
function formatModifiedDate(value, locale) {
|
|
58
58
|
try {
|
|
59
|
-
return toInstant(value).toLocaleString(
|
|
59
|
+
return toInstant(value).toLocaleString(locale, { dateStyle: "medium" });
|
|
60
60
|
}
|
|
61
61
|
catch {
|
|
62
62
|
return value;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
export function ModifiedCell({ row }) {
|
|
66
|
-
|
|
66
|
+
const locale = useLocale().locale();
|
|
67
|
+
return withRow(row, (r) => r.modifiedAt === "" ? (EMPTY_VALUE_PLACEHOLDER) : (_jsx("span", { className: "whitespace-nowrap", title: formatWhen(r.modifiedAt, locale), children: formatModifiedDate(r.modifiedAt, locale) })));
|
|
67
68
|
}
|
|
68
69
|
function OverriddenByCount({ overriddenBy, }) {
|
|
69
70
|
const t = useTranslation();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TemplateResolverHandlers } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
-
import { dispatcherErrorText, formatWhen, useMutation, usePrimitives, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
3
|
+
import { dispatcherErrorText, formatWhen, useLocale, useMutation, usePrimitives, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
4
4
|
import { EMPTY_VALUE_PLACEHOLDER } from "@cosmicdrift/kumiko-renderer/headless";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { originOf } from "./editor-header.js";
|
|
@@ -12,13 +12,13 @@ export function languageName(t, locale) {
|
|
|
12
12
|
const translated = t(key);
|
|
13
13
|
return translated === key ? locale : translated;
|
|
14
14
|
}
|
|
15
|
-
function statusSentence(t, row) {
|
|
15
|
+
function statusSentence(t, row, appLocale) {
|
|
16
16
|
const besideActive = draftBesideActiveSentence(t, row);
|
|
17
17
|
if (besideActive !== null)
|
|
18
18
|
return besideActive;
|
|
19
19
|
if (row.status === "active") {
|
|
20
20
|
return t("documentDesigner.mail.origin.activeSince", {
|
|
21
|
-
when: row.modifiedAt === null ? EMPTY_VALUE_PLACEHOLDER : formatWhen(row.modifiedAt),
|
|
21
|
+
when: row.modifiedAt === null ? EMPTY_VALUE_PLACEHOLDER : formatWhen(row.modifiedAt, appLocale),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
return t(row.status === "archived"
|
|
@@ -31,6 +31,7 @@ function MissingLocaleBar({ locale, creating, controls, }) {
|
|
|
31
31
|
}
|
|
32
32
|
function TenantOriginBar({ row, systemVersion, controls, onReset, onResetError, }) {
|
|
33
33
|
const t = useTranslation();
|
|
34
|
+
const appLocale = useLocale().locale();
|
|
34
35
|
const { Button, Dialog } = usePrimitives();
|
|
35
36
|
const [diffOpen, setDiffOpen] = useState(false);
|
|
36
37
|
const [resetOpen, setResetOpen] = useState(false);
|
|
@@ -44,7 +45,7 @@ function TenantOriginBar({ row, systemVersion, controls, onReset, onResetError,
|
|
|
44
45
|
onResetError(dispatcherErrorText(result.error, t));
|
|
45
46
|
} })] }), links: hasSystem && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "link", onClick: () => setDiffOpen(true), testId: "document-designer-diff-open", children: t("documentDesigner.editor.diff.open") }), _jsx(Button, { variant: "link", onClick: () => setResetOpen(true), testId: "document-designer-reset-open", children: t("documentDesigner.mail.origin.reset") })] })), children: [hasSystem
|
|
46
47
|
? t("documentDesigner.mail.origin.overrides", { version: systemVersion })
|
|
47
|
-
: t("documentDesigner.mail.origin.tenantOnly"), " ", statusSentence(t, row)] }));
|
|
48
|
+
: t("documentDesigner.mail.origin.tenantOnly"), " ", statusSentence(t, row, appLocale)] }));
|
|
48
49
|
}
|
|
49
50
|
export function MailOriginBar({ row, systemVersion, locale, isSystemAdmin, creating, controls, onReload, onResetError, }) {
|
|
50
51
|
const t = useTranslation();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { formatWhen, useAppFeatures, useQuery, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
2
|
+
import { formatWhen, useAppFeatures, useLocale, useQuery, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
3
3
|
import { EMPTY_VALUE_PLACEHOLDER } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
4
|
import { StatusBadge } from "@cosmicdrift/kumiko-renderer/web";
|
|
5
5
|
import { RailHint, RailRow, RailSection } from "./rail.js";
|
|
@@ -10,6 +10,7 @@ const MEMBER_DIRECTORY_QUERY = "tenant:query:member-directory";
|
|
|
10
10
|
const VERSION_LIMIT = 20;
|
|
11
11
|
function VersionRows({ rowId, currentVersion, currentStatus, }) {
|
|
12
12
|
const t = useTranslation();
|
|
13
|
+
const appLocale = useLocale().locale();
|
|
13
14
|
const audit = useQuery(AUDIT_LIST_QUERY, {
|
|
14
15
|
aggregateType: "template-resource",
|
|
15
16
|
aggregateId: rowId,
|
|
@@ -28,7 +29,7 @@ function VersionRows({ rowId, currentVersion, currentStatus, }) {
|
|
|
28
29
|
});
|
|
29
30
|
return (_jsx(_Fragment, { children: versions.map((row) => (_jsx(RailRow, { testId: `mail-version-${row.version}`, label: t("documentDesigner.mail.versions.line", {
|
|
30
31
|
version: row.version,
|
|
31
|
-
when: formatWhen(row.createdAt),
|
|
32
|
+
when: formatWhen(row.createdAt, appLocale),
|
|
32
33
|
name: names.get(row.createdBy) ?? EMPTY_VALUE_PLACEHOLDER,
|
|
33
34
|
}), trailing: row.version === currentVersion ? (_jsx(StatusBadge, { tone: statusTone(status), children: statusLabel(t, status, row.version) })) : undefined }, row.version))) }));
|
|
34
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TemplateResolverQueries } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
-
import { formatWhen, usePrimitives, useQuery, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
3
|
+
import { formatWhen, useLocale, usePrimitives, useQuery, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
4
4
|
import { Drawer, EmptyState, LoadingState } from "@cosmicdrift/kumiko-renderer/web";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { DiffView } from "./origin-bar.js";
|
|
@@ -22,6 +22,7 @@ function TenantDetail({ slug, locale, view, onBack, }) {
|
|
|
22
22
|
}
|
|
23
23
|
export function OverridesDrawer({ open, onOpenChange, slug, locale, overrides, }) {
|
|
24
24
|
const t = useTranslation();
|
|
25
|
+
const appLocale = useLocale().locale();
|
|
25
26
|
const { DataTable } = usePrimitives();
|
|
26
27
|
const [view, setView] = useState(null);
|
|
27
28
|
// Only asked while the drawer is open; the answer is not needed for the editor itself.
|
|
@@ -65,9 +66,9 @@ export function OverridesDrawer({ open, onOpenChange, slug, locale, overrides, }
|
|
|
65
66
|
tenantName: row.tenantName,
|
|
66
67
|
status: row.status,
|
|
67
68
|
versionLabel: `v${row.version}`,
|
|
68
|
-
changed: formatWhen(row.changedAt),
|
|
69
|
+
changed: formatWhen(row.changedAt, appLocale),
|
|
69
70
|
},
|
|
70
|
-
})), [tenantRows]);
|
|
71
|
+
})), [tenantRows, appLocale]);
|
|
71
72
|
const openRow = (row, mode) => {
|
|
72
73
|
const found = tenantRows.find((candidate) => candidate.tenantId === row.id);
|
|
73
74
|
if (found !== undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-document-designer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.409.0",
|
|
4
4
|
"description": "Document designer for Kumiko: template overview, layout editor (mail layout, PDF letterhead) and the PDF template editor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"./web/styles.css": "./src/web/styles.css"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
24
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
25
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
26
|
-
"@cosmicdrift/kumiko-renderer-puppeteer-client": "0.
|
|
27
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
23
|
+
"@cosmicdrift/kumiko-bundled-features": "0.409.0",
|
|
24
|
+
"@cosmicdrift/kumiko-framework": "0.409.0",
|
|
25
|
+
"@cosmicdrift/kumiko-renderer": "0.409.0",
|
|
26
|
+
"@cosmicdrift/kumiko-renderer-puppeteer-client": "0.409.0",
|
|
27
|
+
"@cosmicdrift/kumiko-types": "0.409.0",
|
|
28
28
|
"react": "^19.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.409.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "Template dates use the active app locale",
|
|
6
|
+
"detail": "The modified-at dates in the template list, the origin bar, the version list and the overrides drawer are formatted with the active app locale instead of the browser default."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.397.0",
|
|
4
10
|
"type": "fix",
|