Skip to content

Commit e00e8b5

Browse files
authored
v2.17.0 (#237)
2 parents a1dad34 + 11f84c1 commit e00e8b5

15 files changed

Lines changed: 2262 additions & 838 deletions

File tree

app/(Layout)/desktop/HeaderBar/UserLogin/UserLogin.module.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,30 @@
6565
color: #004C64;
6666
font-weight: 500;
6767
}
68+
}
69+
70+
.adminUserPanelWrapper {
71+
aspect-ratio: 2.2 / 1;
72+
height: 3.5rem;
73+
border-radius: 9999px;
74+
padding: 0.15rem;
75+
cursor: pointer;
76+
background-image: linear-gradient(to right, #6FA8FF, #003F47);
77+
}
78+
79+
.adminUserPanel {
80+
height: 100%;
81+
width: 100%;
82+
border-radius: 9999px;
83+
background: white;
84+
85+
display: flex;
86+
justify-content: center;
87+
align-items: center;
88+
89+
>p {
90+
font-size: 1.25rem;
91+
color: #004C64;
92+
font-weight: 500;
93+
}
6894
}

app/(Layout)/desktop/HeaderBar/UserLogin/index.tsx

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,39 @@ export default function UserLogin() {
2727
);
2828
} else {
2929
return (
30-
<div
31-
className={styles.userPanel}
32-
onClick={() => confirmLogout(logout)}
33-
>
34-
<Image
35-
src={userData && userData.avatar || process.env.NEXT_PUBLIC_API_URL + "/image/653299930b891d1f6b5b4458"}
36-
width={50}
37-
height={50}
38-
alt="Avatar"
39-
className={styles.avatar}
40-
/>
41-
<div className={styles.user}>
42-
<p className={styles.name}>
43-
{userData && userData.name}
44-
</p>
45-
<p className={styles.email}>
46-
{userData && userData.email}
47-
</p>
30+
<div className="flex items-center justify-center">
31+
{userData && userData.permission === 2 && (
32+
<div
33+
className={styles.adminUserPanelWrapper + " mr-2"}
34+
onClick={() => window.open("/admin", "_self")}
35+
>
36+
<div className={styles.adminUserPanel}>
37+
<p>管理平台</p>
38+
</div>
39+
</div>
40+
)}
41+
<div
42+
className={styles.userPanel}
43+
onClick={() => confirmLogout(logout)}
44+
>
45+
<Image
46+
src={userData && userData.avatar || process.env.NEXT_PUBLIC_API_URL + "/image/653299930b891d1f6b5b4458"}
47+
width={50}
48+
height={50}
49+
alt="Avatar"
50+
className={styles.avatar}
51+
/>
52+
<div className={styles.user}>
53+
<p className={styles.name}>
54+
{userData && userData.name}
55+
</p>
56+
<p className={styles.email}>
57+
{userData && userData.email}
58+
</p>
59+
</div>
4860
</div>
4961
</div>
62+
5063
);
5164
}
5265
}

app/(Layout)/mobile/HeaderBar/UserLogin/index.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,29 @@ export default function UserLogin() {
2727
);
2828
} else {
2929
return (
30-
<div
31-
className={styles.userPanel}
32-
onClick={() => confirmLogout(logout)}
33-
>
34-
<Image
35-
src={userData && userData.avatar || process.env.NEXT_PUBLIC_API_URL + "/image/653299930b891d1f6b5b4458"}
36-
width={50}
37-
height={50}
38-
alt="Avatar"
39-
className={styles.avatar}
40-
/>
30+
<div className="flex items-center justify-center">
31+
{userData && userData.permission === 2 && (
32+
<div
33+
className={styles.loginUserPanelWrapper + " mr-2"}
34+
onClick={() => window.open("/admin", "_self")}
35+
>
36+
<div className={styles.loginUserPanel}>
37+
<p>管理平台</p>
38+
</div>
39+
</div>
40+
)}
41+
<div
42+
className={styles.userPanel}
43+
onClick={() => confirmLogout(logout)}
44+
>
45+
<Image
46+
src={userData && userData.avatar || process.env.NEXT_PUBLIC_API_URL + "/image/653299930b891d1f6b5b4458"}
47+
width={50}
48+
height={50}
49+
alt="Avatar"
50+
className={styles.avatar}
51+
/>
52+
</div>
4153
</div>
4254
);
4355
}

app/admin/page.tsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"use client";
2+
3+
import { useUserAccount } from "@/utils/useUserAccount";
4+
import NotFoundPage from "@/app/not-found";
5+
import useIsMobile from "@/utils/useIsMobile";
6+
import { useRouter } from "next/navigation";
7+
8+
export default function AdminPage() {
9+
const isMobile = useIsMobile();
10+
const userAccount = useUserAccount();
11+
const router = useRouter();
12+
13+
if (userAccount.isLoading === true) {
14+
return (<div></div>);
15+
}
16+
17+
if (userAccount.isLogin === false && userAccount.isLoading === false) {
18+
return <NotFoundPage />;
19+
}
20+
21+
const userData = userAccount.userData;
22+
23+
if (userData?.permission !== 2 && userAccount.isLoading === false) {
24+
return <NotFoundPage />;
25+
}
26+
27+
return isMobile ? (
28+
<div className="flex flex-col-reverse justify-start w-screen h-screen pt-16 pb-16 px-2 relative overflow-y-auto">
29+
<div className="flex flex-col items-center justify-center h-full">
30+
<h1 className="text-3xl font-bold mb-6">管理員頁面</h1>
31+
<p className="text-lg bg-red-200 rounded-lg p-4 mb-4 font-bold">請注意您目前是管理員身份登入系統,<br />這意味著您的操作都會直接或間接影響整個平台的運作,<br />請謹慎操作。</p>
32+
<p className="text-xl mb-4">請選擇您要管理的項目:</p>
33+
<div className="flex flex-col space-y-4">
34+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" onClick={() => router.push("/admin/sig-leader")}>
35+
SIG Leader 管理
36+
</button>
37+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" onClick={() => router.push("/admin/sig-advisor")}>
38+
SIG 指導老師管理
39+
</button>
40+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" disabled onClick={() => router.push("/admin/post")}>
41+
貼文管理(開發中)
42+
</button>
43+
</div>
44+
</div>
45+
</div >
46+
) : (
47+
<div className="pt-5 h-[calc(100%-6.5rem)]">
48+
<div className="flex flex-col items-center justify-center h-full">
49+
<h1 className="text-3xl font-bold mb-6">管理員頁面</h1>
50+
<p className="text-lg bg-red-200 rounded-lg p-4 mb-4 font-bold">請注意您目前是管理員身份登入系統,<br />這意味著您的操作都會直接或間接影響整個平台的運作,<br />請謹慎操作。</p>
51+
<p className="text-xl mb-4">請選擇您要管理的項目:</p>
52+
<div className="flex flex-col space-y-4">
53+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" onClick={() => router.push("/admin/sig-leader")}>
54+
SIG Leader 管理
55+
</button>
56+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" onClick={() => router.push("/admin/sig-advisor")}>
57+
SIG 指導老師管理
58+
</button>
59+
<button className="bg-white text-[#5fcdf5] px-4 py-2 rounded-full disabled:cursor-not-allowed" disabled onClick={() => router.push("/admin/post")}>
60+
貼文管理(開發中)
61+
</button>
62+
</div>
63+
</div>
64+
</div>
65+
);
66+
}

0 commit comments

Comments
 (0)