autosolutions-os 0.2.1 → 0.2.2
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/CHANGELOG.md +31 -0
- package/README.md +21 -10
- package/dist/frame.d.ts +6 -5
- package/dist/frame.js +14 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 - 2026-09-30
|
|
4
|
+
|
|
5
|
+
With `autosolutions-design-system` 6.3.3, whose frame fixes this release
|
|
6
|
+
wires up. The design-system peer range is now `>=6.3.3 <7`: the company
|
|
7
|
+
menu below is marked up with 6.3.3's `ActionList` menu roles, which an
|
|
8
|
+
older design system would put on a list of plain buttons.
|
|
9
|
+
|
|
10
|
+
- **Settings on its own page stays put.** `OsWorkspaceFrame` now returns
|
|
11
|
+
`false` to the frame when `targetFor` finds nowhere to go. In the Hub,
|
|
12
|
+
Settings clicked on Configuration (`/comms/settings`, filed under Smart
|
|
13
|
+
Comms, no `settingsPath`) no longer moves the frame onto Settings: it
|
|
14
|
+
stays on Hub and Smart Comms, adds no history entry and keeps the tab
|
|
15
|
+
icon. The same holds for any rail item with no menu whose page is the
|
|
16
|
+
URL already.
|
|
17
|
+
- **The company menu is a menu.** It is an `ActionList` with `role="menu"`,
|
|
18
|
+
named "Switch company", with the acting company as the checked radio
|
|
19
|
+
item. With 6.3.3 the plate and chevron are one button that opens it, the
|
|
20
|
+
arrow keys move through it, and Escape or a pick gives focus back to the
|
|
21
|
+
button.
|
|
22
|
+
- As before, and now as links: the rows for other apps carry the catalogue
|
|
23
|
+
address with `?tenant=`, and the design system draws them as `<a href>`,
|
|
24
|
+
so a middle-click or a modified click opens them where the browser does,
|
|
25
|
+
while a plain click still opens them in the same tab.
|
|
26
|
+
- Back from another app out of the browser's back/forward cache, the frame
|
|
27
|
+
is where the URL is (6.3.3 re-syncs on `pageshow`).
|
|
28
|
+
- Apps change nothing but the two versions, in one commit. An app that
|
|
29
|
+
wires the design system's `WorkspaceFrame` to `osFrame` itself (Key
|
|
30
|
+
Accounts) gets the Settings fix by returning `false` from `onNavigate`
|
|
31
|
+
when `targetFor` returns null:
|
|
32
|
+
`onNavigate={(state) => { const t = FRAME.targetFor(state, here); if (!t) return false; ... }}`.
|
|
33
|
+
|
|
3
34
|
## 0.2.1 - 2026-09-29
|
|
4
35
|
|
|
5
36
|
A fix, with `autosolutions-design-system` 6.3.2. A click on the tab or row
|
package/README.md
CHANGED
|
@@ -35,8 +35,9 @@ export function App() {
|
|
|
35
35
|
the top bar with the company's mark and switcher, the rail, the OS menu (the 53
|
|
36
36
|
tools of the menu map: the handoff's 49 plus Shelf simulator, Key accounts, PM
|
|
37
37
|
Copilot and Candidate hub), the footer with Admin for people who manage something, and the
|
|
38
|
-
browser-tab icon. It needs `autosolutions-design-system` 6.3 or later
|
|
39
|
-
(an optional peer: only this entry point uses it).
|
|
38
|
+
browser-tab icon. It needs `autosolutions-design-system` 6.3.3 or later
|
|
39
|
+
(an optional peer: only this entry point uses it). Take this package's 0.2.2
|
|
40
|
+
and the design system's 6.3.3 together, in one commit.
|
|
40
41
|
|
|
41
42
|
```tsx
|
|
42
43
|
import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
@@ -60,16 +61,21 @@ import { OsWorkspaceFrame } from "autosolutions-os/frame";
|
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
It works with any router: it reads `location` and calls `onNavigate(href)` for
|
|
63
|
-
paths inside the app, and opens other apps itself, in the same tab.
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
paths inside the app, and opens other apps itself, in the same tab. The rows
|
|
65
|
+
for other apps are links (`<a href>` with `?tenant=`), so a middle-click, a
|
|
66
|
+
Cmd or Ctrl click and Copy link work as the browser does them. Browser Back
|
|
67
|
+
moves the menus because the frame follows `location`, and it calls
|
|
68
|
+
`onNavigate` only when someone clicks, so there is no loop. Back from another
|
|
69
|
+
app out of the browser's back/forward cache puts the frame where the URL is,
|
|
70
|
+
and Settings clicked on the page it goes to (the Hub's Configuration) goes
|
|
71
|
+
nowhere and leaves the frame where it was. A click on the tab
|
|
66
72
|
or row the frame already shows goes to that tab's or row's own path from a
|
|
67
73
|
page under it (a draft filed under Requests goes back to Requests), and
|
|
68
74
|
nowhere when the URL is exactly that path. It goes to the tab's own path and
|
|
69
75
|
drops the page's query: on `/analytics?range=90`, Analytics goes to
|
|
70
76
|
`/analytics`, as the old sidebar links did, so a page that keeps its filters in
|
|
71
|
-
the query starts again from its defaults.
|
|
72
|
-
|
|
77
|
+
the query starts again from its defaults. The design system reports that
|
|
78
|
+
click from 6.3.2, which this package's 0.2.1 first read (the CHANGELOG says
|
|
73
79
|
why).
|
|
74
80
|
|
|
75
81
|
- `tools` are this app's own rows, by menu-map id, with their routes. They are
|
|
@@ -96,7 +102,10 @@ why).
|
|
|
96
102
|
Brand voice copywriter read "Live, not linked from the Hub yet", anything
|
|
97
103
|
not Live shows its status.
|
|
98
104
|
- The company plate is `markFor(tenant, "plain")`. The chevron appears only for
|
|
99
|
-
someone with more than one company
|
|
105
|
+
someone with more than one company, and then the plate and the chevron are
|
|
106
|
+
one button that opens the company menu: a menu of the companies, the acting
|
|
107
|
+
one checked, with arrow keys, and focus back on the button when it closes.
|
|
108
|
+
`companySwitch` says what it does:
|
|
100
109
|
- `"os"` (the default) switches exactly as `OsCompanySwitcher` does, since
|
|
101
110
|
both use `useCompanySwitch(os, appKey)`: `switch_company_for_app`, then a
|
|
102
111
|
reload or that company's deployment of this app.
|
|
@@ -149,8 +158,10 @@ const here = pathname + search;
|
|
|
149
158
|
location={{ ...frame.locate(here), href: here }}
|
|
150
159
|
onNavigate={(state) => {
|
|
151
160
|
const target = frame.targetFor(state, here);
|
|
152
|
-
if (target
|
|
153
|
-
|
|
161
|
+
if (!target) return false; // goes nowhere: the frame stays where `here` is
|
|
162
|
+
if (target.external) window.location.assign(target.href);
|
|
163
|
+
else navigate(target.href);
|
|
164
|
+
return true;
|
|
154
165
|
}}
|
|
155
166
|
onSignOut={signOut}
|
|
156
167
|
>
|
package/dist/frame.d.ts
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
5
5
|
* the same 53-tool menu and the same footer in every app, marks this app's own
|
|
6
6
|
* tools live, links the others through the catalogue, and puts the acting
|
|
7
|
-
* company's mark on the top bar's plate
|
|
7
|
+
* company's mark on the top bar's plate, which opens the company menu.
|
|
8
8
|
*
|
|
9
9
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
10
|
-
* query) and an `onNavigate(href)` that pushes an in-app path
|
|
11
|
-
* apps it
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
|
11
|
+
* apps are links, which it follows itself in the same tab (a middle-click or
|
|
12
|
+
* a modified click opens them where the browser does). Browser Back and
|
|
13
|
+
* Forward move the menus because the frame follows `location`, and it only
|
|
14
|
+
* calls `onNavigate` when someone clicks. A click on the tab or row it already shows, from a page
|
|
14
15
|
* filed under it (a draft under Requests), goes to that tab's own page.
|
|
15
16
|
*/
|
|
16
17
|
import { type ReactNode } from "react";
|
package/dist/frame.js
CHANGED
|
@@ -5,13 +5,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
* Every app on the core renders this around its pages. It draws the same rail,
|
|
6
6
|
* the same 53-tool menu and the same footer in every app, marks this app's own
|
|
7
7
|
* tools live, links the others through the catalogue, and puts the acting
|
|
8
|
-
* company's mark on the top bar's plate
|
|
8
|
+
* company's mark on the top bar's plate, which opens the company menu.
|
|
9
9
|
*
|
|
10
10
|
* It knows nothing about routers. Hand it the current location (pathname plus
|
|
11
|
-
* query) and an `onNavigate(href)` that pushes an in-app path
|
|
12
|
-
* apps it
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* query) and an `onNavigate(href)` that pushes an in-app path. Rows for other
|
|
12
|
+
* apps are links, which it follows itself in the same tab (a middle-click or
|
|
13
|
+
* a modified click opens them where the browser does). Browser Back and
|
|
14
|
+
* Forward move the menus because the frame follows `location`, and it only
|
|
15
|
+
* calls `onNavigate` when someone clicks. A click on the tab or row it already shows, from a page
|
|
15
16
|
* filed under it (a draft under Requests), goes to that tab's own page.
|
|
16
17
|
*/
|
|
17
18
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -60,19 +61,23 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
|
|
|
60
61
|
...(homePath ? { homePath } : {}),
|
|
61
62
|
});
|
|
62
63
|
}, [appKey, apps, admin, manages, slug, tools, hubItems, settingsPath, homePath]);
|
|
64
|
+
/* `false` tells the frame a click went nowhere (Settings on the page
|
|
65
|
+
Settings goes to), so it stays where the location puts it. */
|
|
63
66
|
const navigate = (state) => {
|
|
64
67
|
const target = frame.targetFor(state, location);
|
|
65
68
|
if (!target)
|
|
66
|
-
return;
|
|
69
|
+
return false;
|
|
67
70
|
if (target.external)
|
|
68
71
|
window.location.assign(target.href);
|
|
69
72
|
else
|
|
70
73
|
onNavigate(target.href);
|
|
74
|
+
return true;
|
|
71
75
|
};
|
|
72
76
|
const signOut = onSignOut ?? (() => {
|
|
73
77
|
void auth?.signOut().then(() => window.location.reload());
|
|
74
78
|
});
|
|
75
|
-
/* The company menu, offered only when there is somewhere to switch to
|
|
79
|
+
/* The company menu, offered only when there is somewhere to switch to: a
|
|
80
|
+
menu of radio items, the acting company checked. */
|
|
76
81
|
const pick = (tenant) => {
|
|
77
82
|
if (typeof companySwitch !== "function") {
|
|
78
83
|
void choose(tenant.id, () => setMenuOpen(false));
|
|
@@ -90,11 +95,12 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
|
|
|
90
95
|
.finally(() => setOwnBusy(false));
|
|
91
96
|
};
|
|
92
97
|
const switchable = companySwitch !== "none" && Boolean(current) && tenants.length > 1;
|
|
93
|
-
const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { sections: [{
|
|
98
|
+
const companyMenu = switchable && current ? (_jsxs(_Fragment, { children: [_jsx(ActionList, { role: "menu", "aria-label": "Switch company", sections: [{
|
|
94
99
|
title: "Your companies",
|
|
95
100
|
items: tenants.map((tenant) => ({
|
|
96
101
|
content: tenant.name,
|
|
97
102
|
active: tenant.id === current.id,
|
|
103
|
+
checked: tenant.id === current.id,
|
|
98
104
|
disabled: busy,
|
|
99
105
|
prefix: _jsx("img", { className: "as-ws__company-mark", src: markFor(tenant, "plain"), alt: "" }),
|
|
100
106
|
onAction: () => pick(tenant),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosolutions-os",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "One sign-in, one company switcher, one app grid. What every AutoSolutions app imports instead of copying.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@supabase/supabase-js": ">=2.40.0",
|
|
24
|
-
"autosolutions-design-system": ">=6.3.
|
|
24
|
+
"autosolutions-design-system": ">=6.3.3 <7",
|
|
25
25
|
"react": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|