create-disposabl-app 0.3.3 → 0.4.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.
Files changed (46) hide show
  1. package/dist/index.js +32 -6
  2. package/dist/templates/default/.github/workflows/pipeline.yml.example +55 -1
  3. package/dist/templates/default/apps/web/src/routeTree.gen.ts +49 -5
  4. package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.api-keys.tsx +154 -0
  5. package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +23 -5
  6. package/dist/templates/default/bun.lock +319 -89
  7. package/dist/templates/default/disposabl.json +3 -1
  8. package/dist/templates/default/package.json +4 -2
  9. package/dist/templates/default/packages/backend/generate.ts +9 -0
  10. package/dist/templates/default/packages/cli/README.md +17 -0
  11. package/dist/templates/default/packages/cli/auth.ts +301 -0
  12. package/dist/templates/default/packages/cli/build.ts +9 -0
  13. package/dist/templates/default/packages/cli/index.ts +146 -0
  14. package/dist/templates/default/packages/cli/package.json +44 -0
  15. package/dist/templates/default/packages/cli/release.config.mjs +6 -0
  16. package/dist/templates/default/packages/cli/tsconfig.json +15 -0
  17. package/dist/templates/default/packages/disposabl-kit/package.json +3 -1
  18. package/dist/templates/default/packages/disposabl-kit/platforms.ts +4 -4
  19. package/dist/templates/default/packages/disposabl-kit/server/http.ts +24 -5
  20. package/dist/templates/default/packages/disposabl-kit/server/release/README.md +13 -0
  21. package/dist/templates/default/packages/disposabl-kit/server/release/clients.mjs +99 -0
  22. package/dist/templates/default/packages/sdk/README.md +20 -0
  23. package/dist/templates/default/packages/sdk/openapi-ts.config.ts +10 -0
  24. package/dist/templates/default/packages/sdk/package.json +40 -0
  25. package/dist/templates/default/packages/sdk/release.config.mjs +6 -0
  26. package/dist/templates/default/packages/sdk/src/config.ts +11 -0
  27. package/dist/templates/default/packages/sdk/src/generated/client/client.gen.ts +300 -0
  28. package/dist/templates/default/packages/sdk/src/generated/client/index.ts +27 -0
  29. package/dist/templates/default/packages/sdk/src/generated/client/types.gen.ts +238 -0
  30. package/dist/templates/default/packages/sdk/src/generated/client/utils.gen.ts +337 -0
  31. package/dist/templates/default/packages/sdk/src/generated/client.gen.ts +28 -0
  32. package/dist/templates/default/packages/sdk/src/generated/core/auth.gen.ts +49 -0
  33. package/dist/templates/default/packages/sdk/src/generated/core/bodySerializer.gen.ts +96 -0
  34. package/dist/templates/default/packages/sdk/src/generated/core/params.gen.ts +188 -0
  35. package/dist/templates/default/packages/sdk/src/generated/core/pathSerializer.gen.ts +186 -0
  36. package/dist/templates/default/packages/sdk/src/generated/core/queryKeySerializer.gen.ts +134 -0
  37. package/dist/templates/default/packages/sdk/src/generated/core/serverSentEvents.gen.ts +265 -0
  38. package/dist/templates/default/packages/sdk/src/generated/core/types.gen.ts +126 -0
  39. package/dist/templates/default/packages/sdk/src/generated/core/utils.gen.ts +146 -0
  40. package/dist/templates/default/packages/sdk/src/generated/index.ts +18 -0
  41. package/dist/templates/default/packages/sdk/src/generated/sdk.gen.ts +82 -0
  42. package/dist/templates/default/packages/sdk/src/generated/types.gen.ts +134 -0
  43. package/dist/templates/default/packages/sdk/src/index.ts +3 -0
  44. package/dist/templates/default/packages/sdk/tsconfig.build.json +10 -0
  45. package/dist/templates/default/packages/sdk/tsconfig.json +12 -0
  46. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
8
8
  import { Command, CommanderError } from "commander";
9
9
  import * as p2 from "@clack/prompts";
10
10
  // package.json
11
- var version = "0.3.3";
11
+ var version = "0.4.0";
12
12
 
