Skip to content

Commit 3ac461c

Browse files
RRRyomanakaterm
andauthored
UI renew (#673)
# PRの概要 closes #672 ## 具体的な変更内容 ## 影響範囲 ## 動作要件 ## 補足 ## レビューリクエストを出す前にチェック! - [ ] 改めてセルフレビューしたか - [ ] 手動での動作検証を行ったか - [ ] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [ ] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [ ] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 --> --------- Co-authored-by: Shogo Nakamura <[email protected]>
1 parent 0ad837e commit 3ac461c

File tree

8 files changed

+31
-18
lines changed

8 files changed

+31
-18
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429

430430
"@types/body-parser": ["@types/[email protected]", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg=="],
431431

432-
"@types/bun": ["@types/[email protected].3", "", { "dependencies": { "bun-types": "1.2.3" } }, "sha512-054h79ipETRfjtsCW9qJK8Ipof67Pw9bodFWmkfkaUaRiIQ1dIV2VTlheshlBx3mpKr0KeK8VqnMMCtgN9rQtw=="],
432+
"@types/bun": ["@types/[email protected].4", "", { "dependencies": { "bun-types": "1.2.4" } }, "sha512-QtuV5OMR8/rdKJs213iwXDpfVvnskPXY/S0ZiFbsTjQZycuqPbMW8Gf/XhLfwE5njW8sxI2WjISURXPlHypMFA=="],
433433

434434
"@types/caseless": ["@types/[email protected]", "", {}, "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg=="],
435435

@@ -535,7 +535,7 @@
535535

536536
"buffer-equal-constant-time": ["[email protected]", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="],
537537

538-
"bun-types": ["[email protected].3", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-P7AeyTseLKAvgaZqQrvp3RqFM3yN9PlcLuSTe7SoJOfZkER73mLdT2vEQi8U64S1YvM/ldcNiQjn0Sn7H9lGgg=="],
538+
"bun-types": ["[email protected].4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="],
539539

540540
"busboy": ["[email protected]", "", { "dependencies": { "streamsearch": "^1.1.0" } }, "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA=="],
541541

server/prisma/schema.prisma

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ model User {
3535
faculty String
3636
department String
3737
intro String
38-
pictureUrl String
38+
pictureUrl String @default("/avatar.svg")
3939
4040
// bindings to other parts of this app
4141
enrollments Enrollment[]
@@ -67,7 +67,7 @@ model InterestSubject {
6767
// User->Interest->InterestSubject
6868
model Interest {
6969
userId Int
70-
user User @relation(fields: [userId], references: [id])
70+
user User @relation(fields: [userId], references: [id], onDelete: Cascade )
7171
subjectId Int
7272
subject InterestSubject @relation(fields: [subjectId], references: [id], onDelete: Cascade)
7373

server/src/router/picture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { error } from "../lib/error";
1212
import * as hashing from "../lib/hash";
1313

1414
const largeLimit = bodyLimit({
15-
maxSize: 50 * 1024, // 50kb
15+
maxSize: 50 * 1024 * 1024, // 50mb
1616
onError: (c) => {
1717
return c.text("overflow :(", 413);
1818
},

server/src/router/users.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const router = new Hono()
107107

108108
// INSERT INTO "User" VALUES (body...)
109109
.post("/", async (c) => {
110-
const partialUser = InitUserSchema.parse(c.body);
110+
const partialUser = InitUserSchema.parse(await c.req.json());
111111
const user = await createUser(partialUser);
112112

113113
//ユーザー作成と同時にメモとマッチング
@@ -119,7 +119,7 @@ const router = new Hono()
119119
// ユーザーの更新エンドポイント
120120
.put("/me", async (c) => {
121121
const id = await getUserId(c);
122-
const user = UpdateUserSchema.parse(c.body);
122+
const user = UpdateUserSchema.parse(await c.req.json());
123123
const updated = await updateUser(id, user);
124124
c.status(200);
125125
return c.json(updated);

web/app/chat/[id]/page.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,33 @@ import Link from "next/link";
44
import { useEffect, useState } from "react";
55
import * as chat from "~/api/chat/chat";
66
import { RoomWindow } from "~/components/chat/RoomWindow";
7+
import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress";
78

89
export default function Page({ params }: { params: { id: string } }) {
910
const id = Number.parseInt(params.id);
1011
const [room, setRoom] = useState<(DMRoom & PersonalizedDMRoom) | null>(null);
12+
const [loading, setLoading] = useState(true);
13+
1114
useEffect(() => {
1215
(async () => {
13-
const room = await chat.getDM(id);
14-
setRoom(room);
16+
try {
17+
const room = await chat.getDM(id);
18+
setRoom(room);
19+
} finally {
20+
setLoading(false);
21+
}
1522
})();
1623
}, [id]);
1724

25+
if (loading) {
26+
return <FullScreenCircularProgress />;
27+
}
28+
1829
return (
1930
<>
2031
{room ? (
2132
<RoomWindow friendId={id} room={room} />
2233
) : (
23-
// FIXME: this isn't an error when it's just loading
2434
<p>
2535
Sorry, an unexpected error has occurred.
2636
<Link href="/home" className="text-blue-600">

web/app/home/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ export default function Home() {
2828
const [recommended, setRecommended] = useState<
2929
Queue<UserWithCoursesAndSubjects>
3030
>(() => new Queue([]));
31+
const [loading, setLoading] = useState<boolean>(true);
3132

3233
useEffect(() => {
33-
if (data) setRecommended(new Queue(data));
34+
if (data) {
35+
setRecommended(new Queue(data));
36+
setLoading(false);
37+
}
3438
}, [data]);
3539

3640
const displayedUser = recommended.peek(0);
@@ -77,13 +81,13 @@ export default function Home() {
7781
[recommended, controls, backCardControls],
7882
);
7983

80-
if (data === undefined) {
84+
if (loading) {
8185
return <FullScreenCircularProgress />;
8286
}
8387
if (currentUser == null) {
8488
return <FullScreenCircularProgress />;
8589
}
86-
if (recommended.size() === 0) {
90+
if (recommended.size() === 0 && loading === false) {
8791
return <NoMoreUser />;
8892
}
8993
if (error) throw error;

web/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ export default function RootLayout({
3333
<head>
3434
<meta charSet="UTF-8" />
3535
<link rel="icon" type="image/svg+xml" href="/course-mate-icon.svg" />
36-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
36+
<meta
37+
name="viewport"
38+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
39+
/>
3740
<title>CourseMate</title>
3841
</head>
3942
<body className="h-full">

web/app/signup/steps/step2_img.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ export default function Step2({
2323
}, []);
2424

2525
async function next() {
26-
if (!url) {
27-
notify("画像は必須です");
28-
return;
29-
}
3026
const data = {
3127
pictureUrl: url,
3228
};

0 commit comments

Comments
 (0)