@protobase/ui 0.25.1 → 0.25.3
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/account/account-pages.js +3 -2
- package/dist/account/account-security-page.js +9 -4
- package/dist/account/backup-codes.js +7 -6
- package/dist/account/messages.js +214 -0
- package/dist/account/passkeys-section.js +23 -22
- package/dist/account/password-dialog.js +3 -2
- package/dist/account/sign-in-policy-form.js +11 -10
- package/dist/account/sign-in-policy-labels.js +30 -29
- package/dist/account/sign-in-policy-page.js +11 -6
- package/dist/account/sign-in-providers-section.js +6 -5
- package/dist/account/staff-sign-in-log.js +11 -10
- package/dist/account/totp-qr.js +2 -1
- package/dist/account/two-factor-section.js +24 -23
- package/dist/account/two-factor-setup.js +18 -17
- package/dist/action-card/action-card.js +2 -1
- package/dist/action-card/messages.js +8 -0
- package/dist/activity-chart/activity-chart.js +3 -2
- package/dist/activity-chart/messages.js +14 -0
- package/dist/app/app.d.ts +1 -1
- package/dist/app/app.js +20 -21
- package/dist/app/assistant-shell.js +2 -1
- package/dist/app/batch-failure.js +2 -1
- package/dist/app/breadcrumb-for.js +4 -3
- package/dist/app/charts/chart-groups.js +3 -2
- package/dist/app/charts/chart-view.js +3 -2
- package/dist/app/charts/group-bars.js +2 -1
- package/dist/app/charts/messages.js +26 -0
- package/dist/app/charts/period-chart.js +3 -2
- package/dist/app/charts/split-points.js +2 -1
- package/dist/app/comments/comment-composer.js +19 -18
- package/dist/app/comments/comments-section.js +4 -3
- package/dist/app/comments/messages.js +26 -0
- package/dist/app/create/create-page.js +11 -18
- package/dist/app/custom-section.js +4 -6
- package/dist/app/displays/board-column.js +6 -5
- package/dist/app/displays/board-columns.js +3 -2
- package/dist/app/displays/board-display.js +13 -15
- package/dist/app/displays/calendar-controls.js +3 -2
- package/dist/app/displays/calendar-display.js +12 -17
- package/dist/app/displays/card-carousel.js +4 -3
- package/dist/app/displays/cards-display.js +2 -1
- package/dist/app/displays/custom-display.js +4 -6
- package/dist/app/displays/display-frame.js +3 -2
- package/dist/app/displays/list-cards.js +5 -8
- package/dist/app/displays/list-displays.js +3 -3
- package/dist/app/displays/map-display.js +15 -14
- package/dist/app/displays/messages.js +128 -2
- package/dist/app/displays/period-controls.js +4 -3
- package/dist/app/displays/record-card.js +7 -6
- package/dist/app/displays/timeline-display.js +17 -26
- package/dist/app/displays/timeline-range.js +2 -1
- package/dist/app/displays/use-board-move.js +2 -2
- package/dist/app/displays/use-calendar-move.js +2 -1
- package/dist/app/document-title.js +2 -1
- package/dist/app/export/builder-port.js +2 -1
- package/dist/app/export/export-dialog.js +36 -40
- package/dist/app/export/export-worker.js +2 -0
- package/dist/app/export/messages.js +78 -0
- package/dist/app/export/run-export.js +5 -2
- package/dist/app/export/sink.js +4 -3
- package/dist/app/export/use-export-flow.js +4 -3
- package/dist/app/field-editor.js +4 -3
- package/dist/app/field-types/messages.js +8 -0
- package/dist/app/field-types/widget-part.js +2 -1
- package/dist/app/file-field.js +11 -14
- package/dist/app/gallery/gallery-section.js +4 -3
- package/dist/app/gallery/lightbox.js +5 -4
- package/dist/app/gallery/messages.js +30 -0
- package/dist/app/gallery/photo-details.js +3 -2
- package/dist/app/hand-order/hand-sorted-list.js +3 -6
- package/dist/app/hand-order/messages.js +4 -2
- package/dist/app/history/describe-change.js +3 -8
- package/dist/app/history/messages.js +32 -0
- package/dist/app/import/convert.js +20 -19
- package/dist/app/import/failed-rows.js +3 -2
- package/dist/app/import/import-button.js +2 -1
- package/dist/app/import/import-check-step.js +19 -35
- package/dist/app/import/import-dialog.js +13 -17
- package/dist/app/import/import-file-step.js +5 -9
- package/dist/app/import/import-mapping-step.js +32 -35
- package/dist/app/import/import-result-step.js +13 -12
- package/dist/app/import/messages.js +200 -0
- package/dist/app/import/parse-worker.js +2 -0
- package/dist/app/import/prepare-rows.js +5 -4
- package/dist/app/import/sheet-cell.js +2 -1
- package/dist/app/import/sheet-file.js +3 -2
- package/dist/app/import/sheet-source.js +7 -3
- package/dist/app/import/xlsx-reader.js +4 -3
- package/dist/app/import/xlsx-xml.js +2 -1
- package/dist/app/import/zip-reader.js +4 -3
- package/dist/app/list-edit/use-list-edits.js +1 -1
- package/dist/app/list-group-chart.js +2 -1
- package/dist/app/list-page.js +1 -1
- package/dist/app/map/map-layer-switch.js +3 -2
- package/dist/app/map/messages.js +14 -0
- package/dist/app/messages.js +116 -2
- package/dist/app/meta-gate.js +1 -1
- package/dist/app/nav-from-meta.js +11 -10
- package/dist/app/pages/action-inputs/action-inputs-dialog.js +3 -2
- package/dist/app/pages/action-inputs/input-answers.js +6 -5
- package/dist/app/pages/blocks/card-row.js +3 -2
- package/dist/app/pages/blocks/modal-form.js +5 -4
- package/dist/app/pages/blocks/record-card.js +3 -2
- package/dist/app/pages/blocks/stat.js +2 -1
- package/dist/app/pages/composed-page.js +6 -8
- package/dist/app/pages/confirm-action.js +2 -1
- package/dist/app/pages/custom-boundary.js +4 -2
- package/dist/app/pages/messages.js +64 -0
- package/dist/app/pages/render-node.js +5 -7
- package/dist/app/pages/use-run-action.js +11 -10
- package/dist/app/record-page.js +1 -1
- package/dist/app/record-row/messages.js +26 -0
- package/dist/app/record-row/record-row-body.js +12 -7
- package/dist/app/record-row/record-row.js +4 -3
- package/dist/app/record-row/saved-record-row.js +3 -2
- package/dist/app/related-dots/dots-summary.js +2 -1
- package/dist/app/related-dots/messages.js +8 -0
- package/dist/app/relation-picker.js +9 -8
- package/dist/app/router.js +5 -4
- package/dist/app/runtime/messages.js +58 -0
- package/dist/app/runtime/runtime-status.js +10 -23
- package/dist/app/runtime/runtime-update-dialog.js +7 -6
- package/dist/app/runtime/runtime-update.js +4 -3
- package/dist/app/saved/favorite-button.js +2 -1
- package/dist/app/saved/messages.js +22 -0
- package/dist/app/saved/saved-list.js +4 -7
- package/dist/app/saved/use-favorite.js +3 -2
- package/dist/app/search/messages.js +6 -2
- package/dist/app/search/navigation-hits.js +9 -7
- package/dist/app/searches/filter-chip-list.js +2 -1
- package/dist/app/searches/messages.js +96 -0
- package/dist/app/searches/save-search-button.js +5 -4
- package/dist/app/searches/saved-search-rows.js +3 -2
- package/dist/app/searches/saved-search-section.js +6 -5
- package/dist/app/searches/saved-search.js +4 -3
- package/dist/app/searches/saved-searches.js +15 -25
- package/dist/app/searches/search-controls.js +5 -4
- package/dist/app/searches/search-diff.js +4 -2
- package/dist/app/searches/search-name-dialog.js +4 -3
- package/dist/app/searches/update-search-dialog.js +15 -30
- package/dist/app/searches/use-save-search.js +8 -7
- package/dist/app/searches/use-search-row.js +4 -3
- package/dist/app/sensitive-field.js +5 -4
- package/dist/app/source-notice.js +13 -8
- package/dist/app/staff-banner.js +12 -19
- package/dist/app-shell/global-search.js +2 -2
- package/dist/app-shell/messages.js +4 -2
- package/dist/assistant-dock/assistant-dock.js +5 -5
- package/dist/assistant-dock/messages.js +26 -0
- package/dist/assistant-dock/use-assistant.js +2 -1
- package/dist/assistant-dock/use-backend-data.js +2 -1
- package/dist/assistant-dock/widget-view.js +3 -2
- package/dist/auth/auth-gate.js +10 -5
- package/dist/auth/auth-locale.js +14 -0
- package/dist/auth/auth-messages.js +122 -43
- package/dist/auth/auth-provider.js +6 -1
- package/dist/auth/code-form.js +2 -1
- package/dist/auth/email-code-form.js +11 -13
- package/dist/auth/email-code-page.js +2 -1
- package/dist/auth/first-run-page.js +6 -5
- package/dist/auth/forgot-password-form.js +14 -16
- package/dist/auth/forgot-password-page.js +2 -1
- package/dist/auth/messages.js +200 -0
- package/dist/auth/provider-sign-in-page.js +5 -5
- package/dist/auth/resend-code-button.js +2 -1
- package/dist/auth/reset-password-form.js +11 -10
- package/dist/auth/reset-password-page.js +4 -3
- package/dist/auth/setup-required-form.js +7 -9
- package/dist/auth/setup-required-page.js +7 -2
- package/dist/auth/sign-in-form.js +15 -18
- package/dist/auth/sign-in-prompt.js +4 -3
- package/dist/auth/sign-up-code-form.js +11 -13
- package/dist/auth/sign-up-details-form.js +14 -21
- package/dist/auth/sign-up-email-form.js +8 -7
- package/dist/auth/sign-up-page.js +2 -1
- package/dist/auth/staff-sign-in-form.js +14 -17
- package/dist/auth/two-factor-form.js +17 -16
- package/dist/auth/user-to-shell.js +2 -1
- package/dist/chat/composer.js +8 -7
- package/dist/chat/messages.js +14 -0
- package/dist/compact-table/compact-table.js +4 -8
- package/dist/compact-table/messages.js +18 -0
- package/dist/data/meta-data.d.ts +1 -1
- package/dist/data/use-update-record.js +1 -1
- package/dist/inline-child-table/inline-child-table.js +12 -12
- package/dist/inline-child-table/line-row.js +10 -9
- package/dist/inline-child-table/messages.js +52 -0
- package/dist/inline-child-table/totals-footer.js +5 -8
- package/dist/invitations/invite-form.js +3 -2
- package/dist/invitations/link-notice.js +6 -4
- package/dist/invitations/messages.js +24 -0
- package/dist/invitations/pending-invitation-row.js +4 -3
- package/dist/lists/messages.js +8 -0
- package/dist/lists/paged-search-list.js +2 -1
- package/dist/locale/slotted.js +14 -0
- package/dist/markdown/markdown-editor.js +6 -5
- package/dist/markdown/messages.js +16 -0
- package/dist/organizations/all-organizations.js +6 -5
- package/dist/organizations/app-roles-picker.js +2 -1
- package/dist/organizations/invitation-page.js +39 -49
- package/dist/organizations/invitations-page.js +11 -10
- package/dist/organizations/members-page.js +15 -10
- package/dist/organizations/messages.js +180 -0
- package/dist/organizations/organization-page.js +27 -26
- package/dist/organizations/organization-paths.js +16 -13
- package/dist/organizations/organization-row.js +3 -2
- package/dist/organizations/organizations-page.js +17 -16
- package/dist/organizations/use-organizations.js +2 -1
- package/dist/package.js +1 -1
- package/dist/plugins/before-sign-in.js +6 -1
- package/dist/plugins/load-plugin.d.ts +1 -1
- package/dist/plugins/load-plugin.js +3 -2
- package/dist/plugins/messages.js +36 -0
- package/dist/plugins/plugin-gate.js +6 -1
- package/dist/plugins/plugin-manifest.js +8 -7
- package/dist/plugins/plugin-notice.js +8 -12
- package/dist/primitives/messages.js +16 -0
- package/dist/primitives/sheet.js +2 -1
- package/dist/primitives/spinner.js +2 -1
- package/dist/primitives/token.js +2 -1
- package/dist/record-view/messages.js +4 -2
- package/dist/record-view/record-tabs.js +2 -1
- package/dist/roles/messages.js +14 -0
- package/dist/roles/use-active-role.js +3 -2
- package/dist/shell/assets/app-CW3U56yM.js +69 -0
- package/dist/shell/assets/cn-Bi0ZEjD9.js +1 -0
- package/dist/shell/assets/export-worker-ClACk00b.js +2 -0
- package/dist/shell/assets/{index-BuKnJ48y.js → index-B7cIjCuz.js} +2 -2
- package/dist/shell/assets/maplibre-CVG5L9FD.js +814 -0
- package/dist/shell/assets/{markdown-content-CvNiaqsy.js → markdown-content-CtGUP4W6.js} +1 -1
- package/dist/shell/assets/parse-worker-UhbwEjS0.js +5 -0
- package/dist/shell/assets/preload-helper-BX9CcZkY.js +1 -0
- package/dist/shell/assets/{record-map-BmPHHEMK.js → record-map-Cw3_NcUl.js} +1 -1
- package/dist/shell/assets/records-map-D4f3ZeDL.js +1 -0
- package/dist/shell/assets/shared-protobase-ui-CB_i50NP.js +1 -0
- package/dist/shell/index.html +5 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/side-panel/messages.js +8 -0
- package/dist/side-panel/side-panel.js +2 -1
- package/dist/toasts/messages.js +8 -0
- package/dist/toasts/toast.js +2 -1
- package/dist/users/app-invitations.js +5 -4
- package/dist/users/create-user-form.js +9 -8
- package/dist/users/messages.js +52 -0
- package/dist/users/use-user-roles.js +2 -1
- package/dist/users/user-list.js +6 -5
- package/dist/users/user-row.js +5 -4
- package/package.json +4 -4
- package/dist/shell/assets/app-BPHSSo4E.js +0 -69
- package/dist/shell/assets/export-worker-Bz57Pf5g.js +0 -2
- package/dist/shell/assets/maplibre-C2VkKdp3.js +0 -814
- package/dist/shell/assets/parse-worker-BtcY0dQw.js +0 -5
- package/dist/shell/assets/records-map-BvUD1Fqc.js +0 -1
- package/dist/shell/assets/shared-protobase-ui-B-pEBDQf.js +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { humanize } from "../../live/naming.js";
|
|
2
2
|
import { allowEverything } from "../../data/meta-data.js";
|
|
3
|
+
import { text } from "../create/messages.js";
|
|
3
4
|
import { createOffered } from "../create/create-offered.js";
|
|
4
5
|
import { navFromMeta } from "../nav-from-meta.js";
|
|
6
|
+
import { text as text$1 } from "./messages.js";
|
|
5
7
|
import { appPath } from "@protobase/schema";
|
|
6
8
|
const matches = (label, text) => label.toLowerCase().includes(text.trim().toLowerCase());
|
|
7
9
|
/**
|
|
@@ -9,15 +11,15 @@ const matches = (label, text) => label.toLowerCase().includes(text.trim().toLowe
|
|
|
9
11
|
* Stock levels), and "New ..." for each resource the user may create whose name does ("new order" or "order" finds New
|
|
10
12
|
* order). Each is a link, as the sidebar's entries are.
|
|
11
13
|
*/
|
|
12
|
-
const navigationHits = (meta, text, basePath = "") => {
|
|
13
|
-
const pages = navFromMeta(meta, basePath).flatMap((group) => group.items.filter((item) => item.href !== void 0 && !item.problem)).filter((item) => matches(item.label, text)).slice(0, 5);
|
|
14
|
-
const asked = text.trim().replace(/^new\s+/i, "");
|
|
14
|
+
const navigationHits = (meta, text$2, basePath = "") => {
|
|
15
|
+
const pages = navFromMeta(meta, basePath).flatMap((group) => group.items.filter((item) => item.href !== void 0 && !item.problem)).filter((item) => matches(item.label, text$2)).slice(0, 5);
|
|
16
|
+
const asked = text$2.trim().replace(/^new\s+/i, "");
|
|
15
17
|
const creates = Object.values(meta.resources).flatMap((model) => {
|
|
16
18
|
const view = meta.views[model.name];
|
|
17
19
|
if (!view || view.nav?.hidden || !createOffered(view, meta.pages, meta.permissions[model.name] ?? allowEverything)) return [];
|
|
18
20
|
const singular = view.names?.singular ?? humanize(model.name);
|
|
19
|
-
const label =
|
|
20
|
-
if (!matches(label, text) && !matches(singular, asked) && !matches(view.names?.plural ?? humanize(model.name), asked)) return [];
|
|
21
|
+
const label = text("title", singular);
|
|
22
|
+
if (!matches(label, text$2) && !matches(singular, asked) && !matches(view.names?.plural ?? humanize(model.name), asked)) return [];
|
|
21
23
|
return [{
|
|
22
24
|
id: `new:${model.name}`,
|
|
23
25
|
title: label,
|
|
@@ -29,7 +31,7 @@ const navigationHits = (meta, text, basePath = "") => {
|
|
|
29
31
|
});
|
|
30
32
|
return [...pages.length > 0 ? [{
|
|
31
33
|
id: "go-to",
|
|
32
|
-
label: "
|
|
34
|
+
label: text$1("goTo"),
|
|
33
35
|
hits: pages.map((item) => ({
|
|
34
36
|
id: `go-to:${item.id}`,
|
|
35
37
|
title: item.label,
|
|
@@ -37,7 +39,7 @@ const navigationHits = (meta, text, basePath = "") => {
|
|
|
37
39
|
}))
|
|
38
40
|
}] : [], ...creates.length > 0 ? [{
|
|
39
41
|
id: "create",
|
|
40
|
-
label: "
|
|
42
|
+
label: text$1("create"),
|
|
41
43
|
hits: creates.slice(0, 5)
|
|
42
44
|
}] : []];
|
|
43
45
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/app/searches/filter-chip-list.tsx
|
|
4
5
|
const chipClass = "inline-flex h-6 items-center rounded-full border border-primary-border bg-primary-soft px-2.5 text-xs font-medium text-primary-text";
|
|
5
6
|
/** What a filter filters on, concisely: its chips as a list labelled "Filters". */
|
|
6
7
|
const FilterChipList = ({ chips, className }) => /* @__PURE__ */ jsx("ul", {
|
|
7
8
|
className: cn("flex flex-wrap gap-1.5", className),
|
|
8
|
-
"aria-label": "
|
|
9
|
+
"aria-label": text("filters"),
|
|
9
10
|
children: chips.map((chip) => /* @__PURE__ */ jsx("li", {
|
|
10
11
|
className: chipClass,
|
|
11
12
|
children: chip.label
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineMessages } from "../../locale/messages.js";
|
|
2
|
+
//#region src/app/searches/messages.ts
|
|
3
|
+
const text = defineMessages({
|
|
4
|
+
en: {
|
|
5
|
+
saveSearch: "Save search",
|
|
6
|
+
saveAsNew: (noun) => `Save as new ${noun}`,
|
|
7
|
+
updateName: (name) => `Update ${name}`,
|
|
8
|
+
updateNameQuestion: (name) => `Update ${name}?`,
|
|
9
|
+
updateNounQuestion: (noun) => `Update this ${noun}?`,
|
|
10
|
+
couldNotLoadYour: (plural) => `Could not load your ${plural}`,
|
|
11
|
+
noneYet: (plural) => `No ${plural} yet.`,
|
|
12
|
+
somethingWrong: "Something went wrong",
|
|
13
|
+
couldNotRename: "Could not rename the search",
|
|
14
|
+
renameTitle: (title) => `Rename ${title}`,
|
|
15
|
+
deleteTitle: (title) => `Delete ${title}`,
|
|
16
|
+
unreadableFilter: "A filter that cannot be read",
|
|
17
|
+
notFound: "Not found",
|
|
18
|
+
noResource: "There is no resource called {}.",
|
|
19
|
+
noSavedYet: (plural) => `No ${plural} yet. Filter the {} and save the search.`,
|
|
20
|
+
on: "On",
|
|
21
|
+
off: "Off",
|
|
22
|
+
saved: (title) => `${title} saved`,
|
|
23
|
+
couldNotChange: "Could not change the search",
|
|
24
|
+
asMany: (plural) => `As many ${plural}`,
|
|
25
|
+
more: (count, noun) => `${count} more ${noun}`,
|
|
26
|
+
fewer: (count, noun) => `${count} fewer ${noun}`,
|
|
27
|
+
cancel: "Cancel",
|
|
28
|
+
save: "Save",
|
|
29
|
+
optional: "Optional",
|
|
30
|
+
added: "Added",
|
|
31
|
+
removed: "Removed",
|
|
32
|
+
changed: "Changed",
|
|
33
|
+
filterChanges: "Filter changes",
|
|
34
|
+
firstOf: (limit, total) => `The first ${limit} of ${total}.`,
|
|
35
|
+
noPlural: (plural) => `No ${plural}.`,
|
|
36
|
+
update: "Update",
|
|
37
|
+
addedRemoved: (added, removed) => `${added} added, ${removed} removed`,
|
|
38
|
+
searchSaved: "Search saved",
|
|
39
|
+
openPlural: (plural) => `Open ${plural.toLowerCase()}`,
|
|
40
|
+
couldNotSave: "Could not save the search",
|
|
41
|
+
couldNotTakeOff: "Could not take the search off",
|
|
42
|
+
searchUpdated: "Search updated",
|
|
43
|
+
couldNotUpdate: "Could not update the search",
|
|
44
|
+
noneMatch: (plural) => `No ${plural} match.`,
|
|
45
|
+
noNew: (plural) => `No new ${plural} since you last looked.`,
|
|
46
|
+
viewAll: "View all results",
|
|
47
|
+
filters: "Filters"
|
|
48
|
+
},
|
|
49
|
+
nl: {
|
|
50
|
+
saveSearch: "Zoekopdracht bewaren",
|
|
51
|
+
saveAsNew: (noun) => `Als extra ${noun} bewaren`,
|
|
52
|
+
updateName: (name) => `${name} bijwerken`,
|
|
53
|
+
updateNameQuestion: (name) => `${name} bijwerken?`,
|
|
54
|
+
updateNounQuestion: (noun) => `${noun} bijwerken?`,
|
|
55
|
+
couldNotLoadYour: (plural) => `Kon je ${plural} niet laden`,
|
|
56
|
+
noneYet: (plural) => `Nog geen ${plural}.`,
|
|
57
|
+
somethingWrong: "Er ging iets mis",
|
|
58
|
+
couldNotRename: "Kon de zoekopdracht niet hernoemen",
|
|
59
|
+
renameTitle: (title) => `${title} hernoemen`,
|
|
60
|
+
deleteTitle: (title) => `${title} verwijderen`,
|
|
61
|
+
unreadableFilter: "Een filter dat niet kan worden gelezen",
|
|
62
|
+
notFound: "Niet gevonden",
|
|
63
|
+
noResource: "Er is geen onderdeel met de naam {}.",
|
|
64
|
+
noSavedYet: (plural) => `Nog geen ${plural}. Filter de {} en bewaar de zoekopdracht.`,
|
|
65
|
+
on: "Aan",
|
|
66
|
+
off: "Uit",
|
|
67
|
+
saved: (title) => `${title} bewaard`,
|
|
68
|
+
couldNotChange: "Kon de zoekopdracht niet wijzigen",
|
|
69
|
+
asMany: (plural) => `Evenveel ${plural}`,
|
|
70
|
+
more: (count, noun) => `${count} ${noun} meer`,
|
|
71
|
+
fewer: (count, noun) => `${count} ${noun} minder`,
|
|
72
|
+
cancel: "Annuleren",
|
|
73
|
+
save: "Bewaren",
|
|
74
|
+
optional: "Optioneel",
|
|
75
|
+
added: "Erbij",
|
|
76
|
+
removed: "Eraf",
|
|
77
|
+
changed: "Gewijzigd",
|
|
78
|
+
filterChanges: "Wijzigingen in het filter",
|
|
79
|
+
firstOf: (limit, total) => `De eerste ${limit} van ${total}.`,
|
|
80
|
+
noPlural: (plural) => `Geen ${plural}.`,
|
|
81
|
+
update: "Bijwerken",
|
|
82
|
+
addedRemoved: (added, removed) => `${added} erbij, ${removed} eraf`,
|
|
83
|
+
searchSaved: "Zoekopdracht bewaard",
|
|
84
|
+
openPlural: (plural) => `${plural} openen`,
|
|
85
|
+
couldNotSave: "Kon de zoekopdracht niet bewaren",
|
|
86
|
+
couldNotTakeOff: "Kon de zoekopdracht niet weghalen",
|
|
87
|
+
searchUpdated: "Zoekopdracht bijgewerkt",
|
|
88
|
+
couldNotUpdate: "Kon de zoekopdracht niet bijwerken",
|
|
89
|
+
noneMatch: (plural) => `Geen ${plural} gevonden.`,
|
|
90
|
+
noNew: (plural) => `Geen nieuwe ${plural} sinds je laatst keek.`,
|
|
91
|
+
viewAll: "Alle resultaten bekijken",
|
|
92
|
+
filters: "Filters"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
//#endregion
|
|
96
|
+
export { text };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Button } from "../../primitives/button.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
2
3
|
import { SignInPrompt } from "../../auth/sign-in-prompt.js";
|
|
3
4
|
import { SearchNameDialog } from "./search-name-dialog.js";
|
|
4
5
|
import { UpdateSearchDialog } from "./update-search-dialog.js";
|
|
@@ -19,7 +20,7 @@ const SaveSearchButton = ({ model, view, search, filter, chips, className }) =>
|
|
|
19
20
|
const [confirming, setConfirming] = useState(false);
|
|
20
21
|
const [naming, setNaming] = useState();
|
|
21
22
|
if (!state.mode) return null;
|
|
22
|
-
const label = search.label ?? "
|
|
23
|
+
const label = search.label ?? text("saveSearch");
|
|
23
24
|
if (state.mode === "sign-in") return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
24
25
|
className,
|
|
25
26
|
"aria-haspopup": "dialog",
|
|
@@ -50,7 +51,7 @@ const SaveSearchButton = ({ model, view, search, filter, chips, className }) =>
|
|
|
50
51
|
});
|
|
51
52
|
const opened = state.opened;
|
|
52
53
|
if (opened) {
|
|
53
|
-
const saveNewLabel =
|
|
54
|
+
const saveNewLabel = text("saveAsNew", state.noun);
|
|
54
55
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
55
56
|
/* @__PURE__ */ jsxs(Button, {
|
|
56
57
|
className,
|
|
@@ -62,7 +63,7 @@ const SaveSearchButton = ({ model, view, search, filter, chips, className }) =>
|
|
|
62
63
|
"aria-hidden": true
|
|
63
64
|
}), /* @__PURE__ */ jsx("span", {
|
|
64
65
|
className: "max-w-60 truncate",
|
|
65
|
-
children:
|
|
66
|
+
children: text("updateName", opened.name ?? state.noun)
|
|
66
67
|
})]
|
|
67
68
|
}),
|
|
68
69
|
/* @__PURE__ */ jsxs(Button, {
|
|
@@ -78,7 +79,7 @@ const SaveSearchButton = ({ model, view, search, filter, chips, className }) =>
|
|
|
78
79
|
confirming && /* @__PURE__ */ jsx(UpdateSearchDialog, {
|
|
79
80
|
model,
|
|
80
81
|
view,
|
|
81
|
-
title: opened.name ?
|
|
82
|
+
title: opened.name ? text("updateNameQuestion", opened.name) : text("updateNounQuestion", state.noun),
|
|
82
83
|
before: opened.filter,
|
|
83
84
|
after: filter,
|
|
84
85
|
saveNewLabel,
|
|
@@ -4,6 +4,7 @@ import { recordKey } from "../../live/model-helpers.js";
|
|
|
4
4
|
import { useAdminMeta } from "../meta-gate.js";
|
|
5
5
|
import { AppLink } from "../use-app-address.js";
|
|
6
6
|
import { ErrorBanner } from "../error-banner.js";
|
|
7
|
+
import { text } from "./messages.js";
|
|
7
8
|
import { InlineFilterChips } from "./filter-chip-list.js";
|
|
8
9
|
import { RecordRowBody } from "../record-row/record-row-body.js";
|
|
9
10
|
import { useSavedSearches } from "./use-saved-searches.js";
|
|
@@ -50,13 +51,13 @@ const SavedSearchRows = ({ model, view, empty }) => {
|
|
|
50
51
|
const plural = (view.names?.plural ?? humanize(model.name)).toLowerCase();
|
|
51
52
|
if (!target) return null;
|
|
52
53
|
if (saved.error) return /* @__PURE__ */ jsx(ErrorBanner, {
|
|
53
|
-
title:
|
|
54
|
+
title: text("couldNotLoadYour", plural),
|
|
54
55
|
error: saved.error
|
|
55
56
|
});
|
|
56
57
|
if (!saved.data) return /* @__PURE__ */ jsx(Skeleton, { className: "h-40" });
|
|
57
58
|
if (saved.data.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
58
59
|
className: "text-muted-foreground",
|
|
59
|
-
children: empty ??
|
|
60
|
+
children: empty ?? text("noneYet", plural)
|
|
60
61
|
});
|
|
61
62
|
return /* @__PURE__ */ jsx("div", {
|
|
62
63
|
className: "flex flex-col divide-y",
|
|
@@ -4,6 +4,7 @@ import { humanize } from "../../live/naming.js";
|
|
|
4
4
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
5
5
|
import { AppLink } from "../use-app-address.js";
|
|
6
6
|
import { useRefreshResource } from "../pages/use-layout-data.js";
|
|
7
|
+
import { text } from "./messages.js";
|
|
7
8
|
import { InlineFilterChips } from "./filter-chip-list.js";
|
|
8
9
|
import { RecordRowBody } from "../record-row/record-row-body.js";
|
|
9
10
|
import { useSearchRow } from "./use-search-row.js";
|
|
@@ -14,7 +15,7 @@ import { Pencil, Trash2 } from "lucide-react";
|
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { useMutation } from "@tanstack/react-query";
|
|
16
17
|
//#region src/app/searches/saved-search-section.tsx
|
|
17
|
-
const message = (error) => error instanceof Error ? error.message : "
|
|
18
|
+
const message = (error) => error instanceof Error ? error.message : text("somethingWrong");
|
|
18
19
|
/**
|
|
19
20
|
* One saved search on its list page: its name when it has one, and what it filters on as chips, which are its title
|
|
20
21
|
* when it has none; its controls, rename and delete; and the records it finds in a row of their cards that scrolls
|
|
@@ -38,7 +39,7 @@ const SavedSearchSection = ({ model, view, of, target, targetView, row, recordKe
|
|
|
38
39
|
onSuccess: () => setRenaming(false),
|
|
39
40
|
onError: (error) => toast.show({
|
|
40
41
|
state: "error",
|
|
41
|
-
title: "
|
|
42
|
+
title: text("couldNotRename"),
|
|
42
43
|
description: message(error)
|
|
43
44
|
}),
|
|
44
45
|
onSettled: () => refresh(model.name)
|
|
@@ -77,7 +78,7 @@ const SavedSearchSection = ({ model, view, of, target, targetView, row, recordKe
|
|
|
77
78
|
}),
|
|
78
79
|
canRename && nameField && /* @__PURE__ */ jsx(Button, {
|
|
79
80
|
variant: "ghost",
|
|
80
|
-
"aria-label":
|
|
81
|
+
"aria-label": text("renameTitle", title),
|
|
81
82
|
"aria-haspopup": "dialog",
|
|
82
83
|
onClick: () => setRenaming(true),
|
|
83
84
|
children: /* @__PURE__ */ jsx(Pencil, {
|
|
@@ -87,7 +88,7 @@ const SavedSearchSection = ({ model, view, of, target, targetView, row, recordKe
|
|
|
87
88
|
}),
|
|
88
89
|
onDelete && /* @__PURE__ */ jsx(Button, {
|
|
89
90
|
variant: "ghost",
|
|
90
|
-
"aria-label":
|
|
91
|
+
"aria-label": text("deleteTitle", title),
|
|
91
92
|
onClick: () => onDelete(title),
|
|
92
93
|
children: /* @__PURE__ */ jsx(Trash2, {
|
|
93
94
|
className: "size-3.5",
|
|
@@ -98,7 +99,7 @@ const SavedSearchSection = ({ model, view, of, target, targetView, row, recordKe
|
|
|
98
99
|
})]
|
|
99
100
|
}),
|
|
100
101
|
renaming && nameField && /* @__PURE__ */ jsx(SearchNameDialog, {
|
|
101
|
-
title:
|
|
102
|
+
title: text("renameTitle", title),
|
|
102
103
|
chips,
|
|
103
104
|
label: view.fields[nameField.name]?.label ?? humanize(nameField.name),
|
|
104
105
|
required: !nameField.nullable,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { humanize } from "../../live/naming.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
2
3
|
import { activeChips } from "../../filter-panel/filter-state.js";
|
|
3
4
|
import { textToState } from "../../live/filter-string.js";
|
|
4
5
|
import { rangeFormat, widgetFields } from "../../live/view-fields.js";
|
|
@@ -55,12 +56,12 @@ const namedConfig = (model, view, names) => {
|
|
|
55
56
|
* A saved filter as the chips the list page shows for it, then a chip per condition no widget holds: the search text
|
|
56
57
|
* in quotes, or the condition as written. One chip saying so when the filter cannot be read.
|
|
57
58
|
*/
|
|
58
|
-
const filterChips = (model, view, text, names = {}) => {
|
|
59
|
+
const filterChips = (model, view, text$1, names = {}) => {
|
|
59
60
|
const config = namedConfig(model, view, names);
|
|
60
|
-
const parsed = textToState(config, text);
|
|
61
|
+
const parsed = textToState(config, text$1);
|
|
61
62
|
if (!parsed.ok) return [{
|
|
62
63
|
key: "unreadable",
|
|
63
|
-
label: "
|
|
64
|
+
label: text("unreadableFilter")
|
|
64
65
|
}];
|
|
65
66
|
const extras = parsed.extras.map((clause, index) => ({
|
|
66
67
|
key: `extra:${index}`,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
2
|
import { PageHeader } from "../../app-shell/page-header.js";
|
|
3
|
+
import { slotted } from "../../locale/slotted.js";
|
|
3
4
|
import { humanize } from "../../live/naming.js";
|
|
4
5
|
import { recordKey } from "../../live/model-helpers.js";
|
|
5
6
|
import { Notice, useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
6
7
|
import { AppLink } from "../use-app-address.js";
|
|
7
8
|
import { ErrorBanner } from "../error-banner.js";
|
|
8
9
|
import { can } from "../permissions.js";
|
|
10
|
+
import { text } from "./messages.js";
|
|
9
11
|
import { useSavedSearches } from "./use-saved-searches.js";
|
|
10
12
|
import { useDeleteFlow } from "../delete/use-delete-flow.js";
|
|
11
13
|
import { SavedSearchSection } from "./saved-search-section.js";
|
|
@@ -39,16 +41,12 @@ const SavedSearches = ({ model, view }) => {
|
|
|
39
41
|
body
|
|
40
42
|
]
|
|
41
43
|
});
|
|
42
|
-
if (!target) return frame(/* @__PURE__ */
|
|
43
|
-
title: "
|
|
44
|
-
children:
|
|
45
|
-
"There is no resource called ",
|
|
46
|
-
of.resource,
|
|
47
|
-
"."
|
|
48
|
-
]
|
|
44
|
+
if (!target) return frame(/* @__PURE__ */ jsx(Notice, {
|
|
45
|
+
title: text("notFound"),
|
|
46
|
+
children: slotted(text("noResource"), of.resource)
|
|
49
47
|
}));
|
|
50
48
|
if (saved.error) return frame(/* @__PURE__ */ jsx(ErrorBanner, {
|
|
51
|
-
title:
|
|
49
|
+
title: text("couldNotLoadYour", plural.toLowerCase()),
|
|
52
50
|
error: saved.error
|
|
53
51
|
}));
|
|
54
52
|
if (!saved.data) return frame(/* @__PURE__ */ jsx("div", {
|
|
@@ -57,24 +55,16 @@ const SavedSearches = ({ model, view }) => {
|
|
|
57
55
|
}));
|
|
58
56
|
if (saved.data.length === 0) {
|
|
59
57
|
const searched = (targetView?.names?.plural ?? humanize(target.name)).toLowerCase();
|
|
60
|
-
return frame(/* @__PURE__ */
|
|
58
|
+
return frame(/* @__PURE__ */ jsx("p", {
|
|
61
59
|
className: "py-8 text-center text-muted-foreground",
|
|
62
|
-
children:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resource: target.name
|
|
71
|
-
},
|
|
72
|
-
className: "font-medium text-primary-text hover:underline",
|
|
73
|
-
children: searched
|
|
74
|
-
}),
|
|
75
|
-
" ",
|
|
76
|
-
"and save the search."
|
|
77
|
-
]
|
|
60
|
+
children: slotted(text("noSavedYet", plural.toLowerCase()), /* @__PURE__ */ jsx(AppLink, {
|
|
61
|
+
to: {
|
|
62
|
+
kind: "list",
|
|
63
|
+
resource: target.name
|
|
64
|
+
},
|
|
65
|
+
className: "font-medium text-primary-text hover:underline",
|
|
66
|
+
children: searched
|
|
67
|
+
}))
|
|
78
68
|
}));
|
|
79
69
|
}
|
|
80
70
|
return frame(/* @__PURE__ */ jsx("div", {
|
|
@@ -3,12 +3,13 @@ import { humanize } from "../../live/naming.js";
|
|
|
3
3
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
4
4
|
import { Switch } from "../../primitives/switch.js";
|
|
5
5
|
import { useRefreshResource } from "../pages/use-layout-data.js";
|
|
6
|
+
import { text } from "./messages.js";
|
|
6
7
|
import { useId } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useMutation } from "@tanstack/react-query";
|
|
9
10
|
import { enumLabel } from "@protobase/schema";
|
|
10
11
|
//#region src/app/searches/search-controls.tsx
|
|
11
|
-
const message = (error) => error instanceof Error ? error.message : "
|
|
12
|
+
const message = (error) => error instanceof Error ? error.message : text("somethingWrong");
|
|
12
13
|
const Control = ({ model, view, name, value, onChange }) => {
|
|
13
14
|
const id = useId();
|
|
14
15
|
const field = model.fields[name];
|
|
@@ -36,7 +37,7 @@ const Control = ({ model, view, name, value, onChange }) => {
|
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
39
|
const changed = (model, view, patch) => Object.entries(patch).map(([name, value]) => {
|
|
39
|
-
return `${view.fields[name]?.label ?? humanize(name)}: ${model.fields[name]?.type === "boolean" ? value === true ? "
|
|
40
|
+
return `${view.fields[name]?.label ?? humanize(name)}: ${model.fields[name]?.type === "boolean" ? value === true ? text("on") : text("off") : enumLabel(String(value), view.fields[name]?.valueLabels)}`;
|
|
40
41
|
}).join(", ");
|
|
41
42
|
/**
|
|
42
43
|
* A saved search's controls, each saved as soon as it changes, which a toast confirms; a refused change says why and shows
|
|
@@ -50,12 +51,12 @@ const SearchControls = ({ model, view, recordKey, title, row, fields }) => {
|
|
|
50
51
|
mutationFn: (patch) => client.update(model.name, recordKey, patch, row.etag ?? "*"),
|
|
51
52
|
onSuccess: (_, patch) => toast.show({
|
|
52
53
|
state: "success",
|
|
53
|
-
title:
|
|
54
|
+
title: text("saved", title),
|
|
54
55
|
description: changed(model, view, patch)
|
|
55
56
|
}),
|
|
56
57
|
onError: (error) => toast.show({
|
|
57
58
|
state: "error",
|
|
58
|
-
title: "
|
|
59
|
+
title: text("couldNotChange"),
|
|
59
60
|
description: message(error)
|
|
60
61
|
}),
|
|
61
62
|
onSettled: () => refresh(model.name)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { createWhere, parseFilter, printFilter } from "@protobase/schema";
|
|
2
3
|
//#region src/app/searches/search-diff.ts
|
|
3
4
|
const where$1 = createWhere();
|
|
@@ -90,8 +91,9 @@ const filterChanges = (before, after) => {
|
|
|
90
91
|
/** The net change in the records a search finds: "5 more homes", "1 fewer home" or "As many homes". */
|
|
91
92
|
const netChange = (added, removed, singular, plural) => {
|
|
92
93
|
const net = added - removed;
|
|
93
|
-
if (net === 0) return
|
|
94
|
-
|
|
94
|
+
if (net === 0) return text("asMany", plural);
|
|
95
|
+
const noun = Math.abs(net) === 1 ? singular : plural;
|
|
96
|
+
return net > 0 ? text("more", net, noun) : text("fewer", -net, noun);
|
|
95
97
|
};
|
|
96
98
|
//#endregion
|
|
97
99
|
export { addedFilter, filterChanges, netChange, removedFilter };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Input } from "../../primitives/input.js";
|
|
2
2
|
import { Button } from "../../primitives/button.js";
|
|
3
3
|
import { ResponsiveDialog } from "../../primitives/responsive-dialog.js";
|
|
4
|
+
import { text } from "./messages.js";
|
|
4
5
|
import { FilterChipList } from "./filter-chip-list.js";
|
|
5
6
|
import { useId, useState } from "react";
|
|
6
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -16,13 +17,13 @@ const SearchNameDialog = ({ title, chips, label, required, initial = "", busy, o
|
|
|
16
17
|
onClose,
|
|
17
18
|
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
18
19
|
onClick: onClose,
|
|
19
|
-
children: "
|
|
20
|
+
children: text("cancel")
|
|
20
21
|
}), /* @__PURE__ */ jsx(Button, {
|
|
21
22
|
type: "submit",
|
|
22
23
|
form: formId,
|
|
23
24
|
variant: "primary",
|
|
24
25
|
loading: busy,
|
|
25
|
-
children: "
|
|
26
|
+
children: text("save")
|
|
26
27
|
})] }),
|
|
27
28
|
children: /* @__PURE__ */ jsxs("form", {
|
|
28
29
|
id: formId,
|
|
@@ -42,7 +43,7 @@ const SearchNameDialog = ({ title, chips, label, required, initial = "", busy, o
|
|
|
42
43
|
}), !required && /* @__PURE__ */ jsx("span", {
|
|
43
44
|
id: `${id}-hint`,
|
|
44
45
|
className: "text-xs text-muted-foreground",
|
|
45
|
-
children: "
|
|
46
|
+
children: text("optional")
|
|
46
47
|
})]
|
|
47
48
|
}), /* @__PURE__ */ jsx(Input, {
|
|
48
49
|
id,
|
|
@@ -5,6 +5,7 @@ import { humanize } from "../../live/naming.js";
|
|
|
5
5
|
import { defaultOrderBy } from "../list-order.js";
|
|
6
6
|
import { ResponsiveDialog } from "../../primitives/responsive-dialog.js";
|
|
7
7
|
import { countQuery } from "../pages/use-layout-data.js";
|
|
8
|
+
import { text } from "./messages.js";
|
|
8
9
|
import { useFilterChips } from "./use-filter-chips.js";
|
|
9
10
|
import { EmbeddedList } from "../embedded-list/embedded-list.js";
|
|
10
11
|
import { addedFilter, filterChanges, netChange, removedFilter } from "./search-diff.js";
|
|
@@ -17,26 +18,26 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
17
18
|
const shownLimit = 12;
|
|
18
19
|
const changeStyle = {
|
|
19
20
|
added: {
|
|
20
|
-
word: "
|
|
21
|
+
word: "added",
|
|
21
22
|
className: "text-success-text"
|
|
22
23
|
},
|
|
23
24
|
removed: {
|
|
24
|
-
word: "
|
|
25
|
+
word: "removed",
|
|
25
26
|
className: "text-danger-text"
|
|
26
27
|
},
|
|
27
28
|
changed: {
|
|
28
|
-
word: "
|
|
29
|
+
word: "changed",
|
|
29
30
|
className: "text-primary-text"
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
const FilterChanges = ({ changes }) => /* @__PURE__ */ jsx("ul", {
|
|
33
|
-
"aria-label": "
|
|
34
|
+
"aria-label": text("filterChanges"),
|
|
34
35
|
className: "divide-y rounded-md border",
|
|
35
36
|
children: changes.map((change) => /* @__PURE__ */ jsxs("li", {
|
|
36
37
|
className: "grid grid-cols-[72px_1fr] gap-3 px-3 py-2",
|
|
37
38
|
children: [/* @__PURE__ */ jsx("span", {
|
|
38
39
|
className: `font-medium ${changeStyle[change.kind].className}`,
|
|
39
|
-
children: changeStyle[change.kind].word
|
|
40
|
+
children: text(changeStyle[change.kind].word)
|
|
40
41
|
}), change.kind === "changed" ? /* @__PURE__ */ jsxs("span", { children: [
|
|
41
42
|
/* @__PURE__ */ jsx("span", {
|
|
42
43
|
className: "text-muted-foreground line-through",
|
|
@@ -84,23 +85,13 @@ const RecordsSide = ({ model, view, title, filter, total, plural }) => {
|
|
|
84
85
|
})
|
|
85
86
|
]
|
|
86
87
|
}),
|
|
87
|
-
total !== void 0 && total > shownLimit && /* @__PURE__ */
|
|
88
|
+
total !== void 0 && total > shownLimit && /* @__PURE__ */ jsx("p", {
|
|
88
89
|
className: "text-xs text-muted-foreground",
|
|
89
|
-
children:
|
|
90
|
-
"The first ",
|
|
91
|
-
shownLimit,
|
|
92
|
-
" of ",
|
|
93
|
-
total,
|
|
94
|
-
"."
|
|
95
|
-
]
|
|
90
|
+
children: text("firstOf", shownLimit, total)
|
|
96
91
|
}),
|
|
97
|
-
filter === null || total === 0 ? /* @__PURE__ */
|
|
92
|
+
filter === null || total === 0 ? /* @__PURE__ */ jsx("p", {
|
|
98
93
|
className: "text-muted-foreground",
|
|
99
|
-
children:
|
|
100
|
-
"No ",
|
|
101
|
-
plural,
|
|
102
|
-
"."
|
|
103
|
-
]
|
|
94
|
+
children: text("noPlural", plural)
|
|
104
95
|
}) : /* @__PURE__ */ jsx(EmbeddedList, {
|
|
105
96
|
model,
|
|
106
97
|
view,
|
|
@@ -136,7 +127,7 @@ const UpdateSearchDialog = ({ model, view, title, before, after, saveNewLabel, u
|
|
|
136
127
|
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
137
128
|
/* @__PURE__ */ jsx(Button, {
|
|
138
129
|
onClick: onCancel,
|
|
139
|
-
children: "
|
|
130
|
+
children: text("cancel")
|
|
140
131
|
}),
|
|
141
132
|
/* @__PURE__ */ jsx(Button, {
|
|
142
133
|
loading: creating,
|
|
@@ -149,7 +140,7 @@ const UpdateSearchDialog = ({ model, view, title, before, after, saveNewLabel, u
|
|
|
149
140
|
loading: updating,
|
|
150
141
|
disabled: creating,
|
|
151
142
|
onClick: onUpdate,
|
|
152
|
-
children: "
|
|
143
|
+
children: text("update")
|
|
153
144
|
})
|
|
154
145
|
] }),
|
|
155
146
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -161,18 +152,12 @@ const UpdateSearchDialog = ({ model, view, title, before, after, saveNewLabel, u
|
|
|
161
152
|
children: netChange(addedCount, removedCount, singular, plural)
|
|
162
153
|
}), /* @__PURE__ */ jsxs("span", {
|
|
163
154
|
className: "text-muted-foreground",
|
|
164
|
-
children: [
|
|
165
|
-
": ",
|
|
166
|
-
count(addedCount, singular, plural),
|
|
167
|
-
" added, ",
|
|
168
|
-
removedCount,
|
|
169
|
-
" removed"
|
|
170
|
-
]
|
|
155
|
+
children: [": ", text("addedRemoved", count(addedCount, singular, plural), removedCount)]
|
|
171
156
|
})] }) : /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" }),
|
|
172
157
|
/* @__PURE__ */ jsx(RecordsSide, {
|
|
173
158
|
model,
|
|
174
159
|
view,
|
|
175
|
-
title: "
|
|
160
|
+
title: text("added"),
|
|
176
161
|
filter: added,
|
|
177
162
|
total: addedCount,
|
|
178
163
|
plural
|
|
@@ -180,7 +165,7 @@ const UpdateSearchDialog = ({ model, view, title, before, after, saveNewLabel, u
|
|
|
180
165
|
/* @__PURE__ */ jsx(RecordsSide, {
|
|
181
166
|
model,
|
|
182
167
|
view,
|
|
183
|
-
title: "
|
|
168
|
+
title: text("removed"),
|
|
184
169
|
filter: removed,
|
|
185
170
|
total: removedCount,
|
|
186
171
|
plural
|
|
@@ -6,12 +6,13 @@ import { useAdminMeta } from "../meta-gate.js";
|
|
|
6
6
|
import { useAppAddress } from "../use-app-address.js";
|
|
7
7
|
import { can } from "../permissions.js";
|
|
8
8
|
import { useRefreshResource } from "../pages/use-layout-data.js";
|
|
9
|
+
import { text } from "./messages.js";
|
|
9
10
|
import { useSavedSearches } from "./use-saved-searches.js";
|
|
10
11
|
import { useOpenedSearch } from "./use-opened-search.js";
|
|
11
12
|
import { encodeKey } from "@protobase/schema/internal";
|
|
12
13
|
import { useMutation } from "@tanstack/react-query";
|
|
13
14
|
//#region src/app/searches/use-save-search.ts
|
|
14
|
-
const message = (error) => error instanceof Error ? error.message : "
|
|
15
|
+
const message = (error) => error instanceof Error ? error.message : text("somethingWrong");
|
|
15
16
|
/**
|
|
16
17
|
* A list page's "Save search" button for its `filter`: `save` for someone who can list, create and delete the saved
|
|
17
18
|
* searches, `sign-in` for a visitor their resource asks to sign in (`prompt`), nothing otherwise. `saved` while a search
|
|
@@ -48,9 +49,9 @@ const useSaveSearch = (search, filter) => {
|
|
|
48
49
|
opened.open(keyOf(created.record));
|
|
49
50
|
toast.show({
|
|
50
51
|
state: "success",
|
|
51
|
-
title: "
|
|
52
|
+
title: text("searchSaved"),
|
|
52
53
|
action: {
|
|
53
|
-
label:
|
|
54
|
+
label: text("openPlural", plural),
|
|
54
55
|
href: href({
|
|
55
56
|
kind: "list",
|
|
56
57
|
resource
|
|
@@ -61,7 +62,7 @@ const useSaveSearch = (search, filter) => {
|
|
|
61
62
|
},
|
|
62
63
|
onError: (error) => toast.show({
|
|
63
64
|
state: "error",
|
|
64
|
-
title: "
|
|
65
|
+
title: text("couldNotSave"),
|
|
65
66
|
description: message(error)
|
|
66
67
|
}),
|
|
67
68
|
onSettled: () => refresh(resource)
|
|
@@ -70,7 +71,7 @@ const useSaveSearch = (search, filter) => {
|
|
|
70
71
|
mutationFn: (row) => client.remove(resource, keyOf(row)),
|
|
71
72
|
onError: (error) => toast.show({
|
|
72
73
|
state: "error",
|
|
73
|
-
title: "
|
|
74
|
+
title: text("couldNotTakeOff"),
|
|
74
75
|
description: message(error)
|
|
75
76
|
}),
|
|
76
77
|
onSettled: () => refresh(resource)
|
|
@@ -79,11 +80,11 @@ const useSaveSearch = (search, filter) => {
|
|
|
79
80
|
mutationFn: (row) => client.update(resource, keyOf(row), { [of.filter]: filter }, row.etag ?? "*"),
|
|
80
81
|
onSuccess: () => toast.show({
|
|
81
82
|
state: "success",
|
|
82
|
-
title: "
|
|
83
|
+
title: text("searchUpdated")
|
|
83
84
|
}),
|
|
84
85
|
onError: (error) => toast.show({
|
|
85
86
|
state: "error",
|
|
86
|
-
title: "
|
|
87
|
+
title: text("couldNotUpdate"),
|
|
87
88
|
description: message(error)
|
|
88
89
|
}),
|
|
89
90
|
onSettled: () => refresh(resource)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useClient } from "../../data/api-provider.js";
|
|
2
2
|
import { humanize } from "../../live/naming.js";
|
|
3
3
|
import { countQuery, useRefreshResource } from "../pages/use-layout-data.js";
|
|
4
|
+
import { text } from "./messages.js";
|
|
4
5
|
import { chipsText } from "./filter-chip-list.js";
|
|
5
6
|
import { isUnseen, unseenFilter } from "./saved-search.js";
|
|
6
7
|
import { useFilterChips } from "./use-filter-chips.js";
|
|
@@ -36,11 +37,11 @@ const useSearchRow = ({ model, of, target, targetView, row, recordKey }) => {
|
|
|
36
37
|
sort: unseen ? `${unseen.field} desc` : void 0,
|
|
37
38
|
limit: of.limit,
|
|
38
39
|
chips: name !== void 0,
|
|
39
|
-
empty:
|
|
40
|
-
note: unseen && newCount.data === 0 &&
|
|
40
|
+
empty: text("noneMatch", plural),
|
|
41
|
+
note: unseen && newCount.data === 0 && text("noNew", plural),
|
|
41
42
|
isNew: unseen && ((record) => isUnseen(record.record[unseen.field], row[unseen.seenAt])),
|
|
42
43
|
viewAll: {
|
|
43
|
-
label: "
|
|
44
|
+
label: text("viewAll"),
|
|
44
45
|
savedSearch: recordKey,
|
|
45
46
|
...unseen && { onOpen: () => markSeen.mutate((/* @__PURE__ */ new Date()).toISOString()) }
|
|
46
47
|
}
|