13
13
  // ../disposabl-kit/platforms.ts
14
14
  var platforms = [
@@ -39,8 +39,8 @@ var platforms = [
39
39
  group: "MCP & plugins",
40
40
  status: "available"
41
41
  },
42
- { id: "api", label: "API", group: "Coming soon", status: "disabled" },
43
- { id: "cli", label: "CLI", group: "Coming soon", status: "disabled" },
42
+ { id: "api", label: "API", group: "Developer tools", status: "available" },
43
+ { id: "cli", label: "CLI", group: "Developer tools", status: "available" },
44
44
  {
45
45
  id: "python-sdk",
46
46
  label: "Python SDK",
@@ -50,8 +50,8 @@ var platforms = [
50
50
  {
51
51
  id: "typescript-sdk",
52
52
  label: "TypeScript SDK",
53
- group: "Coming soon",
54
- status: "disabled"
53
+ group: "Developer tools",
54
+ status: "available"
55
55
  }
56
56
  ];
57
57
  var platformIds = platforms.map(({ id }) => id);
@@ -115,6 +115,10 @@ function selectFeatures(input = "none") {
115
115
  }
116
116
  function selectedFolders(config) {
117
117
  const result = ["apps/web"];
118
+ if (config.platforms.includes("cli"))
119
+ result.push("packages/cli");
120
+ if (config.platforms.includes("typescript-sdk"))
121
+ result.push("packages/sdk");
118
122
  if (config.platforms.some((platform) => platform === "android" || platform === "ios"))
119
123
  result.push("apps/mobile");
120
124
  if (config.platforms.some((platform) => ["windows", "linux", "macos"].includes(platform)))
@@ -351,6 +355,26 @@ async function createApp(template, destination, name, config, overwrite = false)
351
355
  force: true
352
356
  });
353
357
  }
358
+ for (const kind of ["cli", "sdk"]) {
359
+ const folder = join(destination, "packages", kind);
360
+ if (!folders.includes(`packages/${kind}`)) {
361
+ await rm(folder, { recursive: true, force: true });
362
+ continue;
363
+ }
364
+ const packagePath = join(folder, "package.json");
365
+ const client = JSON.parse(await readFile(packagePath, "utf8"));
366
+ client.name = `${name}-${kind}`;
367
+ delete client.repository;
368
+ if (client.name.length > 214)
369
+ throw new Error("Project name is too long for generated package names.");
370
+ if (kind === "cli")
371
+ client.bin = { [name]: "dist/index.js" };
372
+ await writeFile(packagePath, JSON.stringify(client, null, 2) + `
373
+ `);
374
+ const readme = join(folder, "README.md");
375
+ if (existsSync(readme))
376
+ await writeFile(readme, (await readFile(readme, "utf8")).replaceAll(`@disposabl/${kind}`, client.name));
377
+ }
354
378
  if (existsSync(join(destination, "gitignore"))) {
355
379
  await rename(join(destination, "gitignore"), join(destination, ".gitignore"));
356
380
  }
@@ -419,6 +443,8 @@ function showOptions(json) {
419
443
  defaults: { platforms: ["web"], features: selectFeatures() },
420
444
  folders: {
421
445
  web: "apps/web",
446
+ cli: "packages/cli",
447
+ "typescript-sdk": "packages/sdk",
422
448
  android: "apps/mobile",
423
449
  ios: "apps/mobile",
424
450
  windows: "apps/desktop",
@@ -428,7 +454,7 @@ function showOptions(json) {
428
454
  blog: "apps/blog",
429
455
  changelog: "apps/changelog"
430
456
  },
431
- configOnly: ["mcp", "openai-plugin", "claude-code-plugin"]
457
+ configOnly: ["api", "mcp", "openai-plugin", "claude-code-plugin"]
432
458
  }, null, 2));
433
459
  return;
434
460
  }
@@ -1,4 +1,4 @@
1
- name: Preview
1
+ name: Pipeline
2
2
  on:
3
3
  pull_request:
4
4
  branches: [main]
