@byline/host-tanstack-start 2.5.2 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin-shell/admin-roles/container.js +38 -24
- package/dist/admin-shell/admin-roles/delete.js +9 -7
- package/dist/admin-shell/admin-roles/list.js +20 -16
- package/dist/admin-shell/admin-users/container.js +79 -56
- package/dist/admin-shell/admin-users/delete.js +10 -8
- package/dist/admin-shell/admin-users/list.js +27 -18
- package/dist/admin-shell/chrome/admin-app-bar.js +5 -2
- package/dist/admin-shell/chrome/breadcrumbs/breadcrumbs.js +3 -1
- package/dist/admin-shell/chrome/dashboard.js +13 -11
- package/dist/admin-shell/chrome/hamburger.js +3 -1
- package/dist/admin-shell/chrome/menu-drawer.js +7 -5
- package/dist/admin-shell/chrome/preview-toggle.js +5 -3
- package/dist/admin-shell/chrome/route-error.d.ts +3 -2
- package/dist/admin-shell/chrome/route-error.js +29 -22
- package/dist/admin-shell/chrome/sign-in-page.d.ts +16 -4
- package/dist/admin-shell/chrome/sign-in-page.js +38 -13
- package/dist/admin-shell/chrome/sign-in-page.module.js +1 -0
- package/dist/admin-shell/chrome/sign-in-page_module.css +8 -1
- package/dist/admin-shell/collections/api.js +6 -5
- package/dist/admin-shell/collections/create.js +12 -4
- package/dist/admin-shell/collections/edit.js +112 -37
- package/dist/admin-shell/collections/history.js +17 -12
- package/dist/admin-shell/collections/list.js +18 -13
- package/dist/admin-shell/collections/preview-link.d.ts +1 -10
- package/dist/admin-shell/collections/preview-link.js +9 -11
- package/dist/admin-shell/collections/resolve-preview-url.d.ts +34 -0
- package/dist/admin-shell/collections/resolve-preview-url.js +17 -0
- package/dist/admin-shell/collections/restore-version-modal.js +13 -14
- package/dist/admin-shell/collections/tanstack-navigation-guard.d.ts +1 -1
- package/dist/admin-shell/collections/view-menu.js +7 -5
- package/dist/i18n/index.d.ts +19 -0
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/locale-cookie.d.ts +17 -0
- package/dist/i18n/locale-cookie.js +26 -0
- package/dist/i18n/locale-definitions.d.ts +29 -0
- package/dist/i18n/locale-definitions.js +27 -0
- package/dist/i18n/resolve-locale.d.ts +20 -0
- package/dist/i18n/resolve-locale.js +43 -0
- package/dist/i18n/server-translator.d.ts +33 -0
- package/dist/i18n/server-translator.js +19 -0
- package/dist/integrations/byline-admin-services.js +2 -0
- package/dist/integrations/byline-field-services.d.ts +3 -3
- package/dist/routes/create-admin-account-route.js +6 -3
- package/dist/routes/create-admin-dashboard-route.js +3 -1
- package/dist/routes/create-admin-layout-route.js +48 -25
- package/dist/routes/create-admin-permissions-route.js +4 -2
- package/dist/routes/create-admin-role-edit-route.js +5 -3
- package/dist/routes/create-admin-roles-list-route.js +4 -2
- package/dist/routes/create-admin-user-edit-route.js +5 -3
- package/dist/routes/create-admin-users-list-route.js +4 -2
- package/dist/routes/create-collection-api-route.js +5 -3
- package/dist/routes/create-collection-create-route.js +4 -2
- package/dist/routes/create-collection-edit-route.js +4 -2
- package/dist/routes/create-collection-history-route.js +5 -3
- package/dist/routes/create-collection-list-route.js +11 -5
- package/dist/routes/create-sign-in-route.js +10 -1
- package/dist/server-fns/admin-account/change-password.d.ts +1 -0
- package/dist/server-fns/admin-account/get.d.ts +1 -0
- package/dist/server-fns/admin-account/update.d.ts +1 -0
- package/dist/server-fns/admin-users/create.d.ts +1 -0
- package/dist/server-fns/admin-users/get.d.ts +1 -0
- package/dist/server-fns/admin-users/list.d.ts +1 -0
- package/dist/server-fns/admin-users/set-password.d.ts +1 -0
- package/dist/server-fns/admin-users/update.d.ts +1 -0
- package/dist/server-fns/auth/sign-in.js +18 -0
- package/dist/server-fns/i18n/get-active-locale.d.ts +8 -0
- package/dist/server-fns/i18n/get-active-locale.js +6 -0
- package/dist/server-fns/i18n/index.d.ts +10 -0
- package/dist/server-fns/i18n/index.js +2 -0
- package/dist/server-fns/i18n/set-locale.d.ts +25 -0
- package/dist/server-fns/i18n/set-locale.js +42 -0
- package/package.json +16 -7
- package/src/admin-shell/admin-roles/container.tsx +41 -31
- package/src/admin-shell/admin-roles/delete.tsx +10 -11
- package/src/admin-shell/admin-roles/list.tsx +29 -16
- package/src/admin-shell/admin-users/container.tsx +77 -50
- package/src/admin-shell/admin-users/delete.tsx +11 -12
- package/src/admin-shell/admin-users/list.tsx +39 -18
- package/src/admin-shell/chrome/admin-app-bar.tsx +5 -2
- package/src/admin-shell/chrome/breadcrumbs/breadcrumbs.tsx +3 -1
- package/src/admin-shell/chrome/dashboard.tsx +9 -3
- package/src/admin-shell/chrome/hamburger.tsx +3 -1
- package/src/admin-shell/chrome/menu-drawer.tsx +7 -5
- package/src/admin-shell/chrome/preview-toggle.tsx +6 -4
- package/src/admin-shell/chrome/route-error.tsx +39 -26
- package/src/admin-shell/chrome/sign-in-page.module.css +10 -1
- package/src/admin-shell/chrome/sign-in-page.tsx +46 -12
- package/src/admin-shell/collections/api.tsx +5 -1
- package/src/admin-shell/collections/create.tsx +10 -4
- package/src/admin-shell/collections/edit.tsx +79 -72
- package/src/admin-shell/collections/history.tsx +18 -12
- package/src/admin-shell/collections/list.tsx +25 -14
- package/src/admin-shell/collections/preview-link.tsx +20 -33
- package/src/admin-shell/collections/resolve-preview-url.test.node.ts +167 -0
- package/src/admin-shell/collections/resolve-preview-url.ts +67 -0
- package/src/admin-shell/collections/restore-version-modal.tsx +11 -12
- package/src/admin-shell/collections/tanstack-navigation-guard.ts +1 -1
- package/src/admin-shell/collections/view-menu.tsx +9 -5
- package/src/i18n/index.ts +26 -0
- package/src/i18n/locale-cookie.ts +68 -0
- package/src/i18n/locale-definitions.ts +48 -0
- package/src/i18n/resolve-locale.ts +96 -0
- package/src/i18n/server-translator.ts +60 -0
- package/src/integrations/byline-admin-services.ts +2 -0
- package/src/integrations/byline-field-services.ts +7 -3
- package/src/routes/create-admin-account-route.tsx +6 -4
- package/src/routes/create-admin-dashboard-route.tsx +5 -1
- package/src/routes/create-admin-layout-route.tsx +53 -20
- package/src/routes/create-admin-permissions-route.tsx +4 -2
- package/src/routes/create-admin-role-edit-route.tsx +5 -3
- package/src/routes/create-admin-roles-list-route.tsx +5 -2
- package/src/routes/create-admin-user-edit-route.tsx +5 -3
- package/src/routes/create-admin-users-list-route.tsx +4 -2
- package/src/routes/create-collection-api-route.tsx +5 -3
- package/src/routes/create-collection-create-route.tsx +7 -2
- package/src/routes/create-collection-edit-route.tsx +4 -2
- package/src/routes/create-collection-history-route.tsx +5 -3
- package/src/routes/create-collection-list-route.tsx +8 -10
- package/src/routes/create-sign-in-route.tsx +14 -1
- package/src/server-fns/auth/sign-in.ts +45 -0
- package/src/server-fns/i18n/get-active-locale.ts +26 -0
- package/src/server-fns/i18n/index.ts +11 -0
- package/src/server-fns/i18n/set-locale.ts +103 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute } from "@tanstack/react-router";
|
|
3
3
|
import { AbilitiesInspector } from "@byline/admin/admin-permissions/components/inspector";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
4
5
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
5
6
|
import { listRegisteredAbilities } from "../server-fns/admin-permissions/index.js";
|
|
6
7
|
function createAdminPermissionsRoute(path) {
|
|
@@ -13,16 +14,17 @@ function createAdminPermissionsRoute(path) {
|
|
|
13
14
|
},
|
|
14
15
|
component: function() {
|
|
15
16
|
const { data } = Route.useLoaderData();
|
|
17
|
+
const { t } = useTranslation('byline-admin');
|
|
16
18
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
17
19
|
children: [
|
|
18
20
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
19
21
|
breadcrumbs: [
|
|
20
22
|
{
|
|
21
|
-
label: '
|
|
23
|
+
label: t('chrome.menu.dashboard'),
|
|
22
24
|
href: '/admin'
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
|
-
label: '
|
|
27
|
+
label: t('chrome.menu.permissions'),
|
|
26
28
|
href: '/admin/permissions'
|
|
27
29
|
}
|
|
28
30
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
3
4
|
import { Container, Section } from "@byline/ui/react";
|
|
4
5
|
import { RoleContainer } from "../admin-shell/admin-roles/container.js";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
@@ -34,20 +35,21 @@ function createAdminRoleEditRoute(path) {
|
|
|
34
35
|
},
|
|
35
36
|
component: function() {
|
|
36
37
|
const { role, registered, initialAbilities } = Route.useLoaderData();
|
|
38
|
+
const { t } = useTranslation('byline-admin');
|
|
37
39
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
38
40
|
children: [
|
|
39
41
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
40
42
|
breadcrumbs: [
|
|
41
43
|
{
|
|
42
|
-
label: '
|
|
44
|
+
label: t('chrome.menu.dashboard'),
|
|
43
45
|
href: '/admin'
|
|
44
46
|
},
|
|
45
47
|
{
|
|
46
|
-
label: '
|
|
48
|
+
label: t('chrome.menu.adminRoles'),
|
|
47
49
|
href: '/admin/roles'
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
|
-
label: '
|
|
52
|
+
label: t('adminRoles.breadcrumbDetail'),
|
|
51
53
|
href: `/admin/roles/${role.id}`
|
|
52
54
|
}
|
|
53
55
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
3
4
|
import { AdminRolesListView } from "../admin-shell/admin-roles/list.js";
|
|
4
5
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
5
6
|
import { listAdminRoles } from "../server-fns/admin-roles/index.js";
|
|
@@ -13,16 +14,17 @@ function createAdminRolesListRoute(path) {
|
|
|
13
14
|
},
|
|
14
15
|
component: function() {
|
|
15
16
|
const { data } = Route.useLoaderData();
|
|
17
|
+
const { t } = useTranslation('byline-admin');
|
|
16
18
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
17
19
|
children: [
|
|
18
20
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
19
21
|
breadcrumbs: [
|
|
20
22
|
{
|
|
21
|
-
label: '
|
|
23
|
+
label: t('chrome.menu.dashboard'),
|
|
22
24
|
href: '/admin'
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
|
-
label: '
|
|
27
|
+
label: t('chrome.menu.adminRoles'),
|
|
26
28
|
href: '/admin/roles'
|
|
27
29
|
}
|
|
28
30
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
3
4
|
import { Container, Section } from "@byline/ui/react";
|
|
4
5
|
import { AccountContainer } from "../admin-shell/admin-users/container.js";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
@@ -41,20 +42,21 @@ function createAdminUserEditRoute(path) {
|
|
|
41
42
|
},
|
|
42
43
|
component: function() {
|
|
43
44
|
const { user, allRoles, initialUserRoles } = Route.useLoaderData();
|
|
45
|
+
const { t } = useTranslation('byline-admin');
|
|
44
46
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
45
47
|
children: [
|
|
46
48
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
47
49
|
breadcrumbs: [
|
|
48
50
|
{
|
|
49
|
-
label: '
|
|
51
|
+
label: t('chrome.menu.dashboard'),
|
|
50
52
|
href: '/admin'
|
|
51
53
|
},
|
|
52
54
|
{
|
|
53
|
-
label: '
|
|
55
|
+
label: t('chrome.menu.adminUsers'),
|
|
54
56
|
href: '/admin/users'
|
|
55
57
|
},
|
|
56
58
|
{
|
|
57
|
-
label: '
|
|
59
|
+
label: t('adminUsers.breadcrumbDetail'),
|
|
58
60
|
href: `/admin/users/${user.id}`
|
|
59
61
|
}
|
|
60
62
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { AdminUsersListView } from "../admin-shell/admin-users/list.js";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
@@ -45,16 +46,17 @@ function createAdminUsersListRoute(path) {
|
|
|
45
46
|
},
|
|
46
47
|
component: function() {
|
|
47
48
|
const { data } = Route.useLoaderData();
|
|
49
|
+
const { t } = useTranslation('byline-admin');
|
|
48
50
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
49
51
|
children: [
|
|
50
52
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
51
53
|
breadcrumbs: [
|
|
52
54
|
{
|
|
53
|
-
label: '
|
|
55
|
+
label: t('chrome.menu.dashboard'),
|
|
54
56
|
href: '/admin'
|
|
55
57
|
},
|
|
56
58
|
{
|
|
57
|
-
label: '
|
|
59
|
+
label: t('chrome.menu.adminUsers'),
|
|
58
60
|
href: '/admin/users'
|
|
59
61
|
}
|
|
60
62
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
3
|
import { getCollectionDefinition } from "@byline/core";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
7
|
import { ApiView } from "../admin-shell/collections/api.js";
|
|
@@ -32,12 +33,13 @@ function createCollectionApiRoute(path, opts) {
|
|
|
32
33
|
const { collection, id } = Route.useParams();
|
|
33
34
|
const { locale, depth } = Route.useSearch();
|
|
34
35
|
const collectionDef = getCollectionDefinition(collection);
|
|
36
|
+
const { t } = useTranslation('byline-admin');
|
|
35
37
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
36
38
|
children: [
|
|
37
39
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
38
40
|
breadcrumbs: [
|
|
39
41
|
{
|
|
40
|
-
label: '
|
|
42
|
+
label: t('chrome.menu.dashboard'),
|
|
41
43
|
href: "/admin"
|
|
42
44
|
},
|
|
43
45
|
{
|
|
@@ -45,11 +47,11 @@ function createCollectionApiRoute(path, opts) {
|
|
|
45
47
|
href: `/admin/collections/${collection}`
|
|
46
48
|
},
|
|
47
49
|
{
|
|
48
|
-
label: '
|
|
50
|
+
label: t('common.actions.edit'),
|
|
49
51
|
href: `/admin/collections/${collection}/${id}`
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
|
-
label: '
|
|
54
|
+
label: t('collections.viewMenu.apiButton'),
|
|
53
55
|
href: `/admin/collections/${collection}/${id}/api`
|
|
54
56
|
}
|
|
55
57
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
3
|
import { buildInitialDataFromFields, getCollectionAdminConfig, getCollectionDefinition } from "@byline/core";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
4
5
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
5
6
|
import { CreateView } from "../admin-shell/collections/create.js";
|
|
6
7
|
function createCollectionCreateRoute(path) {
|
|
@@ -21,12 +22,13 @@ function createCollectionCreateRoute(path) {
|
|
|
21
22
|
const { initialData } = Route.useLoaderData();
|
|
22
23
|
const collectionDef = getCollectionDefinition(collection);
|
|
23
24
|
const adminConfig = getCollectionAdminConfig(collection);
|
|
25
|
+
const { t } = useTranslation('byline-admin');
|
|
24
26
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
25
27
|
children: [
|
|
26
28
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
27
29
|
breadcrumbs: [
|
|
28
30
|
{
|
|
29
|
-
label: '
|
|
31
|
+
label: t('chrome.menu.dashboard'),
|
|
30
32
|
href: '/admin'
|
|
31
33
|
},
|
|
32
34
|
{
|
|
@@ -34,7 +36,7 @@ function createCollectionCreateRoute(path) {
|
|
|
34
36
|
href: `/admin/collections/${collection}`
|
|
35
37
|
},
|
|
36
38
|
{
|
|
37
|
-
label: '
|
|
39
|
+
label: t('collections.breadcrumbs.create'),
|
|
38
40
|
href: `/admin/collections/${collection}/create`
|
|
39
41
|
}
|
|
40
42
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
3
|
import { getCollectionAdminConfig, getCollectionDefinition } from "@byline/core";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
7
|
import { EditView } from "../admin-shell/collections/edit.js";
|
|
@@ -30,12 +31,13 @@ function createCollectionEditRoute(path, opts) {
|
|
|
30
31
|
const { locale } = Route.useSearch();
|
|
31
32
|
const collectionDef = getCollectionDefinition(collection);
|
|
32
33
|
const adminConfig = getCollectionAdminConfig(collection);
|
|
34
|
+
const { t } = useTranslation('byline-admin');
|
|
33
35
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
34
36
|
children: [
|
|
35
37
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
36
38
|
breadcrumbs: [
|
|
37
39
|
{
|
|
38
|
-
label: '
|
|
40
|
+
label: t('chrome.menu.dashboard'),
|
|
39
41
|
href: "/admin"
|
|
40
42
|
},
|
|
41
43
|
{
|
|
@@ -43,7 +45,7 @@ function createCollectionEditRoute(path, opts) {
|
|
|
43
45
|
href: `/admin/collections/${collection}`
|
|
44
46
|
},
|
|
45
47
|
{
|
|
46
|
-
label: '
|
|
48
|
+
label: t('common.actions.edit'),
|
|
47
49
|
href: `/admin/collections/${collection}/${id}`
|
|
48
50
|
}
|
|
49
51
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
3
|
import { getCollectionAdminConfig, getCollectionDefinition, getWorkflowStatuses } from "@byline/core";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
7
|
import { HistoryView } from "../admin-shell/collections/history.js";
|
|
@@ -54,12 +55,13 @@ function createCollectionHistoryRoute(path, opts) {
|
|
|
54
55
|
const { collection } = Route.useParams();
|
|
55
56
|
const collectionDef = getCollectionDefinition(collection);
|
|
56
57
|
const adminConfig = getCollectionAdminConfig(collection);
|
|
58
|
+
const { t } = useTranslation('byline-admin');
|
|
57
59
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
58
60
|
children: [
|
|
59
61
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
60
62
|
breadcrumbs: [
|
|
61
63
|
{
|
|
62
|
-
label: '
|
|
64
|
+
label: t('chrome.menu.dashboard'),
|
|
63
65
|
href: "/admin"
|
|
64
66
|
},
|
|
65
67
|
{
|
|
@@ -67,11 +69,11 @@ function createCollectionHistoryRoute(path, opts) {
|
|
|
67
69
|
href: `/admin/collections/${collection}`
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
|
-
label: '
|
|
72
|
+
label: t('common.actions.edit'),
|
|
71
73
|
href: `/admin/collections/${collection}/${Route.useParams().id}`
|
|
72
74
|
},
|
|
73
75
|
{
|
|
74
|
-
label: '
|
|
76
|
+
label: t('collections.breadcrumbs.history'),
|
|
75
77
|
href: `/admin/collections/${collection}/${Route.useParams().id}/history`
|
|
76
78
|
}
|
|
77
79
|
]
|
|
@@ -2,6 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
4
4
|
import { getCollectionAdminConfig, getCollectionDefinition, getWorkflowStatuses } from "@byline/core";
|
|
5
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
5
6
|
import { useToastManager } from "@byline/ui/react";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
@@ -56,6 +57,7 @@ function createCollectionListRoute(path) {
|
|
|
56
57
|
},
|
|
57
58
|
component: function() {
|
|
58
59
|
const toastManager = useToastManager();
|
|
60
|
+
const { t } = useTranslation('byline-admin');
|
|
59
61
|
const data = Route.useLoaderData();
|
|
60
62
|
const { collection } = Route.useParams();
|
|
61
63
|
const search = Route.useSearch();
|
|
@@ -73,8 +75,12 @@ function createCollectionListRoute(path) {
|
|
|
73
75
|
if (createdToastFiredRef.current) return;
|
|
74
76
|
createdToastFiredRef.current = true;
|
|
75
77
|
toastManager.add({
|
|
76
|
-
title:
|
|
77
|
-
|
|
78
|
+
title: t('collections.list.createdToastTitle', {
|
|
79
|
+
label: collectionDef.labels.singular
|
|
80
|
+
}),
|
|
81
|
+
description: t("collections.list.createdToastDescription", {
|
|
82
|
+
label: collectionDef.labels.singular.toLowerCase()
|
|
83
|
+
}),
|
|
78
84
|
data: {
|
|
79
85
|
intent: 'success',
|
|
80
86
|
iconType: 'success',
|
|
@@ -94,8 +100,8 @@ function createCollectionListRoute(path) {
|
|
|
94
100
|
search.action,
|
|
95
101
|
navigate,
|
|
96
102
|
toastManager.add,
|
|
97
|
-
collectionDef.labels.singular
|
|
98
|
-
|
|
103
|
+
collectionDef.labels.singular,
|
|
104
|
+
t
|
|
99
105
|
]);
|
|
100
106
|
const CustomListView = adminConfig?.listView;
|
|
101
107
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -103,7 +109,7 @@ function createCollectionListRoute(path) {
|
|
|
103
109
|
/*#__PURE__*/ jsx(BreadcrumbsClient, {
|
|
104
110
|
breadcrumbs: [
|
|
105
111
|
{
|
|
106
|
-
label: '
|
|
112
|
+
label: t('chrome.menu.dashboard'),
|
|
107
113
|
href: "/admin"
|
|
108
114
|
},
|
|
109
115
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute } from "@tanstack/react-router";
|
|
3
3
|
import { SignInPage } from "../admin-shell/chrome/sign-in-page.js";
|
|
4
|
+
import { getActiveLocaleFn } from "../server-fns/i18n/index.js";
|
|
4
5
|
function createSignInRoute(path) {
|
|
5
6
|
const Route = createFileRoute(path)({
|
|
6
7
|
validateSearch: (search)=>{
|
|
@@ -9,10 +10,18 @@ function createSignInRoute(path) {
|
|
|
9
10
|
callbackUrl
|
|
10
11
|
};
|
|
11
12
|
},
|
|
13
|
+
beforeLoad: async ()=>{
|
|
14
|
+
const activeLocale = await getActiveLocaleFn();
|
|
15
|
+
return {
|
|
16
|
+
activeLocale
|
|
17
|
+
};
|
|
18
|
+
},
|
|
12
19
|
component: function() {
|
|
13
20
|
const { callbackUrl } = Route.useSearch();
|
|
21
|
+
const { activeLocale } = Route.useRouteContext();
|
|
14
22
|
return /*#__PURE__*/ jsx(SignInPage, {
|
|
15
|
-
callbackUrl: callbackUrl
|
|
23
|
+
callbackUrl: callbackUrl,
|
|
24
|
+
activeLocale: activeLocale
|
|
16
25
|
});
|
|
17
26
|
}
|
|
18
27
|
});
|
|
@@ -2,6 +2,8 @@ import { createServerFn } from "@tanstack/react-start";
|
|
|
2
2
|
import { getRequestHeader } from "@tanstack/react-start/server";
|
|
3
3
|
import { getServerConfig } from "@byline/core";
|
|
4
4
|
import { setSessionCookies } from "../../auth/auth-cookies.js";
|
|
5
|
+
import { readAdminLocaleCookie } from "../../i18n/locale-cookie.js";
|
|
6
|
+
import { bylineCore } from "../../integrations/byline-core.js";
|
|
5
7
|
const adminSignIn = createServerFn({
|
|
6
8
|
method: 'POST'
|
|
7
9
|
}).inputValidator((input)=>{
|
|
@@ -24,8 +26,24 @@ const adminSignIn = createServerFn({
|
|
|
24
26
|
ip
|
|
25
27
|
});
|
|
26
28
|
setSessionCookies(result);
|
|
29
|
+
try {
|
|
30
|
+
await reconcileLocaleAfterSignIn(result.actor.id);
|
|
31
|
+
} catch {}
|
|
27
32
|
return {
|
|
28
33
|
userId: result.actor.id
|
|
29
34
|
};
|
|
30
35
|
});
|
|
36
|
+
async function reconcileLocaleAfterSignIn(adminUserId) {
|
|
37
|
+
const cookieLocale = readAdminLocaleCookie();
|
|
38
|
+
if (null == cookieLocale) return;
|
|
39
|
+
const core = bylineCore();
|
|
40
|
+
const locales = core.config.i18n.interface.locales;
|
|
41
|
+
if (!locales.includes(cookieLocale)) return;
|
|
42
|
+
const adminStore = core.adminStore;
|
|
43
|
+
if (null == adminStore) return;
|
|
44
|
+
const row = await adminStore.adminUsers.getById(adminUserId);
|
|
45
|
+
if (!row) return;
|
|
46
|
+
if (row.preferred_locale === cookieLocale) return;
|
|
47
|
+
await adminStore.adminUsers.setPreferredLocale(adminUserId, cookieLocale);
|
|
48
|
+
}
|
|
31
49
|
export { adminSignIn };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
export declare const getActiveLocaleFn: import("@tanstack/react-start").OptionalFetcher<undefined, undefined, Promise<string>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
export { getActiveLocaleFn } from './get-active-locale.js';
|
|
9
|
+
export { setInterfaceLocaleFn } from './set-locale.js';
|
|
10
|
+
export type { SetInterfaceLocaleInput, SetInterfaceLocaleResult } from './set-locale.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import type { AccountResponse } from '@byline/admin/admin-account';
|
|
9
|
+
export interface SetInterfaceLocaleInput {
|
|
10
|
+
/** BCP 47 tag, or `null` to clear the preference. */
|
|
11
|
+
locale: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SetInterfaceLocaleResult {
|
|
14
|
+
ok: true;
|
|
15
|
+
/** Echo of the persisted value. `null` means the column was cleared. */
|
|
16
|
+
locale: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Freshened admin user row when the request resolved an authenticated
|
|
19
|
+
* actor. `null` on the pre-auth path (sign-in page, no admin store
|
|
20
|
+
* configured). Form-shaped callers lift this into local state; the
|
|
21
|
+
* top-bar `<LanguageMenu>` ignores it.
|
|
22
|
+
*/
|
|
23
|
+
account: AccountResponse | null;
|
|
24
|
+
}
|
|
25
|
+
export declare const setInterfaceLocaleFn: import("@tanstack/react-start").RequiredFetcher<undefined, (input: SetInterfaceLocaleInput) => SetInterfaceLocaleInput, Promise<SetInterfaceLocaleResult>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
+
import { setPreferredLocaleCommand } from "@byline/admin/admin-account";
|
|
3
|
+
import { AuthError, AuthErrorCodes } from "@byline/auth";
|
|
4
|
+
import { getAdminRequestContext } from "../../auth/auth-context.js";
|
|
5
|
+
import { clearAdminLocaleCookie, setAdminLocaleCookie } from "../../i18n/locale-cookie.js";
|
|
6
|
+
import { bylineCore } from "../../integrations/byline-core.js";
|
|
7
|
+
const setInterfaceLocaleFn = createServerFn({
|
|
8
|
+
method: 'POST'
|
|
9
|
+
}).inputValidator((input)=>input).handler(async ({ data })=>{
|
|
10
|
+
const core = bylineCore();
|
|
11
|
+
const locales = core.config.i18n.interface.locales;
|
|
12
|
+
if (null != data.locale && !locales.includes(data.locale)) throw new Error(`[setInterfaceLocaleFn] locale '${data.locale}' is not in i18n.interface.locales [${locales.join(', ')}].`);
|
|
13
|
+
if (null == data.locale) clearAdminLocaleCookie();
|
|
14
|
+
else setAdminLocaleCookie(data.locale);
|
|
15
|
+
const adminStore = core.adminStore;
|
|
16
|
+
if (null == adminStore) return {
|
|
17
|
+
ok: true,
|
|
18
|
+
locale: data.locale,
|
|
19
|
+
account: null
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
const context = await getAdminRequestContext();
|
|
23
|
+
const account = await setPreferredLocaleCommand(context, {
|
|
24
|
+
locale: data.locale
|
|
25
|
+
}, {
|
|
26
|
+
store: adminStore
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
ok: true,
|
|
30
|
+
locale: data.locale,
|
|
31
|
+
account
|
|
32
|
+
};
|
|
33
|
+
} catch (err) {
|
|
34
|
+
if (err instanceof AuthError && err.code === AuthErrorCodes.UNAUTHENTICATED) return {
|
|
35
|
+
ok: true,
|
|
36
|
+
locale: data.locale,
|
|
37
|
+
account: null
|
|
38
|
+
};
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export { setInterfaceLocaleFn };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.6.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -69,6 +69,14 @@
|
|
|
69
69
|
"types": "./dist/server-fns/collections/index.d.ts",
|
|
70
70
|
"import": "./dist/server-fns/collections/index.js"
|
|
71
71
|
},
|
|
72
|
+
"./i18n": {
|
|
73
|
+
"types": "./dist/i18n/index.d.ts",
|
|
74
|
+
"import": "./dist/i18n/index.js"
|
|
75
|
+
},
|
|
76
|
+
"./server-fns/i18n": {
|
|
77
|
+
"types": "./dist/server-fns/i18n/index.d.ts",
|
|
78
|
+
"import": "./dist/server-fns/i18n/index.js"
|
|
79
|
+
},
|
|
72
80
|
"./server-fns/preview": {
|
|
73
81
|
"types": "./dist/server-fns/preview/index.d.ts",
|
|
74
82
|
"import": "./dist/server-fns/preview/index.js"
|
|
@@ -107,12 +115,13 @@
|
|
|
107
115
|
"react-swipeable": "^7.0.2",
|
|
108
116
|
"uuid": "^14.0.0",
|
|
109
117
|
"zod": "^4.4.3",
|
|
110
|
-
"@byline/admin": "2.
|
|
111
|
-
"@byline/
|
|
112
|
-
"@byline/
|
|
113
|
-
"@byline/
|
|
114
|
-
"@byline/
|
|
115
|
-
"@byline/
|
|
118
|
+
"@byline/admin": "2.6.1",
|
|
119
|
+
"@byline/ai": "2.6.1",
|
|
120
|
+
"@byline/auth": "2.6.1",
|
|
121
|
+
"@byline/client": "2.6.1",
|
|
122
|
+
"@byline/i18n": "2.6.1",
|
|
123
|
+
"@byline/core": "2.6.1",
|
|
124
|
+
"@byline/ui": "2.6.1"
|
|
116
125
|
},
|
|
117
126
|
"peerDependencies": {
|
|
118
127
|
"@tanstack/react-router": "^1.167.0",
|