@fungi.computer/bonsai 0.4.6 → 0.5.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.
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { gitAccessOf } from "../web/host-access.js";
3
+
4
+ describe("gitAccessOf", () => {
5
+ it("is granted only when Git and events are both granted", () => {
6
+ expect(
7
+ gitAccessOf({
8
+ "git.repository": "granted",
9
+ "app.events.emit": "granted",
10
+ }),
11
+ ).toBe("granted");
12
+ });
13
+
14
+ it("is missing when either right is missing", () => {
15
+ expect(
16
+ gitAccessOf({
17
+ "git.repository": "granted",
18
+ "app.events.emit": "missing",
19
+ }),
20
+ ).toBe("missing");
21
+ expect(gitAccessOf({ "git.repository": "missing" })).toBe("missing");
22
+ });
23
+
24
+ it("is unknown when the host publishes nothing about them", () => {
25
+ expect(gitAccessOf(undefined)).toBe("unknown");
26
+ expect(gitAccessOf({ "git.repository": "granted" })).toBe("unknown");
27
+ });
28
+ });
@@ -0,0 +1,180 @@
1
+ // @vitest-environment jsdom
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
+ import { act, createElement } from "react";
4
+ import { createRoot } from "react-dom/client";
5
+ import {
6
+ QueryClient,
7
+ QueryClientProvider,
8
+ notifyManager,
9
+ } from "@tanstack/react-query";
10
+ import {
11
+ AppError,
12
+ createCapabilityRegistry,
13
+ type AppPermissionRequest,
14
+ } from "@fungi.computer/agar";
15
+ import { appMethods } from "@fungi.computer/agar/backend";
16
+ import { NewRepositoryDialog } from "../web/new-repository.js";
17
+ import { RouterProvider } from "../web/router.js";
18
+ import { connect } from "../web/transport.js";
19
+ import { jsonValue, type JsonValue } from "../shared/contract.js";
20
+
21
+ const call = vi.fn<(method: string, input: string) => Promise<JsonValue>>();
22
+ const requestAppPermissions =
23
+ vi.fn<
24
+ (
25
+ input: AppPermissionRequest,
26
+ ) => Promise<"granted" | "declined" | "customize">
27
+ >();
28
+ let container: HTMLDivElement;
29
+ let root: ReturnType<typeof createRoot>;
30
+
31
+ const summary = {
32
+ name: "koi",
33
+ description: null,
34
+ parent: null,
35
+ owner: null,
36
+ createdAt: 1,
37
+ lastPushAt: null,
38
+ forks: [],
39
+ openChanges: 0,
40
+ activity: [],
41
+ };
42
+
43
+ beforeEach(() => {
44
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
45
+ notifyManager.setScheduler(queueMicrotask);
46
+ const capabilities = createCapabilityRegistry();
47
+ capabilities.provide(appMethods, { call });
48
+ connect({
49
+ capabilities,
50
+ ui: { requestAppPermissions: (input) => requestAppPermissions(input) },
51
+ });
52
+ container = document.createElement("div");
53
+ document.body.appendChild(container);
54
+ root = createRoot(container);
55
+ });
56
+
57
+ afterEach(async () => {
58
+ await act(async () => {
59
+ root.unmount();
60
+ await Promise.resolve();
61
+ });
62
+ connect(null);
63
+ container.remove();
64
+ document.body.replaceChildren();
65
+ vi.resetAllMocks();
66
+ });
67
+
68
+ const render = async () => {
69
+ const client = new QueryClient({
70
+ defaultOptions: { queries: { retry: false } },
71
+ });
72
+ await act(async () => {
73
+ root.render(
74
+ createElement(
75
+ QueryClientProvider,
76
+ { client },
77
+ createElement(
78
+ RouterProvider,
79
+ null,
80
+ createElement(NewRepositoryDialog, {
81
+ open: true,
82
+ onOpenChange: vi.fn(),
83
+ }),
84
+ ),
85
+ ),
86
+ );
87
+ await Promise.resolve();
88
+ });
89
+ };
90
+
91
+ const button = (label: string) =>
92
+ [...document.querySelectorAll("button")].find(
93
+ (candidate) => candidate.textContent === label,
94
+ );
95
+
96
+ const type = async (value: string) => {
97
+ const input = document.querySelector("input[type=text], input:not([type])");
98
+ if (!(input instanceof HTMLInputElement)) throw new Error("No name field");
99
+ const descriptor = Object.getOwnPropertyDescriptor(
100
+ HTMLInputElement.prototype,
101
+ "value",
102
+ );
103
+ if (!descriptor?.set) throw new Error("Native input setter unavailable");
104
+ await act(async () => {
105
+ descriptor.set?.call(input, value);
106
+ input.dispatchEvent(new Event("input", { bubbles: true }));
107
+ await Promise.resolve();
108
+ });
109
+ };
110
+
111
+ const press = async (label: string) => {
112
+ await act(async () => {
113
+ button(label)?.click();
114
+ await Promise.resolve();
115
+ await Promise.resolve();
116
+ });
117
+ };
118
+
119
+ describe("New repository", () => {
120
+ it("creates the repository with a README by default", async () => {
121
+ call.mockResolvedValue(jsonValue.parse(summary));
122
+ await render();
123
+ await type("koi");
124
+ await press("Create repository");
125
+ expect(call).toHaveBeenCalledWith(
126
+ "repos.create",
127
+ JSON.stringify({ name: "koi", readme: true }),
128
+ );
129
+ });
130
+
131
+ it("explains a bad name and does not call the host", async () => {
132
+ await render();
133
+ await type("Koi Pond");
134
+ await press("Create repository");
135
+ expect(document.body.textContent).toContain("lowercase letters");
136
+ expect(call).not.toHaveBeenCalled();
137
+ });
138
+
139
+ it("asks for Git access when the host refuses, then creates after Approve", async () => {
140
+ call
141
+ .mockRejectedValueOnce(
142
+ new AppError("App permission was denied", {
143
+ code: "CAPABILITY_DENIED",
144
+ retryable: false,
145
+ }),
146
+ )
147
+ .mockResolvedValueOnce(jsonValue.parse(summary));
148
+ requestAppPermissions.mockResolvedValue("granted");
149
+ await render();
150
+ await type("koi");
151
+ await press("Create repository");
152
+ expect(document.body.textContent).toContain("Bonsai needs Git access");
153
+ expect(call).toHaveBeenCalledTimes(1);
154
+ await press("Approve");
155
+ expect(requestAppPermissions).toHaveBeenCalledWith({
156
+ git: ["git.repository"],
157
+ events: ["app.events.emit"],
158
+ });
159
+ expect(call).toHaveBeenCalledTimes(2);
160
+ expect(document.body.textContent).not.toContain("Bonsai needs Git access");
161
+ });
162
+
163
+ it("keeps the notice and says so when the person declines", async () => {
164
+ call.mockRejectedValue(
165
+ new AppError("App permission was denied", {
166
+ code: "CAPABILITY_DENIED",
167
+ retryable: false,
168
+ }),
169
+ );
170
+ requestAppPermissions.mockResolvedValue("declined");
171
+ await render();
172
+ await type("koi");
173
+ await press("Create repository");
174
+ await press("Approve");
175
+ expect(document.body.textContent).toContain(
176
+ "Bonsai needs Git access to create a repository.",
177
+ );
178
+ expect(call).toHaveBeenCalledTimes(1);
179
+ });
180
+ });
package/web/api.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  mergeResult,
15
15
  repoDetail,
