-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com>
// SPDX-License-Identifier: AGPL-3.0-only
import "../polyfill.ts";
import { Button } from "@radix-ui/themes";
import { type FC, useState } from "react";
import { type User } from "@yamori/proto/yamori/workspace/v2/user_pb.js";
import * as Empty from "../components/Empty.ts";
import { Select } from "../contexts/Router.tsx";
import * as userNew from "./user/new/page.tsx";
import * as users from "./users/page.tsx";
import * as root from "./root/page.tsx";
import { LoggedInLayout } from "./LoggedInLayout.tsx";
export const Page: FC = () => {
const [loginUser, setLoginUser] = useState<User | null>(null);
if (!loginUser) {
return <root.Page onLogin={(user) => void setLoginUser(user)} />;
}
return (
<Select
routes={[
{
pattern: userNew.pattern,
children: <userNew.Page loginUser={loginUser} />,
},
{
pattern: users.pattern,
children: <users.Page loginUser={loginUser} />,
},
]}
fallback={
<LoggedInLayout title="404" user={loginUser}>
<Empty.Root>
<Empty.Title>ページが見つかりません</Empty.Title>
<Empty.Description>指定された URL にページはありません。</Empty.Description>
<Empty.Actions>
<Button asChild size="3">
<a href="/">トップへ</a>
</Button>
</Empty.Actions>
</Empty.Root>
</LoggedInLayout>
}
/>
);
};