-
Notifications
You must be signed in to change notification settings - Fork 657
Expand file tree
/
Copy pathpage.tsx
More file actions
57 lines (48 loc) · 1.56 KB
/
page.tsx
File metadata and controls
57 lines (48 loc) · 1.56 KB
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
53
54
55
56
57
import { notFound } from "next/navigation";
import { getValidAccount } from "@/api/account/get-account";
import { getAuthToken } from "@/api/auth-token";
import { getTeams } from "@/api/team/get-team";
import { getMemberByAccountId } from "@/api/team/team-members";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { loginRedirect } from "@/utils/redirects";
import { AccountTeamsUI } from "./overview/AccountTeamsUI";
import { RewindModalClient } from "./rewind/RewindModalClient";
export default async function Page() {
const [authToken, account, teams] = await Promise.all([
getAuthToken(),
getValidAccount("/account"),
getTeams(),
]);
if (!authToken || !teams) {
loginRedirect("/account");
}
const client = getClientThirdwebClient({
jwt: authToken,
teamId: undefined,
});
const teamsWithRole = await Promise.all(
teams.map(async (team) => {
const member = await getMemberByAccountId(team.slug, account.id);
if (!member) {
notFound();
}
return {
role: member.role,
team,
};
}),
);
return (
<div className="flex grow flex-col">
<header className="border-border border-b py-10">
<div className="container max-w-[950px]">
<h1 className="font-semibold text-3xl tracking-tight">Overview</h1>
</div>
</header>
<div className="container flex max-w-[950px] grow flex-col py-8">
<AccountTeamsUI client={client} teamsWithRole={teamsWithRole} />
</div>
<RewindModalClient />
</div>
);
}