Skip to content

Commit 2ebda36

Browse files
authored
edit を setting に統合 (#585)
# PRの概要 #572 の通り。 <img width="309" alt="image" src="https://github.com/user-attachments/assets/7e85858c-118b-4b8a-aebe-c0bd0ee75f85" /> ## 具体的な変更内容 edit/ を settings/ に統合 ## 補足 関係ないエラー修正あり 496d017 ## レビューリクエストを出す前にチェック! - [x] 改めてセルフレビューしたか - [x] 手動での動作検証を行ったか - [x] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [x] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [x] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 -->
1 parent 969b8bd commit 2ebda36

File tree

8 files changed

+308
-358
lines changed

8 files changed

+308
-358
lines changed

web/app/edit/layout.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

web/app/edit/profile/page.tsx

Lines changed: 0 additions & 243 deletions
This file was deleted.

web/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
}
1010

1111
.cm-li-btn {
12-
@apply no-animation h-auto w-full justify-start rounded-none border-none bg-white px-4 py-4 text-left font-normal text-base shadow-none hover:bg-zinc-100 focus:bg-zinc-300;
12+
@apply no-animation h-auto w-full justify-start rounded-none border-none bg-white px-6 py-4 text-left font-normal text-base shadow-none hover:bg-zinc-100 focus:bg-zinc-300;
1313
}

web/app/settings/card/page.tsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"use client";
2+
3+
import Link from "next/link";
4+
import { useState } from "react";
5+
import { MdEdit } from "react-icons/md";
6+
import { useAboutMe } from "~/api/user";
7+
import { Card } from "~/components/Card";
8+
import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress";
9+
import { NavigateByAuthState } from "~/components/common/NavigateByAuthState";
10+
import TopNavigation from "~/components/common/TopNavigation";
11+
12+
export default function SettingsProfile() {
13+
const { state } = useAboutMe();
14+
const data = state.data;
15+
const error = state.current === "error" ? state.error : null;
16+
const loading = state.current === "loading";
17+
const [back, setBack] = useState<boolean>(false);
18+
19+
return (
20+
<NavigateByAuthState type="toLoginForUnauthenticated">
21+
{loading ? (
22+
<FullScreenCircularProgress />
23+
) : error ? (
24+
<p className="text-error">エラーが発生しました。{error.message}</p>
25+
) : !data ? (
26+
<p>データがありません。</p>
27+
) : (
28+
<div className="flex flex-col p-2">
29+
<TopNavigation title="あなたのカード" />
30+
<div className="flex flex-1 flex-col items-center">
31+
<div className="flex w-full justify-end">
32+
<Link
33+
className="btn btn-sm flex items-center border-none bg-white px-1 text-primary shadow-none"
34+
href={back ? "/settings/courses" : "/settings/profile"}
35+
style={{
36+
// (画面幅 - カード幅) / 2 - profile の padding
37+
marginRight:
38+
"calc(calc(calc(100vw - min(40dvh, 87.5vw)) / 2) - 8px)",
39+
}}
40+
>
41+
<MdEdit className="text-lg" />
42+
編集する
43+
</Link>
44+
</div>
45+
<Card
46+
displayedUser={data}
47+
currentUser={data}
48+
onFlip={(back) => setBack(back)}
49+
/>
50+
</div>
51+
</div>
52+
)}
53+
</NavigateByAuthState>
54+
);
55+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export default function EditCourses() {
2626
<p>データがありません。</p>
2727
)}
2828
<div className="mt-5 flex justify-between">
29-
<Link href="/settings/profile" className="btn">
29+
<Link href="/settings" className="btn">
3030
設定画面に戻る
3131
</Link>
32-
<Link href="/edit/profile" className="btn btn-primary">
32+
<Link href="/settings/profile" className="btn btn-primary">
3333
プロフィール編集へ
3434
</Link>
3535
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function EditInterest() {
7070
subAlertMessage: "本当にページを移動しますか?",
7171
yesMessage: "移動",
7272
clickYes: () => {
73-
router.push("/settings/profile");
73+
router.push("/settings");
7474
},
7575
});
7676
}

0 commit comments

Comments
 (0)