Skip to content

Commit af8fea9

Browse files
authored
Merge branch 'main' into feat/use-sse-instead-of-ws
2 parents 4aa8069 + 6e75b58 commit af8fea9

File tree

7 files changed

+52
-46
lines changed

7 files changed

+52
-46
lines changed

server/src/router/users.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from "common/zod/schemas";
88
import { Hono } from "hono";
99
import { z } from "zod";
10+
import { prisma } from "../database/client";
1011
import {
1112
getPendingRequestsFromUser,
1213
getPendingRequestsToUser,
@@ -51,9 +52,17 @@ const router = new Hono()
5152
// ユーザーの存在を確認するためのエンドポイント。だれでもアクセス可能
5253
.get("/exists/:guid", param({ guid: z.string() }), async (c) => {
5354
const guid = c.req.valid("param").guid;
54-
const ok = await core.userExists(guid as GUID);
55-
c.status(ok.code);
56-
return c.json({});
55+
const user = await prisma.user.findFirst({
56+
where: {
57+
guid: guid,
58+
},
59+
select: { guid: true, name: true },
60+
});
61+
if (!user) {
62+
return c.json({ message: "User not found" }, 404);
63+
}
64+
65+
return c.json(200);
5766
})
5867

5968
// 特定のユーザーとマッチしたユーザーを取得

web/app/chat/layout.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import BottomBar from "~/components/BottomBar";
22
import Header from "~/components/Header";
33
import { NavigateByAuthState } from "~/components/common/NavigateByAuthState";
4+
import { ModalProvider } from "~/components/common/modal/ModalProvider";
45

5-
export default function Layout({
6-
children,
7-
}: {
8-
children: React.ReactNode;
9-
}) {
6+
export default function Layout({ children }: { children: React.ReactNode }) {
107
return (
118
<>
12-
<Header title="チャット" />
13-
<NavigateByAuthState type="toLoginForUnauthenticated">
14-
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
15-
</NavigateByAuthState>
16-
<BottomBar activeTab="3_chat" />
9+
<ModalProvider>
10+
<Header title="チャット" />
11+
<NavigateByAuthState type="toLoginForUnauthenticated">
12+
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
13+
</NavigateByAuthState>
14+
<BottomBar activeTab="3_chat" />
15+
</ModalProvider>
1716
</>
1817
);
1918
}

web/app/friends/layout.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import BottomBar from "~/components/BottomBar";
22
import Header from "~/components/Header";
33
import { NavigateByAuthState } from "~/components/common/NavigateByAuthState";
4+
import { ModalProvider } from "~/components/common/modal/ModalProvider";
45

5-
export default function Layout({
6-
children,
7-
}: {
8-
children: React.ReactNode;
9-
}) {
6+
export default function Layout({ children }: { children: React.ReactNode }) {
107
return (
118
<>
12-
<Header title="フレンド" />
13-
<NavigateByAuthState type="toLoginForUnauthenticated">
14-
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
15-
</NavigateByAuthState>
16-
<BottomBar activeTab="1_friends" />
9+
<ModalProvider>
10+
<Header title="フレンド" />
11+
<NavigateByAuthState type="toLoginForUnauthenticated">
12+
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
13+
</NavigateByAuthState>
14+
<BottomBar activeTab="1_friends" />
15+
</ModalProvider>
1716
</>
1817
);
1918
}

web/app/home/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ export default function Home() {
7777
[recommended, controls, backCardControls],
7878
);
7979

80-
if (recommended == null) {
80+
if (data === undefined) {
8181
return <FullScreenCircularProgress />;
8282
}
8383
if (currentUser == null) {
8484
return <FullScreenCircularProgress />;
8585
}
86-
if (displayedUser == null) {
86+
if (recommended.size() === 0) {
8787
return <NoMoreUser />;
8888
}
8989
if (error) throw error;
@@ -173,4 +173,7 @@ class Queue<T> {
173173
pop(): T | undefined {
174174
return this.store.shift();
175175
}
176+
size(): number {
177+
return this.store.length;
178+
}
176179
}

web/app/layout.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import "@fontsource/roboto/700.css";
1111
import BanLandscape from "~/components/BanLandscape";
1212
import SSEProvider from "~/components/SSEProvider";
1313
import { AlertProvider } from "~/components/common/alert/AlertProvider";
14-
import { ModalProvider } from "~/components/common/modal/ModalProvider";
15-
import AuthProvider from "~/firebase/auth/AuthProvider";
1614

1715
const theme = createTheme({
1816
palette: {
@@ -46,15 +44,13 @@ export default function RootLayout({
4644
anchorOrigin={{ horizontal: "right", vertical: "top" }}
4745
>
4846
<React.StrictMode>
49-
<AuthProvider>
50-
<CssBaseline />
51-
<AlertProvider>
52-
<ModalProvider>
53-
<BanLandscape />
54-
<SSEProvider>{children}</SSEProvider>
55-
</ModalProvider>
56-
</AlertProvider>
57-
</AuthProvider>
47+
<CssBaseline />
48+
<AlertProvider>
49+
{/* <ModalProvider> */}
50+
<BanLandscape />
51+
<SSEProvider>{children}</SSEProvider>
52+
{/* </ModalProvider> */}
53+
</AlertProvider>
5854
</React.StrictMode>
5955
</SnackbarProvider>
6056
</ThemeProvider>

web/app/search/layout.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import BottomBar from "~/components/BottomBar";
22
import Header from "~/components/Header";
33
import { NavigateByAuthState } from "~/components/common/NavigateByAuthState";
4+
import { ModalProvider } from "~/components/common/modal/ModalProvider";
45

5-
export default function Layout({
6-
children,
7-
}: {
8-
children: React.ReactNode;
9-
}) {
6+
export default function Layout({ children }: { children: React.ReactNode }) {
107
return (
118
<>
12-
<Header title="検索" />
13-
<NavigateByAuthState type="toLoginForUnauthenticated">
14-
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
15-
</NavigateByAuthState>
16-
<BottomBar activeTab="2_search" />
9+
<ModalProvider>
10+
<Header title="検索" />
11+
<NavigateByAuthState type="toLoginForUnauthenticated">
12+
<div className="h-full overflow-y-auto pt-12 pb-12">{children}</div>
13+
</NavigateByAuthState>
14+
<BottomBar activeTab="2_search" />
15+
</ModalProvider>
1716
</>
1817
);
1918
}

web/components/common/modal/ModalProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use client";
12
import type { UserWithCoursesAndSubjects } from "common/types";
23
import { type ReactNode, createContext, useContext, useState } from "react";
34
import { useAboutMe } from "~/api/user";

0 commit comments

Comments
 (0)