Skip to content

Commit 305b48d

Browse files
committed
edit/ を settings/ に統合
1 parent 1dd0499 commit 305b48d

File tree

7 files changed

+274
-303
lines changed

7 files changed

+274
-303
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/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
}

web/app/settings/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ export default function Settings() {
2828
<div className="flex flex-col justify-start">
2929
<h2 className="p-4 pb-2 text-gray-500 text-xs">基本情報</h2>
3030
<ul className="w-full">
31-
<Item href="/settings/profile" title="あなたのカード" />
32-
<Item href="/edit/interests" title="興味分野の設定" />
31+
<Item href="/settings/profile" title="プロフィール" />
32+
<Item href="/settings/courses" title="授業" />
33+
<Item href="/settings/interests" title="興味分野" />
34+
<Item href="/settings/card" title="カードのプレビュー" />
3335
</ul>
3436
<h2 className="p-4 py-2 text-gray-500 text-xs">その他</h2>
3537
<ul className="w-full">

0 commit comments

Comments
 (0)