@volter/world-console 3.0.2 → 3.0.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/client/console.tsx +3 -9
- package/dist/client/console.bundle.js +13 -13
- package/dist/client/console.tsx +3 -9
- package/dist/client/main.bundle.js +50 -50
- package/package.json +3 -3
package/client/console.tsx
CHANGED
|
@@ -535,10 +535,10 @@ const TABS = ['changes', 'events', 'trace', 'vendors', 'screens', 'canvas', 'bra
|
|
|
535
535
|
type Tab = (typeof TABS)[number] | 'overview';
|
|
536
536
|
/** A workspace screen of a twin's vendor, as its `GET /twin` lists it (Viewing a World). */
|
|
537
537
|
type Workspace = { id: string; path: string };
|
|
538
|
-
/** Where a twin's vendor screens are shown: its
|
|
539
|
-
* World; null when it lists none. */
|
|
538
|
+
/** Where a twin's vendor screens are shown: its root workspace (the vendor's home, as a dashboard's root is), else its
|
|
539
|
+
* first that names no parameter, at the twin's place in the World; null when it lists none. */
|
|
540
540
|
const screenUrl = (name: string, t: { twin: string; screens?: Workspace[] } | undefined): string | null => {
|
|
541
|
-
const shown = t?.screens?.find((w) => !/[{<]/.test(w.path));
|
|
541
|
+
const shown = t?.screens?.find((w) => w.path.replace(/\/+$/, '') === '') ?? t?.screens?.find((w) => !/[{<]/.test(w.path));
|
|
542
542
|
return t && shown ? `${WORLDS}/${name}/${t.twin}${shown.path.startsWith('/') ? shown.path : `/${shown.path}`}` : null;
|
|
543
543
|
};
|
|
544
544
|
/** What an entry did, in words: the thing's kind and the vendor's verb, the thing's own label where it has one. */
|
|
@@ -1095,10 +1095,6 @@ function Workspace({ name, token, view, sub, arg, win, who, snapshot, onReturn,
|
|
|
1095
1095
|
const diff = useDoor<Diff>(token, `/-/${name}/diff`, every);
|
|
1096
1096
|
const sets = useDoor<{ changesets: ChangesetView[] }>(token, `/-/${name}/changesets`, every);
|
|
1097
1097
|
const rules = useDoor<{ changesets: ChangesetRules }>(token, `/-/${name}/rules`, every);
|
|
1098
|
-
// the sites this World's twins answer, each read at `<hostname>.<this World's origin>` (only on a World's own local origin)
|
|
1099
|
-
const sites = useDoor<{ sites: Array<{ twin: string; host: string }> }>(token, `/-/${name}/sites`, every);
|
|
1100
|
-
const siteAt = (host: string): string | null => (/^[^.]+--[^.]+\.localhost$/.test(window.location.hostname) ? `${window.location.protocol}//${host}.${window.location.host}/` : null);
|
|
1101
|
-
const siteLinks = sites.state === 'ok' ? sites.data.sites.flatMap((x) => { const at = siteAt(x.host); return at ? [{ ...x, at }] : []; }) : [];
|
|
1102
1098
|
const [picked, setPicked] = useState<string | null>(null);
|
|
1103
1099
|
const to = (parts: string[]) => (e?: React.MouseEvent): void => { e?.preventDefault(); go([...name.split('/'), '~', ...parts]); };
|
|
1104
1100
|
const vendors = twins.state === 'ok' ? twins.data.twins.map((t) => t.twin) : [];
|
|
@@ -1204,8 +1200,6 @@ function Workspace({ name, token, view, sub, arg, win, who, snapshot, onReturn,
|
|
|
1204
1200
|
{place((view === 'events' && !arg) || view === 'trace', <Icon name="activity" size={16} />, 'Events', 'events', to(['events']))}
|
|
1205
1201
|
<p className="side-group">Records</p>
|
|
1206
1202
|
{vendors.map((v) => <React.Fragment key={v}>{place(view === 'vendor' && arg === v, <Mark vendor={v} />, vendorName(v), `vendors/${v}`, to(['vendors', v]), held(v) ? String(held(v)) : undefined)}</React.Fragment>)}
|
|
1207
|
-
{siteLinks.length ? <p className="side-group">Sites</p> : null}
|
|
1208
|
-
{siteLinks.map((x) => <a key={x.host} href={x.at} target="_blank" rel="noreferrer" title={`${x.host} as ${vendorName(x.twin)} serves it in this World`}><Icon name="globe" size={16} /><span>{x.host}</span><Icon name="external-link" size={14} /></a>)}
|
|
1209
1203
|
<p className="side-group">Remote</p>
|
|
1210
1204
|
{place(false, <Icon name="cloud" size={16} />, there ? 'origin' : 'Name a remote…', 'remote', to(['remote']), waiting ? `↑${waiting}` : undefined)}
|
|
1211
1205
|
</nav>
|