16
16
  repoPage,
17
+ repoSummary,
17
18
  type Activity,
18
19
  } from "../shared/contract.js";
19
20
  import { fileContent, fileList } from "@fungi.computer/agar/roles/files";
@@ -31,6 +32,15 @@ export const useRepos = () =>
31
32
  queryFn: () => callMethod("repos.list", {}, repoPage),
32
33
  });
33
34
 
35
+ /** Create a repository; a README is committed first when asked for. */
36
+ export function createRepository(input: { name: string; readme: boolean }) {
37
+ return callMethod(
38
+ "repos.create",
39
+ { name: input.name, readme: input.readme },
40
+ repoSummary,
41
+ );
42
+ }
43
+
34
44
  export const useAgents = () =>
35
45
  useQuery({
36
46
  queryKey: ["agents"],
package/web/board.tsx CHANGED
@@ -113,7 +113,8 @@ export function BonsaiBoard({
113
113
  return [...active]
114
114
  .sort((a, b) => phoneOrder.indexOf(a.id) - phoneOrder.indexOf(b.id))
115
115
  .map((tile) => {
116
- const h = tile.h;
116
+ // One column stacks tiles to their content, never to a desktop row span.
117
+ const h = 1;
117
118
  const next = { ...tile, col: 0, row, w: 1, h };
118
119
  row += h;
119
120
  return next;
@@ -123,6 +124,9 @@ export function BonsaiBoard({
123
124
  ? arrangeBento(active, columns)
124
125
  : active;
125
126
  }, [placements, tiles, columns, phoneOrder]);
127
+ // Phone tiles that measure their own content need no minimum row height.
128
+ const packedRowHeight =
129
+ columns === 1 && tiles.every((tile) => tile.autoHeight) ? 0 : rowHeight;
126
130
  const rowHeights = useMemo(() => {
127
131
  const rows: number[] = [];
128
132
  for (const tile of shown) {
@@ -132,18 +136,18 @@ export function BonsaiBoard({
132
136
  const last = tile.row + tile.h - 1;
133
137
  const earlier = Array.from(
134
138
  { length: tile.h - 1 },
135
- (_, i) => (rows[tile.row + i] ?? rowHeight) + 12,
139
+ (_, i) => (rows[tile.row + i] ?? packedRowHeight) + 12,
136
140
  ).reduce((sum, h) => sum + h, 0);
137
- while (rows.length <= last) rows.push(rowHeight);
138
- rows[last] = Math.max(rows[last] ?? rowHeight, measured - earlier);
141
+ while (rows.length <= last) rows.push(packedRowHeight);
142
+ rows[last] = Math.max(rows[last] ?? packedRowHeight, measured - earlier);
139
143
  }
140
144
  return rows;
141
- }, [shown, tiles, heights, rowHeight]);
145
+ }, [shown, tiles, heights, packedRowHeight]);
142
146
  const binding = useMaosaicoBento({
143
147
  placements: shown,
144
148
  columns,
145
149
  width,
146
- rowHeight,
150
+ rowHeight: packedRowHeight,
147
151
  rowHeights,
148
152
  gap: 12,
149
153
  enabled: editable,
package/web/bonsai.css CHANGED
@@ -390,6 +390,9 @@ body {
390
390
  max-width: none;
391
391
  padding: var(--spacing-lg) var(--spacing-xl);
392
392
  }
393
+ .bonsai-markdown.bonsai-markdown-tile {
394
+ padding: 0;
395
+ }
393
396
  .bonsai-change-list .list-row {
394
397
  grid-template-columns: minmax(0, 1fr) auto;
395
398
  align-items: center;
package/web/home-page.tsx CHANGED
@@ -2,6 +2,12 @@ import { useEffect, useMemo, useState } from "react";
2
2
  import { DataListHeading } from "@fungi.computer/caps/components/data-list";
3
3
  import { Status } from "@fungi.computer/caps/components/status";
4
4
  import { EmptyState } from "@fungi.computer/caps/blocks/empty-state";
5
+ import { GitBranch } from "lucide-react";
6
+ import { Button } from "@fungi.computer/caps/components/button";
7
+ import { SetupNotice } from "@fungi.computer/caps/blocks/setup-notice";
8
+ import { NewRepositoryDialog } from "./new-repository.js";
9
+ import { useHostGitAccess } from "./host-access.js";
10
+ import { requestGitAccess } from "./transport.js";
5
11
  import {
6
12
  useAgents,
7
13
  useRepos,
@@ -88,6 +94,24 @@ function HomeNetwork({
88
94
  />
89
95
  );
90
96
  }
97
+ /** The card's facts, saying only what is true of this repository. */
98
+ function repoMeta(repo: RepoSummary, openChanges: number): string {
99
+ const forks = repo.forks.length;
100
+ return [
101
+ repo.lastPushAt === null
102
+ ? "Nothing pushed yet"
103
+ : `Pushed ${relativeTime(repo.lastPushAt)}`,
104
+ forks === 0
105
+ ? "No forks yet"
106
+ : `${String(forks)} ${forks === 1 ? "fork" : "forks"}`,
107
+ openChanges > 0
108
+ ? `${String(openChanges)} open ${openChanges === 1 ? "change" : "changes"}`
109
+ : null,
110
+ ]
111
+ .filter((part) => part !== null)
112
+ .join(" · ");
113
+ }
114
+
91
115
  function RepoCard({
92
116
  repo,
93
117
  colors,
@@ -96,17 +120,15 @@ function RepoCard({
96
120
  colors: AgentColors;
97
121
  }) {
98
122
  const changes = useChanges(repo.name);
123
+ const openChanges =
124
+ changes.data?.changes.filter(
125
+ (change) => change.state === "open" || change.state === "merging",
126
+ ).length ?? 0;
99
127
  return (
100
128
  <div className="space-y-3">
101
129
  {repo.description ? <p>{repo.description}</p> : null}
102
130
  <p className="text-xs text-[var(--stipe-fg-muted)]">
103
- {repo.lastPushAt !== null
104
- ? `Pushed ${relativeTime(repo.lastPushAt)} · `
105
- : ""}
106
- {repo.forks.length} {repo.forks.length === 1 ? "fork" : "forks"}
107
- {changes.data
108
- ? ` · ${String(changes.data.changes.filter((change) => change.state === "open" || change.state === "merging").length)} open changes`
109
- : ""}
131
+ {repoMeta(repo, openChanges)}
110
132
  </p>
111
133
  <div className="flex flex-wrap gap-2">
112
134
  {repo.forks.map((fork) => (
@@ -123,6 +145,20 @@ function RepoCard({
123
145
  }
124
146
  export function HomePage({ live }: { live: LiveState }) {
125
147
  const [wide, setWide] = useState(false);
148
+ const [creating, setCreating] = useState(false);
149
+ const [asking, setAsking] = useState(false);
150
+ const hostGit = useHostGitAccess();
151
+ const [approved, setApproved] = useState(false);
152
+ const missing = hostGit === "missing" && !approved;
153
+ async function approveAccess(): Promise<void> {
154
+ setAsking(true);
155
+ try {
156
+ // The host's setup fact turns ready by itself; this flips the screen now.
157
+ if ((await requestGitAccess()) === "granted") setApproved(true);
158
+ } finally {
159
+ setAsking(false);
160
+ }
161
+ }
126
162
  useEffect(() => {
127
163
  const media = matchMedia("(min-width: 1024px)");
128
164
  const update = () => {
@@ -146,7 +182,10 @@ export function HomePage({ live }: { live: LiveState }) {
146
182
  featured !== undefined && featured.lastPushAt !== null,
147
183
  );
148
184
  const tiles: BoardTile[] = [];
185
+ // Activity belongs to repositories; with none listed there is nothing to show.
186
+ const hasRepos = (repos.data?.repos.length ?? 0) > 0;
149
187
  if (
188
+ hasRepos &&
150
189
  featured?.lastPushAt !== null &&
151
190
  featured !== undefined &&
152
191
  (network.isPending || network.isError || network.data.nodes.length > 0)
@@ -173,7 +212,9 @@ export function HomePage({ live }: { live: LiveState }) {
173
212
  />
174
213
  ),
175
214
  });
176
- if (events.isError)
215
+ if (!hasRepos) {
216
+ // No Live tile before the first repository.
217
+ } else if (events.isError)
177
218
  tiles.push({
178
219
  id: "live",
179
220
  title: "Live",
@@ -257,12 +298,49 @@ export function HomePage({ live }: { live: LiveState }) {
257
298
  }}
258
299
  />
259
300
  ) : repos.data.repos.length === 0 ? (
260
- <EmptyState
261
- variant="panel"
262
- title="No repositories yet"
263
- description="Repositories you and your Agents create appear here, with every fork, push and change live."
264
- />
265
- ) : null}
301
+ missing ? (
302
+ <SetupNotice
303
+ variant="panel"
304
+ need="Bonsai needs Git access to save your repositories"
305
+ cause="Every Agent gets its own fork; watch them merge back here."
306
+ visual={<GitBranch aria-hidden="true" />}
307
+ fix={{
308
+ label: "Approve Git access",
309
+ onSelect: () => void approveAccess(),
310
+ pending: asking,
311
+ }}
312
+ waitingFor="your answer"
313
+ />
314
+ ) : (
315
+ <EmptyState
316
+ variant="panel"
317
+ title="Start your first repository"
318
+ description="Every Agent gets its own fork; watch them merge back here."
319
+ primaryAction={{
320
+ label: "New repository",
321
+ onSelect: () => {
322
+ setCreating(true);
323
+ },
324
+ }}
325
+ />
326
+ )
327
+ ) : (
328
+ <div className="flex items-center justify-between gap-3">
329
+ <h1 className="caps-card-title">Repositories</h1>
330
+ <Button
331
+ size="sm"
332
+ variant="outline"
333
+ disabled={missing}
334
+ title={missing ? "Approve Git access first" : undefined}
335
+ onClick={() => {
336
+ setCreating(true);
337
+ }}
338
+ >
339
+ New repository
340
+ </Button>
341
+ </div>
342
+ )}
343
+ <NewRepositoryDialog open={creating} onOpenChange={setCreating} />
266
344
  <BonsaiBoard
267
345
  rowHeight={0}
268
346
  placements={placements}
@@ -0,0 +1,36 @@
1
+ import { createContext, useContext, type ReactNode } from "react";
2
+ import type { AppPermissions } from "@fungi.computer/agar";
3
+
4
+ /** Whether Bonsai may save repositories; `unknown` on hosts that do not say. */
5
+ export type GitAccess = "granted" | "missing" | "unknown";
6
+
7
+ /** Bonsai's writes need Git and event access together. */
8
+ export function gitAccessOf(
9
+ permissions: AppPermissions | undefined,
10
+ ): GitAccess {
11
+ const git = permissions?.["git.repository"];
12
+ const events = permissions?.["app.events.emit"];
13
+ if (git === "missing" || events === "missing") return "missing";
14
+ return git === "granted" && events === "granted" ? "granted" : "unknown";
15
+ }
16
+
17
+ const GitAccessContext = createContext<GitAccess>("unknown");
18
+
19
+ export function HostGitAccess({
20
+ permissions,
21
+ children,
22
+ }: {
23
+ permissions: AppPermissions | undefined;
24
+ children?: ReactNode;
25
+ }) {
26
+ return (
27
+ <GitAccessContext.Provider value={gitAccessOf(permissions)}>
28
+ {children}
29
+ </GitAccessContext.Provider>
30
+ );
31
+ }
32
+
33
+ /** The host's published grant state for Git and events, from the live context. */
34
+ export function useHostGitAccess(): GitAccess {
35
+ return useContext(GitAccessContext);
36
+ }
@@ -76,6 +76,25 @@ function Contributors({ graph, actors }: { graph: Graph; actors: Agent[] }) {
76
76
  No sampled commits in the past 12 weeks.
77
77
  </p>
78
78
  );
79
+ if (weeks.length < 2) {
80
+ const total = data.contributors.reduce((sum, item) => sum + item.total, 0);
81
+ return (
82
+ <>
83
+ <p className="text-sm">
84
+ {total} {total === 1 ? "commit" : "commits"} this week.
85
+ </p>
86
+ <ul className="text-xs bonsai-chart-legend">
87
+ {data.contributors.map((item) => (
88
+ <li key={item.id}>
89
+ <i style={{ background: agentColor(item.color) }} />
90
+ <span>{item.name}</span>
91
+ <strong>{item.total}</strong>
92
+ </li>
93
+ ))}
94
+ </ul>
95
+ </>
96
+ );
97
+ }
79
98
  return (
80
99
  <>
81
100
  <p className="text-xs text-[var(--stipe-fg-muted)] bonsai-chart-note">
@@ -161,6 +180,16 @@ function ActorSplit({ graph, actors }: { graph: Graph; actors: Agent[] }) {
161
180
  const contributors = contributionWeeks(graph, actors).contributors;
162
181
  const recorded = contributors.reduce((sum, actor) => sum + actor.total, 0);
163
182
  let offset = 0;
183
+ if (split.commits.agent === 0)
184
+ return (
185
+ <>
186
+ <p className="text-sm">Just you so far.</p>
187
+ <p className="text-xs text-[var(--stipe-fg-muted)]">
188
+ {total} {total === 1 ? "commit" : "commits"}. Agents appear here once
189
+ they push to their own forks.
190
+ </p>
191
+ </>
192
+ );
164
193
  return (
165
194
  <>
166
195
  <p className="text-2xl font-semibold">
package/web/insights.tsx CHANGED
@@ -6,6 +6,7 @@ import { arrangeBento } from "@fungi.computer/maosaico";
6
6
  import { Button } from "@fungi.computer/caps/components/button";
7
7
  import { Select } from "@fungi.computer/caps/components/select";
8
8
  import {
9
+ compactDefaultLayout,
9
10
  defaultLayout,
10
11
  insightLayout,
11
12
  savedLayout,
@@ -218,10 +219,13 @@ export function OverviewBoard({
218
219
  repo,
219
220
  definitions,
220
221
  controlsTarget,
222
+ compactHero = false,
221
223
  }: {
222
224
  repo: string;
223
225
  definitions: BoardTile[];
224
226
  controlsTarget: HTMLElement | null;
227
+ /** A young repository: Network and Live take one row, not two. */
228
+ compactHero?: boolean;
225
229
  }) {
226
230
  const layout = useQuery({
227
231
  queryKey: ["insight-layout", repo],
@@ -242,7 +246,12 @@ export function OverviewBoard({
242
246
  <Grid
243
247
  key={repo}
244
248
  repo={repo}
245
- initial={(layout.data.tiles ?? defaultLayout).placements}
249
+ initial={
250
+ (
251
+ layout.data.tiles ??
252
+ (compactHero ? compactDefaultLayout() : defaultLayout)
253
+ ).placements
254
+ }
246
255
  definitions={definitions}
247
256
  controlsTarget={controlsTarget}
248
257
  />
package/web/main.tsx CHANGED
@@ -1,6 +1,10 @@
1
1
  import { HomePage } from "./home-page.js";
2
2
  import { ChangePage } from "./change-page.js";
3
- import { mountApp, useWindowStatus } from "@fungi.computer/agar/react";
3
+ import {
4
+ mountApp,
5
+ useAppContext,
6
+ useWindowStatus,
7
+ } from "@fungi.computer/agar/react";
4
8
  import type { AppRoot } from "@fungi.computer/agar";
5
9
  import { QueryClient } from "@tanstack/react-query";
6
10
  import { StrictMode } from "react";
@@ -9,12 +13,14 @@ import "./bonsai.css";
9
13
  import { productName } from "../shared/contract.js";
10
14
  import { useLive } from "./api.js";
11
15
  import { CommitPage, RepoPage } from "./pages.js";
16
+ import { HostGitAccess } from "./host-access.js";
12
17
  import { connect } from "./transport.js";
13
18
  import { RouterProvider, useRouter } from "./router.js";
14
19
 
15
20
  function Shell({ app }: { app: AppRoot | null }) {
16
21
  const { route } = useRouter();
17
22
  const live = useLive();
23
+ const permissions = useAppContext(app)?.permissions;
18
24
  // Bonsai's one status bar is the window footer: the Live/Connecting
19
25
  // readout goes there, the same way Shed and Inkcap report their state.
20
26
  useWindowStatus(app, [
@@ -27,23 +33,25 @@ function Shell({ app }: { app: AppRoot | null }) {
27
33
  },
28
34
  ]);
29
35
  return (
30
- <div className="caps-app-canvas bonsai-shell">
31
- <main className="bonsai-page">
32
- {route.page === "home" ? (
33
- <HomePage live={live} />
34
- ) : route.page === "repo" ? (
35
- <RepoPage key={route.repo} route={route} live={live} />
36
- ) : route.page === "change" ? (
37
- <ChangePage
38
- key={`${route.repo}:${String(route.number)}`}
39
- repo={route.repo}
40
- number={route.number}
41
- />
42
- ) : (
43
- <CommitPage repo={route.repo} hash={route.hash} />
44
- )}
45
- </main>
46
- </div>
36
+ <HostGitAccess permissions={permissions}>
37
+ <div className="caps-app-canvas bonsai-shell">
38
+ <main className="bonsai-page">
39
+ {route.page === "home" ? (
40
+ <HomePage live={live} />
41
+ ) : route.page === "repo" ? (
42
+ <RepoPage key={route.repo} route={route} live={live} />
43
+ ) : route.page === "change" ? (
44
+ <ChangePage
45
+ key={`${route.repo}:${String(route.number)}`}
46
+ repo={route.repo}
47
+ number={route.number}
48
+ />
49
+ ) : (
50
+ <CommitPage repo={route.repo} hash={route.hash} />
51
+ )}
52
+ </main>
53
+ </div>
54
+ </HostGitAccess>
47
55
  );
48
56
  }
49
57