@shipfox/client-shell 0.2.0
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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/dist/components/main-layout.d.ts +11 -0
- package/dist/components/main-layout.d.ts.map +1 -0
- package/dist/components/main-layout.js +39 -0
- package/dist/components/main-layout.js.map +1 -0
- package/dist/components/nav-bar.d.ts +4 -0
- package/dist/components/nav-bar.d.ts.map +1 -0
- package/dist/components/nav-bar.js +62 -0
- package/dist/components/nav-bar.js.map +1 -0
- package/dist/components/nav-tabs.d.ts +6 -0
- package/dist/components/nav-tabs.d.ts.map +1 -0
- package/dist/components/nav-tabs.js +38 -0
- package/dist/components/nav-tabs.js.map +1 -0
- package/dist/components/not-found-page.d.ts +2 -0
- package/dist/components/not-found-page.d.ts.map +1 -0
- package/dist/components/not-found-page.js +25 -0
- package/dist/components/not-found-page.js.map +1 -0
- package/dist/components/settings-nav.d.ts +5 -0
- package/dist/components/settings-nav.d.ts.map +1 -0
- package/dist/components/settings-nav.js +45 -0
- package/dist/components/settings-nav.js.map +1 -0
- package/dist/components/user-menu.d.ts +2 -0
- package/dist/components/user-menu.d.ts.map +1 -0
- package/dist/components/user-menu.js +76 -0
- package/dist/components/user-menu.js.map +1 -0
- package/dist/components/workspace-crumb.d.ts +7 -0
- package/dist/components/workspace-crumb.d.ts.map +1 -0
- package/dist/components/workspace-crumb.js +54 -0
- package/dist/components/workspace-crumb.js.map +1 -0
- package/dist/components/workspace-switcher.d.ts +5 -0
- package/dist/components/workspace-switcher.d.ts.map +1 -0
- package/dist/components/workspace-switcher.js +90 -0
- package/dist/components/workspace-switcher.js.map +1 -0
- package/dist/compose/compose-routes.d.ts +6 -0
- package/dist/compose/compose-routes.d.ts.map +1 -0
- package/dist/compose/compose-routes.js +53 -0
- package/dist/compose/compose-routes.js.map +1 -0
- package/dist/compose/errors.d.ts +26 -0
- package/dist/compose/errors.d.ts.map +1 -0
- package/dist/compose/errors.js +39 -0
- package/dist/compose/errors.js.map +1 -0
- package/dist/compose/merge-config.d.ts +4 -0
- package/dist/compose/merge-config.d.ts.map +1 -0
- package/dist/compose/merge-config.js +28 -0
- package/dist/compose/merge-config.js.map +1 -0
- package/dist/compose/normalize-route-path.d.ts +2 -0
- package/dist/compose/normalize-route-path.d.ts.map +1 -0
- package/dist/compose/normalize-route-path.js +7 -0
- package/dist/compose/normalize-route-path.js.map +1 -0
- package/dist/compose/validate-providers.d.ts +3 -0
- package/dist/compose/validate-providers.d.ts.map +1 -0
- package/dist/compose/validate-providers.js +32 -0
- package/dist/compose/validate-providers.js.map +1 -0
- package/dist/compose/validate-registries.d.ts +4 -0
- package/dist/compose/validate-registries.d.ts.map +1 -0
- package/dist/compose/validate-registries.js +50 -0
- package/dist/compose/validate-registries.js.map +1 -0
- package/dist/config/shell-config.d.ts +10 -0
- package/dist/config/shell-config.d.ts.map +1 -0
- package/dist/config/shell-config.js +12 -0
- package/dist/config/shell-config.js.map +1 -0
- package/dist/contract.d.ts +39 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +5 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/active-workspace.d.ts +4 -0
- package/dist/runtime/active-workspace.d.ts.map +1 -0
- package/dist/runtime/active-workspace.js +15 -0
- package/dist/runtime/active-workspace.js.map +1 -0
- package/dist/runtime/anchor-paths.d.ts +9 -0
- package/dist/runtime/anchor-paths.d.ts.map +1 -0
- package/dist/runtime/anchor-paths.js +18 -0
- package/dist/runtime/anchor-paths.js.map +1 -0
- package/dist/runtime/anchors.d.ts +19 -0
- package/dist/runtime/anchors.d.ts.map +1 -0
- package/dist/runtime/anchors.js +125 -0
- package/dist/runtime/anchors.js.map +1 -0
- package/dist/runtime/assemble-route-tree.d.ts +10 -0
- package/dist/runtime/assemble-route-tree.d.ts.map +1 -0
- package/dist/runtime/assemble-route-tree.js +30 -0
- package/dist/runtime/assemble-route-tree.js.map +1 -0
- package/dist/runtime/auth.d.ts +50 -0
- package/dist/runtime/auth.d.ts.map +1 -0
- package/dist/runtime/auth.js +194 -0
- package/dist/runtime/auth.js.map +1 -0
- package/dist/runtime/chrome-context.d.ts +10 -0
- package/dist/runtime/chrome-context.d.ts.map +1 -0
- package/dist/runtime/chrome-context.js +16 -0
- package/dist/runtime/chrome-context.js.map +1 -0
- package/dist/runtime/compose-client-app.d.ts +13 -0
- package/dist/runtime/compose-client-app.d.ts.map +1 -0
- package/dist/runtime/compose-client-app.js +93 -0
- package/dist/runtime/compose-client-app.js.map +1 -0
- package/dist/runtime/define-route.d.ts +19 -0
- package/dist/runtime/define-route.d.ts.map +1 -0
- package/dist/runtime/define-route.js +12 -0
- package/dist/runtime/define-route.js.map +1 -0
- package/dist/runtime/index.d.ts +20 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +21 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/last-workspace.d.ts +4 -0
- package/dist/runtime/last-workspace.d.ts.map +1 -0
- package/dist/runtime/last-workspace.js +20 -0
- package/dist/runtime/last-workspace.js.map +1 -0
- package/dist/runtime/nav-order.d.ts +7 -0
- package/dist/runtime/nav-order.d.ts.map +1 -0
- package/dist/runtime/nav-order.js +8 -0
- package/dist/runtime/nav-order.js.map +1 -0
- package/dist/runtime/provider-stack.d.ts +14 -0
- package/dist/runtime/provider-stack.d.ts.map +1 -0
- package/dist/runtime/provider-stack.js +28 -0
- package/dist/runtime/provider-stack.js.map +1 -0
- package/dist/runtime/registries.d.ts +4 -0
- package/dist/runtime/registries.d.ts.map +1 -0
- package/dist/runtime/registries.js +23 -0
- package/dist/runtime/registries.js.map +1 -0
- package/dist/runtime/router-context.d.ts +9 -0
- package/dist/runtime/router-context.d.ts.map +1 -0
- package/dist/runtime/router-context.js +3 -0
- package/dist/runtime/router-context.js.map +1 -0
- package/dist/runtime/workspace-setup.d.ts +18 -0
- package/dist/runtime/workspace-setup.d.ts.map +1 -0
- package/dist/runtime/workspace-setup.js +64 -0
- package/dist/runtime/workspace-setup.js.map +1 -0
- package/dist/testing/index.d.ts +17 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +35 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/dist/vite/evaluate-features.d.ts +8 -0
- package/dist/vite/evaluate-features.d.ts.map +1 -0
- package/dist/vite/evaluate-features.js +80 -0
- package/dist/vite/evaluate-features.js.map +1 -0
- package/dist/vite/generate.d.ts +9 -0
- package/dist/vite/generate.d.ts.map +1 -0
- package/dist/vite/generate.js +80 -0
- package/dist/vite/generate.js.map +1 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +3 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/plugin.d.ts +7 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +77 -0
- package/dist/vite/plugin.js.map +1 -0
- package/package.json +113 -0
- package/src/components/main-layout.tsx +45 -0
- package/src/components/nav-bar.tsx +41 -0
- package/src/components/nav-tabs.test.tsx +60 -0
- package/src/components/nav-tabs.tsx +47 -0
- package/src/components/not-found-page.tsx +14 -0
- package/src/components/settings-nav.tsx +35 -0
- package/src/components/user-menu.tsx +59 -0
- package/src/components/workspace-crumb.tsx +43 -0
- package/src/components/workspace-switcher.tsx +75 -0
- package/src/compose/compose-routes.test.ts +112 -0
- package/src/compose/compose-routes.ts +60 -0
- package/src/compose/errors.ts +54 -0
- package/src/compose/merge-config.test.ts +26 -0
- package/src/compose/merge-config.ts +27 -0
- package/src/compose/normalize-route-path.ts +6 -0
- package/src/compose/validate-providers.test.ts +31 -0
- package/src/compose/validate-providers.ts +36 -0
- package/src/compose/validate-registries.test.ts +92 -0
- package/src/compose/validate-registries.ts +61 -0
- package/src/config/config-screen.test.tsx +37 -0
- package/src/config/shell-config.ts +10 -0
- package/src/contract.ts +47 -0
- package/src/index.ts +1 -0
- package/src/runtime/active-workspace.ts +13 -0
- package/src/runtime/anchor-paths.ts +18 -0
- package/src/runtime/anchors.tsx +106 -0
- package/src/runtime/assemble-route-tree.ts +42 -0
- package/src/runtime/auth.tsx +213 -0
- package/src/runtime/chrome-context.tsx +22 -0
- package/src/runtime/compose-client-app.tsx +122 -0
- package/src/runtime/define-route.test.ts +15 -0
- package/src/runtime/define-route.ts +33 -0
- package/src/runtime/index.ts +19 -0
- package/src/runtime/last-workspace.ts +22 -0
- package/src/runtime/nav-order.ts +1 -0
- package/src/runtime/provider-stack.tsx +39 -0
- package/src/runtime/providers.test.tsx +51 -0
- package/src/runtime/registries.test.tsx +100 -0
- package/src/runtime/registries.ts +42 -0
- package/src/runtime/router-context.ts +9 -0
- package/src/runtime/routes.test.tsx +48 -0
- package/src/runtime/workspace-setup.tsx +61 -0
- package/src/testing/index.test.tsx +57 -0
- package/src/testing/index.tsx +51 -0
- package/src/vite/evaluate-features.test.ts +34 -0
- package/src/vite/evaluate-features.ts +93 -0
- package/src/vite/generate.test.ts +22 -0
- package/src/vite/generate.ts +99 -0
- package/src/vite/generated-router.test.tsx +58 -0
- package/src/vite/index.ts +1 -0
- package/src/vite/plugin.test.ts +181 -0
- package/src/vite/plugin.ts +114 -0
- package/src/vite/validate.test.ts +166 -0
- package/test/default-route-impl.tsx +3 -0
- package/test/external/FINDINGS.md +53 -0
- package/test/external/README.md +39 -0
- package/test/external/fixture/index.html +12 -0
- package/test/external/fixture/package.json +32 -0
- package/test/external/fixture/src/app.fixture.tsx +72 -0
- package/test/external/fixture/src/features/override-impl.tsx +12 -0
- package/test/external/fixture/src/features/override.tsx +20 -0
- package/test/external/fixture/src/features.collision.ts +15 -0
- package/test/external/fixture/src/features.ts +4 -0
- package/test/external/fixture/src/link-typecheck.tsx +10 -0
- package/test/external/fixture/src/main.tsx +4 -0
- package/test/external/fixture/tsconfig.json +15 -0
- package/test/external/fixture/vite.config.ts +10 -0
- package/test/external/fixture/vitest.config.ts +15 -0
- package/test/external/toy-feature/CHANGELOG.md +15 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-biome-check +43 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-biome-format +43 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-biome-lint +43 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-swc +43 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-tsc-check +43 -0
- package/test/external/toy-feature/node_modules/.bin/shipfox-tsc-emit +43 -0
- package/test/external/toy-feature/package.json +57 -0
- package/test/external/toy-feature/src/config.ts +5 -0
- package/test/external/toy-feature/src/index.ts +64 -0
- package/test/external/toy-feature/src/provider.tsx +33 -0
- package/test/external/toy-feature/src/routes/insights.tsx +7 -0
- package/test/external/toy-feature/src/routes/settings.tsx +7 -0
- package/test/external/toy-feature/tsconfig.build.json +5 -0
- package/test/external/toy-feature/tsconfig.json +1 -0
- package/test/external/verify.mjs +318 -0
- package/test/fixtures/features.ts +56 -0
- package/test/named-route-impl.tsx +3 -0
- package/test/not-route-impl.ts +1 -0
- package/test/render.tsx +67 -0
- package/test/search-route-impl.tsx +7 -0
- package/test/setup.ts +3 -0
- package/test/typecheck/shipfox-app.gen.ts +85 -0
- package/test/typecheck/types.tsx +18 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +1 -0
- package/tsconfig.test.json +12 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {defineClientFeature} from '#contract.js';
|
|
2
|
+
|
|
3
|
+
export const features = [
|
|
4
|
+
defineClientFeature({
|
|
5
|
+
id: 'shipfox.projects',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
path: '/workspaces/$wid/projects/$pid/overview',
|
|
9
|
+
parent: 'projectLayout',
|
|
10
|
+
impl: '#test/default-route-impl.js',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: '/workspaces/$wid/settings/members',
|
|
14
|
+
parent: 'workspaceSettings',
|
|
15
|
+
impl: '#test/default-route-impl.js',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
navigation: [
|
|
19
|
+
{
|
|
20
|
+
id: 'projects',
|
|
21
|
+
scope: 'workspace',
|
|
22
|
+
label: 'Projects',
|
|
23
|
+
to: '/workspaces/$wid/projects/$pid/overview',
|
|
24
|
+
order: 100,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
settingsSections: [
|
|
28
|
+
{id: 'members', pathSegment: 'members', label: 'Members', icon: 'users', order: 100},
|
|
29
|
+
],
|
|
30
|
+
}),
|
|
31
|
+
defineClientFeature({
|
|
32
|
+
id: 'acme.insights',
|
|
33
|
+
routes: [
|
|
34
|
+
{
|
|
35
|
+
path: '/workspaces/$wid/insights',
|
|
36
|
+
parent: 'workspaceLayout',
|
|
37
|
+
impl: '#test/named-route-impl.js',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: '/workspaces/$wid/projects/$pid/overview',
|
|
41
|
+
parent: 'projectLayout',
|
|
42
|
+
override: true,
|
|
43
|
+
impl: '#test/search-route-impl.js',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
navigation: [
|
|
47
|
+
{
|
|
48
|
+
id: 'insights',
|
|
49
|
+
scope: 'workspace',
|
|
50
|
+
label: 'Insights',
|
|
51
|
+
to: '/workspaces/$wid/insights',
|
|
52
|
+
order: 200,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
}),
|
|
56
|
+
] as const;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const value = 'not a route implementation';
|
package/test/render.tsx
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {QueryClient} from '@tanstack/react-query';
|
|
2
|
+
import {createMemoryHistory, createRouter, Outlet, RouterProvider} from '@tanstack/react-router';
|
|
3
|
+
import {render} from '@testing-library/react';
|
|
4
|
+
import {createStore} from 'jotai';
|
|
5
|
+
import {composeRoutes} from '#compose/compose-routes.js';
|
|
6
|
+
import type {ClientFeature} from '#contract.js';
|
|
7
|
+
import {assembleRouteTree, type ResolveRouteImpl} from '#runtime/assemble-route-tree.js';
|
|
8
|
+
import {type AuthStateValue, authStateAtom} from '#runtime/auth.js';
|
|
9
|
+
import {ChromeProvider, type ChromeSlots} from '#runtime/chrome-context.js';
|
|
10
|
+
import {ShellProviderStack} from '#runtime/provider-stack.js';
|
|
11
|
+
import {navigationEntries, settingsEntries} from '#runtime/registries.js';
|
|
12
|
+
|
|
13
|
+
export async function renderComposedShell({
|
|
14
|
+
features,
|
|
15
|
+
initialPath,
|
|
16
|
+
resolveImpl,
|
|
17
|
+
}: {
|
|
18
|
+
features: readonly ClientFeature[];
|
|
19
|
+
initialPath: string;
|
|
20
|
+
resolveImpl: ResolveRouteImpl;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
router: unknown;
|
|
23
|
+
queryClient: QueryClient;
|
|
24
|
+
store: ReturnType<typeof createStore>;
|
|
25
|
+
}> {
|
|
26
|
+
const routeTree = await assembleRouteTree(composeRoutes(features), {
|
|
27
|
+
resolveImpl,
|
|
28
|
+
navigation: navigationEntries(features),
|
|
29
|
+
settingsSections: settingsEntries(features),
|
|
30
|
+
});
|
|
31
|
+
const queryClient = new QueryClient({defaultOptions: {queries: {retry: false}}});
|
|
32
|
+
const store = createStore();
|
|
33
|
+
const auth: AuthStateValue = {
|
|
34
|
+
status: 'authenticated',
|
|
35
|
+
workspaces: [{id: 'workspace', name: 'Workspace', membershipId: 'membership'}],
|
|
36
|
+
isLoading: false,
|
|
37
|
+
isAuthenticated: true,
|
|
38
|
+
hasWorkspace: true,
|
|
39
|
+
};
|
|
40
|
+
const chrome: ChromeSlots = {
|
|
41
|
+
ProjectBreadcrumb: () => null,
|
|
42
|
+
ProjectLayoutGuard: Outlet,
|
|
43
|
+
};
|
|
44
|
+
store.set(authStateAtom, auth);
|
|
45
|
+
const router = createRouter({
|
|
46
|
+
history: createMemoryHistory({initialEntries: [initialPath]}),
|
|
47
|
+
routeTree,
|
|
48
|
+
context: {
|
|
49
|
+
auth,
|
|
50
|
+
queryClient,
|
|
51
|
+
workspaceSetup: async () => ({hideProjectNavigation: false}),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
render(
|
|
55
|
+
<ChromeProvider chrome={chrome}>
|
|
56
|
+
<ShellProviderStack
|
|
57
|
+
features={features}
|
|
58
|
+
queryClient={queryClient}
|
|
59
|
+
store={store}
|
|
60
|
+
auth={{effects: false}}
|
|
61
|
+
>
|
|
62
|
+
<RouterProvider router={router} />
|
|
63
|
+
</ShellProviderStack>
|
|
64
|
+
</ChromeProvider>,
|
|
65
|
+
);
|
|
66
|
+
return {router, queryClient, store};
|
|
67
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {defineRoute} from '@shipfox/client-shell/runtime';
|
|
2
|
+
|
|
3
|
+
export default defineRoute({
|
|
4
|
+
component: () => <div>Search route</div>,
|
|
5
|
+
validateSearch: (search: Record<string, unknown>) =>
|
|
6
|
+
({tab: search.tab === 'activity' ? 'activity' : 'overview'}) as const,
|
|
7
|
+
});
|
package/test/setup.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// GENERATED by @shipfox/client-shell/vite. Do not edit.
|
|
2
|
+
// biome-ignore-all format: generated code has stable, reviewable output.
|
|
3
|
+
// biome-ignore-all assist/source/organizeImports: generated imports follow route order.
|
|
4
|
+
import {createRoute, createRouter} from '@tanstack/react-router';
|
|
5
|
+
import {buildAnchorSkeleton, isRouteImpl, type RouteImpl, type RouterContext} from '@shipfox/client-shell/runtime';
|
|
6
|
+
import route0Impl from "#test/search-route-impl.js";
|
|
7
|
+
import route1Impl from "#test/default-route-impl.js";
|
|
8
|
+
import route2Impl from "#test/named-route-impl.js";
|
|
9
|
+
|
|
10
|
+
function routeOptions<T extends RouteImpl>(routeImpl: T, impl: string, path: string): T['options'] {
|
|
11
|
+
if (!isRouteImpl(routeImpl)) {
|
|
12
|
+
throw new TypeError(`Route implementation "${impl}" for "${path}" must export default defineRoute(...).`);
|
|
13
|
+
}
|
|
14
|
+
return routeImpl.options;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const skeleton = buildAnchorSkeleton({
|
|
18
|
+
navigation: [
|
|
19
|
+
{
|
|
20
|
+
"id": "projects",
|
|
21
|
+
"scope": "workspace",
|
|
22
|
+
"label": "Projects",
|
|
23
|
+
"to": "/workspaces/$wid/projects/$pid/overview",
|
|
24
|
+
"order": 100
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "insights",
|
|
28
|
+
"scope": "workspace",
|
|
29
|
+
"label": "Insights",
|
|
30
|
+
"to": "/workspaces/$wid/insights",
|
|
31
|
+
"order": 200
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
settingsSections: [
|
|
35
|
+
{
|
|
36
|
+
"id": "members",
|
|
37
|
+
"pathSegment": "members",
|
|
38
|
+
"label": "Members",
|
|
39
|
+
"icon": "users",
|
|
40
|
+
"order": 100
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const route0 = createRoute({
|
|
46
|
+
getParentRoute: () => skeleton.projectLayout,
|
|
47
|
+
path: "/overview",
|
|
48
|
+
...routeOptions(route0Impl, "#test/search-route-impl.js", "/workspaces/$wid/projects/$pid/overview"),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const route1 = createRoute({
|
|
52
|
+
getParentRoute: () => skeleton.workspaceSettings,
|
|
53
|
+
path: "/members",
|
|
54
|
+
...routeOptions(route1Impl, "#test/default-route-impl.js", "/workspaces/$wid/settings/members"),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const route2 = createRoute({
|
|
58
|
+
getParentRoute: () => skeleton.workspaceLayout,
|
|
59
|
+
path: "/insights",
|
|
60
|
+
...routeOptions(route2Impl, "#test/named-route-impl.js", "/workspaces/$wid/insights"),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const projectLayout = skeleton.projectLayout.addChildren([route0]);
|
|
64
|
+
const workspaceSettings = skeleton.workspaceSettings.addChildren([route1]);
|
|
65
|
+
const workspaceLayout = skeleton.workspaceLayout.addChildren([
|
|
66
|
+
route2,
|
|
67
|
+
projectLayout,
|
|
68
|
+
workspaceSettings,
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
export const routeTree = skeleton.rootRoute.addChildren([
|
|
72
|
+
workspaceLayout,
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
export const router = createRouter({
|
|
76
|
+
routeTree,
|
|
77
|
+
context: {auth: undefined, queryClient: undefined} satisfies RouterContext,
|
|
78
|
+
scrollRestoration: true,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
declare module '@tanstack/react-router' {
|
|
82
|
+
interface Register {
|
|
83
|
+
router: typeof router;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {Link, useSearch} from '@tanstack/react-router';
|
|
2
|
+
import './shipfox-app.gen.js';
|
|
3
|
+
|
|
4
|
+
export function CompositionTypes(): React.ReactNode {
|
|
5
|
+
const search = useSearch({from: '/workspaces/$wid/projects/$pid/overview'});
|
|
6
|
+
const tab: 'activity' | 'overview' = search.tab;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Link to="/workspaces/$wid/insights" params={{wid: 'workspace'}}>
|
|
11
|
+
Insights
|
|
12
|
+
</Link>
|
|
13
|
+
<span>{tab}</span>
|
|
14
|
+
{/* @ts-expect-error The generated route tree rejects unknown paths. */}
|
|
15
|
+
<Link to="/not-a-route">Missing route</Link>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|