@protobase/ui 0.45.11 → 0.45.12
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/app/app.js +5 -14
- package/dist/app/start-address.js +33 -0
- package/dist/package.js +1 -1
- package/dist/shell/assets/app-im4iVgX0.js +9 -0
- package/dist/shell/assets/{index-wwDSTSGY.js → index-Dw64NQor.js} +2 -2
- package/dist/shell/assets/{records-map-C7Yrt8CO.js → records-map-Dwr0f3ie.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-DXC2wqY-.js → shared-protobase-ui-CbCm-lbG.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-im4iVgX0.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-wwDSTSGY.js.map → index-Dw64NQor.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-C7Yrt8CO.js.map → records-map-Dwr0f3ie.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-DXC2wqY-.js.map → shared-protobase-ui-CbCm-lbG.js.map} +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/app-BR3MIvSi.js +0 -9
- package/dist/shell-source-maps/assets/app-BR3MIvSi.js.map +0 -1
package/dist/app/app.js
CHANGED
|
@@ -47,6 +47,7 @@ import { OrganizationPage } from "../organizations/organization-page.js";
|
|
|
47
47
|
import { OrganizationsPage } from "../organizations/organizations-page.js";
|
|
48
48
|
import { actingUser } from "../roles/acting-user.js";
|
|
49
49
|
import { useActiveRole } from "../roles/use-active-role.js";
|
|
50
|
+
import { startAddress } from "./start-address.js";
|
|
50
51
|
import { ProjectLogo } from "./project-logo.js";
|
|
51
52
|
import { PluginGate, usePluginsOff } from "../plugins/plugin-gate.js";
|
|
52
53
|
import { PluginNotice } from "../plugins/plugin-notice.js";
|
|
@@ -59,7 +60,7 @@ import { NewVersionToast } from "./new-version/new-version-toast.js";
|
|
|
59
60
|
import { RuntimeUpdateButton } from "./runtime/runtime-update.js";
|
|
60
61
|
import { StaffBanner } from "./staff-banner.js";
|
|
61
62
|
import { useNavRecent } from "./use-nav-recent.js";
|
|
62
|
-
import { useCallback, useEffect, useState } from "react";
|
|
63
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
63
64
|
import { viewOfList } from "@protobase/schema/internal";
|
|
64
65
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
65
66
|
import { connectRoute } from "@protobase/schema";
|
|
@@ -93,23 +94,13 @@ const Routes = ({ workspace, sidebarMode, assistant, runtime }) => {
|
|
|
93
94
|
});
|
|
94
95
|
useLiveUpdates(meta);
|
|
95
96
|
const groups = navFromMeta(meta, basePath, recent);
|
|
96
|
-
const
|
|
97
|
-
const firstResource = Object.keys(meta.resources)[0];
|
|
97
|
+
const start = useMemo(() => startAddress(meta), [meta]);
|
|
98
98
|
const page = address?.kind === "page" ? meta.pages[address.page] : void 0;
|
|
99
99
|
useEffect(() => {
|
|
100
|
-
if (path
|
|
101
|
-
if (firstPage) go({
|
|
102
|
-
kind: "page",
|
|
103
|
-
page: firstPage
|
|
104
|
-
}, { replace: true });
|
|
105
|
-
else if (firstResource) go({
|
|
106
|
-
kind: "list",
|
|
107
|
-
resource: firstResource
|
|
108
|
-
}, { replace: true });
|
|
100
|
+
if (path === "/" && start) go(start, { replace: true });
|
|
109
101
|
}, [
|
|
110
102
|
path,
|
|
111
|
-
|
|
112
|
-
firstResource,
|
|
103
|
+
start,
|
|
113
104
|
go
|
|
114
105
|
]);
|
|
115
106
|
const resource = address?.kind === "page" ? void 0 : address?.resource;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { navFromMeta } from "./nav-from-meta.js";
|
|
2
|
+
//#region src/app/start-address.ts
|
|
3
|
+
/**
|
|
4
|
+
* Where the app opens at `/`: the first sidebar entry the caller sees that opens what it names; with none, the first
|
|
5
|
+
* page, else the first resource's list.
|
|
6
|
+
*/
|
|
7
|
+
const startAddress = (meta) => {
|
|
8
|
+
const first = navFromMeta(meta).flatMap((group) => group.items).find((item) => !item.problem);
|
|
9
|
+
if (first && meta.pages[first.id]) return {
|
|
10
|
+
kind: "page",
|
|
11
|
+
page: first.id
|
|
12
|
+
};
|
|
13
|
+
if (first) {
|
|
14
|
+
const [resource, list] = first.id.split("/");
|
|
15
|
+
return {
|
|
16
|
+
kind: "list",
|
|
17
|
+
resource,
|
|
18
|
+
...list !== void 0 && { list }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const firstPage = Object.keys(meta.pages)[0];
|
|
22
|
+
if (firstPage) return {
|
|
23
|
+
kind: "page",
|
|
24
|
+
page: firstPage
|
|
25
|
+
};
|
|
26
|
+
const firstResource = Object.keys(meta.resources)[0];
|
|
27
|
+
return firstResource ? {
|
|
28
|
+
kind: "list",
|
|
29
|
+
resource: firstResource
|
|
30
|
+
} : void 0;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { startAddress };
|
package/dist/package.js
CHANGED