@@ -126,6 +126,11 @@ jobs:
126
126
  run: bun install --frozen-lockfile ${{ github.job == 'desktop' && '--filter desktop' || (github.job == 'ios' || github.job == 'android') && '--filter @disposabl/mobile' || '' }}
127
127
  - name: Check
128
128
  run: bun run check
129
+ - name: Build selected clients
130
+ run: |
131
+ for package in cli sdk; do
132
+ if test -f "packages/$package/package.json"; then bun run --cwd "packages/$package" build; fi
133
+ done
129
134
  - name: Deploy
130
135
  id: deploy
131
136
  env:
@@ -490,3 +495,52 @@ jobs:
490
495
  - name: Clean
491
496
  if: always() && matrix.platform == 'macos'
492
497
  run: rm -f "$RUNNER_TEMP/notary.p8"
498
+
499
+ packages:
500
+ name: Package / ${{ matrix.package }}
501
+ needs: web
502
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
503
+ runs-on: ubuntu-latest
504
+ permissions:
505
+ contents: write
506
+ id-token: write
507
+ concurrency:
508
+ group: npm-${{ matrix.package }}
509
+ cancel-in-progress: false
510
+ queue: max
511
+ strategy:
512
+ fail-fast: false
513
+ matrix:
514
+ package: [cli, sdk]
515
+ steps:
516
+ - uses: actions/checkout@v6
517
+ with:
518
+ fetch-depth: 0
519
+ persist-credentials: false
520
+ - name: Selected package
521
+ id: selected
522
+ run: echo "exists=$(test -f packages/${{ matrix.package }}/package.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
523
+ - uses: actions/setup-node@v6
524
+ if: steps.selected.outputs.exists == 'true'
525
+ with:
526
+ node-version: '24'
527
+ package-manager-cache: false
528
+ - uses: oven-sh/setup-bun@v2
529
+ if: steps.selected.outputs.exists == 'true'
530
+ with:
531
+ bun-version: '1.4.4'
532
+ - name: Install and generate
533
+ if: steps.selected.outputs.exists == 'true'
534
+ run: |
535
+ bun install --frozen-lockfile
536
+ bun run generate
537
+ - name: Validate package
538
+ if: steps.selected.outputs.exists == 'true'
539
+ run: bun run --cwd packages/${{ matrix.package }} typecheck
540
+ - name: Publish
541
+ if: steps.selected.outputs.exists == 'true'
542
+ working-directory: packages/${{ matrix.package }}
543
+ run: bun run release
544
+ env:
545
+ GITHUB_TOKEN: ${{ github.token }}
546
+ npm_config_workspaces_update: 'false'
@@ -16,6 +16,7 @@ import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsen
16
16
  import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/login'
17
17
  import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/signUp'
18
18
  import { Route as AuthenticatedDashboardRouteImport } from './router/_authenticated/dashboard'
19
+ import { Route as AuthenticatedDashboardDotapiKeysRouteImport } from './router/_authenticated/dashboard.api-keys'
19
20
  import { Route as AuthenticatedTodosIndexRouteImport } from './router/_authenticated/todos/index'
20
21
  import { Route as AuthenticatedTodosIdRouteImport } from './router/_authenticated/todos/$id'
21
22
 
@@ -73,6 +74,12 @@ const AuthenticatedDashboardRoute = AuthenticatedDashboardRouteImport.update({
73
74
  getParentRoute: () =>
74
75
  DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthenticatedRouteRoute,
75
76
  } as any)
77
+ const AuthenticatedDashboardDotapiKeysRoute =
78
+ AuthenticatedDashboardDotapiKeysRouteImport.update({
79
+ id: '/api-keys',
80
+ path: '/api-keys',
81
+ getParentRoute: () => AuthenticatedDashboardRoute,
82
+ } as any)
76
83
  const AuthenticatedTodosIndexRoute = AuthenticatedTodosIndexRouteImport.update({
77
84
  id: '/todos/',
78
85
  path: '/todos/',
@@ -91,7 +98,8 @@ export interface FileRoutesByFullPath {
91
98
  '/consent': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
92
99
  '/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
93
100
  '/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
94
- '/dashboard': typeof AuthenticatedDashboardRoute
101
+ '/dashboard': typeof AuthenticatedDashboardRouteWithChildren
102
+ '/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
95
103
  '/todos/$id': typeof AuthenticatedTodosIdRoute
96
104
  '/todos/': typeof AuthenticatedTodosIndexRoute
97
105
  }
@@ -100,7 +108,8 @@ export interface FileRoutesByTo {
100
108
  '/consent': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
101
109
  '/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
102
110
  '/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
103
- '/dashboard': typeof AuthenticatedDashboardRoute
111
+ '/dashboard': typeof AuthenticatedDashboardRouteWithChildren
112
+ '/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
104
113
  '/todos/$id': typeof AuthenticatedTodosIdRoute
105
114
  '/todos': typeof AuthenticatedTodosIndexRoute
106
115
  }
@@ -112,7 +121,8 @@ export interface FileRoutesById {
112
121
  '/_providers/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
113
122
  '/_providers/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
114
123
  '/_providers/': typeof IndexRoute
115
- '/_providers/_authenticated/dashboard': typeof AuthenticatedDashboardRoute
124
+ '/_providers/_authenticated/dashboard': typeof AuthenticatedDashboardRouteWithChildren
125
+ '/_providers/_authenticated/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
116
126
  '/_providers/_authenticated/todos/$id': typeof AuthenticatedTodosIdRoute
117
127
  '/_providers/_authenticated/todos/': typeof AuthenticatedTodosIndexRoute
118
128
  }
@@ -124,6 +134,7 @@ export interface FileRouteTypes {
124
134
  | '/login'
125
135
  | '/signup'
126
136
  | '/dashboard'
137
+ | '/dashboard/api-keys'
127
138
  | '/todos/$id'
128
139
  | '/todos/'
129
140
  fileRoutesByTo: FileRoutesByTo
@@ -133,6 +144,7 @@ export interface FileRouteTypes {
133
144
  | '/login'
134
145
  | '/signup'
135
146
  | '/dashboard'
147
+ | '/dashboard/api-keys'
136
148
  | '/todos/$id'
137
149
  | '/todos'
138
150
  id:
@@ -144,6 +156,7 @@ export interface FileRouteTypes {
144
156
  | '/_providers/signup'
145
157
  | '/_providers/'
146
158
  | '/_providers/_authenticated/dashboard'
159
+ | '/_providers/_authenticated/dashboard/api-keys'
147
160
  | '/_providers/_authenticated/todos/$id'
148
161
  | '/_providers/_authenticated/todos/'
149
162
  fileRoutesById: FileRoutesById
@@ -203,6 +216,13 @@ declare module '@tanstack/react-router' {
203
216
  preLoaderRoute: typeof AuthenticatedDashboardRouteImport
204
217
  parentRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthenticatedRouteRoute
205
218
  }
219
+ '/_providers/_authenticated/dashboard/api-keys': {
220
+ id: '/_providers/_authenticated/dashboard/api-keys'
221
+ path: '/api-keys'
222
+ fullPath: '/dashboard/api-keys'
223
+ preLoaderRoute: typeof AuthenticatedDashboardDotapiKeysRouteImport
224
+ parentRoute: typeof AuthenticatedDashboardRoute
225
+ }
206
226
  '/_providers/_authenticated/todos/': {
207
227
  id: '/_providers/_authenticated/todos/'
208
228
  path: '/todos'
@@ -220,15 +240,30 @@ declare module '@tanstack/react-router' {
220
240
  }
221
241
  }
222
242
 
243
+ interface AuthenticatedDashboardRouteChildren {
244
+ AuthenticatedDashboardDotapiKeysRoute: typeof AuthenticatedDashboardDotapiKeysRoute
245
+ }
246
+
247
+ const AuthenticatedDashboardRouteChildren: AuthenticatedDashboardRouteChildren =
248
+ {
249
+ AuthenticatedDashboardDotapiKeysRoute:
250
+ AuthenticatedDashboardDotapiKeysRoute,
251
+ }
252
+
253
+ const AuthenticatedDashboardRouteWithChildren =
254
+ AuthenticatedDashboardRoute._addFileChildren(
255
+ AuthenticatedDashboardRouteChildren,
256
+ )
257
+
223
258
  interface DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthenticatedRouteRouteChildren {
224
- AuthenticatedDashboardRoute: typeof AuthenticatedDashboardRoute
259
+ AuthenticatedDashboardRoute: typeof AuthenticatedDashboardRouteWithChildren
225
260
  AuthenticatedTodosIdRoute: typeof AuthenticatedTodosIdRoute
226
261
  AuthenticatedTodosIndexRoute: typeof AuthenticatedTodosIndexRoute
227
262
  }
228
263
 
229
264
  const DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthenticatedRouteRouteChildren: DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthenticatedRouteRouteChildren =
230
265
  {
231
- AuthenticatedDashboardRoute: AuthenticatedDashboardRoute,
266
+ AuthenticatedDashboardRoute: AuthenticatedDashboardRouteWithChildren,
232
267
  AuthenticatedTodosIdRoute: AuthenticatedTodosIdRoute,
233
268
  AuthenticatedTodosIndexRoute: AuthenticatedTodosIndexRoute,
234
269
  }
@@ -271,3 +306,12 @@ const rootRouteChildren: RootRouteChildren = {
271
306
  export const routeTree = rootRouteImport
272
307
  ._addFileChildren(rootRouteChildren)
273
308
  ._addFileTypes<FileRouteTypes>()
309
+
310
+ import type { getRouter } from './router.tsx'
311
+ import type { createStart } from '@tanstack/react-start'
312
+ declare module '@tanstack/react-start' {
313
+ interface Register {
314
+ ssr: true
315
+ router: Awaited<ReturnType<typeof getRouter>>
316
+ }
317
+ }
@@ -0,0 +1,154 @@
1
+ import { useState } from "react";
2
+ import { createFileRoute } from "@tanstack/react-router";
3
+ import { useAction, useMutation, useQuery } from "convex/react";
4
+ import { api } from "../../../../../packages/backend/convex/_generated/api";
5
+ import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
6
+ import { Input } from "@disposabl/disposabl-kit/client/components/ui/input";
7
+ import config from "../../../../../disposabl.json";
8
+
9
+ export const Route = createFileRoute(
10
+ "/_providers/_authenticated/dashboard/api-keys",
11
+ )({ component: ApiKeys });
12
+ function ApiKeys() {
13
+ const enabled = config.platforms.includes("api");
14
+ const connections = useQuery(api.mcp.listConnections, enabled ? {} : "skip");
15
+ const create = useAction(api.mcp.createApiKey);
16
+ const revoke = useMutation(api.mcp.revokeConnection);
17
+ const [name, setName] = useState("");
18
+ const [key, setKey] = useState<string>();
19
+ const [pending, setPending] = useState(false);
20
+ const [error, setError] = useState<string>();
21
+ const [copied, setCopied] = useState(false);
22
+ if (!enabled)
23
+ return (
24
+ <main className="mx-auto max-w-xl p-6">
25
+ <h1 className="text-2xl font-semibold">API access is not enabled</h1>
26
+ </main>
27
+ );
28
+ const keys = connections?.filter(
29
+ (connection) => connection.kind === "apiKey",
30
+ );
31
+ return (
32
+ <main className="mx-auto max-w-xl space-y-6 p-6">
33
+ <h1 className="text-2xl font-semibold">API keys</h1>
34
+ <p>
35
+ Use a key with the API or TypeScript SDK. Each key can access your data
36
+ through all enabled operations.
37
+ </p>
38
+ <form
39
+ className="flex gap-2"
40
+ onSubmit={async (event) => {
41
+ event.preventDefault();
42
+ if (pending) return;
43
+ setPending(true);
44
+ setError(undefined);
45
+ try {
46
+ const result = await create({ name: name.trim(), scopes: [] });
47
+ setKey(result.apiKey);
48
+ setName("");
49
+ setCopied(false);
50
+ } catch {
51
+ setError("Could not create the key. Please try again.");
52
+ } finally {
53
+ setPending(false);
54
+ }
55
+ }}
56
+ >
57
+ <label className="flex-1">
58
+ Key name
59
+ <Input
60
+ value={name}
61
+ maxLength={100}
62
+ required
63
+ onChange={(event) => setName(event.target.value)}
64
+ placeholder="My integration"
65
+ />
66
+ </label>
67
+ <Button
68
+ type="submit"
69
+ className="self-end"
70
+ disabled={pending || !name.trim() || !!key}
71
+ >
72
+ Create key
73
+ </Button>
74
+ </form>
75
+ {key && (
76
+ <section
77
+ className="space-y-3 rounded border p-4"
78
+ aria-label="New API key"
79
+ >
80
+ <p>Copy this key now. It will not be shown again.</p>
81
+ <label className="block">
82
+ API key
83
+ <textarea
84
+ className="mt-2 w-full rounded border p-2 font-mono text-sm"
85
+ readOnly
86
+ value={key}
87
+ spellCheck={false}
88
+ />
89
+ </label>
90
+ <div className="flex gap-2">
91
+ <Button
92
+ onClick={async () => {
93
+ try {
94
+ await navigator.clipboard.writeText(key);
95
+ setCopied(true);
96
+ } catch {
97
+ setError("Copy failed. Select and copy the key manually.");
98
+ }
99
+ }}
100
+ >
101
+ {copied ? "Copied" : "Copy key"}
102
+ </Button>
103
+ <Button variant="outline" onClick={() => setKey(undefined)}>
104
+ Done
105
+ </Button>
106
+ </div>
107
+ </section>
108
+ )}
109
+ {error && (
110
+ <p role="alert" className="text-destructive">
111
+ {error}
112
+ </p>
113
+ )}
114
+ {keys === undefined ? (
115
+ <p role="status">Loading keys…</p>
116
+ ) : (
117
+ <ul className="space-y-3">
118
+ {keys.map((connection) => (
119
+ <li
120
+ key={connection.id}
121
+ className="flex items-center justify-between gap-4 rounded border p-4"
122
+ >
123
+ <div>
124
+ <p className="font-medium">{connection.name}</p>
125
+ <p className="text-sm text-muted-foreground">
126
+ Created {new Date(connection.createdAt).toLocaleDateString()}
127
+ </p>
128
+ </div>
129
+ <Button
130
+ variant="outline"
131
+ disabled={pending}
132
+ onClick={async () => {
133
+ setPending(true);
134
+ setError(undefined);
135
+ try {
136
+ await revoke({ id: connection.id });
137
+ setKey(undefined);
138
+ } catch {
139
+ setError("Could not revoke the key. Please try again.");
140
+ } finally {
141
+ setPending(false);
142
+ }
143
+ }}
144
+ >
145
+ Revoke
146
+ </Button>
147
+ </li>
148
+ ))}
149
+ </ul>
150
+ )}
151
+ {keys?.length === 0 && <p>No API keys yet.</p>}
152
+ </main>
153
+ );
154
+ }
@@ -1,9 +1,27 @@
1
- import { createFileRoute } from "@tanstack/react-router";
1
+ import {
2
+ createFileRoute,
3
+ Link,
4
+ Outlet,
5
+ useLocation,
6
+ } from "@tanstack/react-router";
7
+ import config from "../../../../../disposabl.json";
2
8
 
3
9
  export const Route = createFileRoute("/_providers/_authenticated/dashboard")({
4
- component: RouteComponent,
10
+ component: Dashboard,
5
11
  });
6
-
7
- function RouteComponent() {
8
- return <div>Hello from the authenticated route!</div>;
12
+ function Dashboard() {
13
+ const pathname = useLocation({ select: (location) => location.pathname });
14
+ if (pathname !== "/dashboard" && pathname !== "/dashboard/")
15
+ return <Outlet />;
16
+ return (
17
+ <main className="mx-auto max-w-xl space-y-4 p-6">
18
+ <h1 className="text-2xl font-semibold">Dashboard</h1>
19
+ <nav className="flex gap-4">
20
+ <Link to="/todos">Todos</Link>
21
+ {config.platforms.includes("api") && (
22
+ <Link to="/dashboard/api-keys">API keys</Link>
23
+ )}
24
+ </nav>
25
+ </main>
26
+ );
9
27
  }