Skip to content

Commit f8b9401

Browse files
development (#269)
2 parents 4b1fa27 + 6a835a6 commit f8b9401

43 files changed

Lines changed: 668 additions & 568 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.local.example

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
# Google OAuth
12
GOOGLE_CLIENT_ID=
23
GOOGLE_CLIENT_SECRET=
4+
5+
# Backend
6+
NEXT_PUBLIC_API_URL=
7+
8+
# NextAuth
39
NEXTAUTH_URL=
410
NEXTAUTH_SECRET=
5-
NEXT_PUBLIC_API_URL=
6-
NODE_ENV=development,no-strict
711

8-
NEXT_PUBLIC_WEBHOOK_LOGIN=
12+
# GitHub token that have read access to MingdaoSIG-Frontend repo
13+
NEXT_PUBLIC_GITHUB_TOKEN=
14+
15+
# Discord webhook URL for displaying login log
16+
NEXT_PUBLIC_WEBHOOK_LOGIN=
17+
18+
# Local Only
19+
# NODE_ENV=development,no-strict
20+
21+
# Production Only
22+
# FORCE_CONTAINERIZED=1
23+
# NODE_OPTIONS=--max-old-space-size=512

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export default function UserLogin() {
99
return (
1010
<div className="w-[15.75rem] h-14 rounded-full p-0.5 cursor-pointer bg-gradient-to-r from-[#6FA8FF] to-[#003F47]">
1111
<div className="h-full w-full rounded-full bg-white flex justify-center items-center">
12-
<p className="text-[1.2rem] text-[#004C64] font-medium">Loading ...</p>
12+
<p className="text-[1.2rem] text-[#004C64] font-medium">
13+
Loading ...
14+
</p>
1315
</div>
1416
</div>
1517
);
@@ -33,7 +35,9 @@ export default function UserLogin() {
3335
onClick={() => window.open("/admin", "_self")}
3436
>
3537
<div className="h-full w-full rounded-full bg-white flex justify-center items-center">
36-
<p className="text-[1.25rem] text-[#004C64] font-medium">管理平台</p>
38+
<p className="text-[1.25rem] text-[#004C64] font-medium">
39+
管理平台
40+
</p>
3741
</div>
3842
</div>
3943
)}
@@ -45,7 +49,7 @@ export default function UserLogin() {
4549
src={
4650
(userData && userData.avatar) ||
4751
process.env.NEXT_PUBLIC_API_URL +
48-
"/image/653299930b891d1f6b5b4458"
52+
"/image/653299930b891d1f6b5b4458"
4953
}
5054
width={50}
5155
height={50}
@@ -79,4 +83,4 @@ function confirmLogout(logout: () => void) {
7983
logout();
8084
}
8185
});
82-
}
86+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ const HeaderBar = () => {
2525
);
2626
};
2727

28-
export default HeaderBar;
28+
export default HeaderBar;

app/(Layout)/desktop/ToolBar/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ const ToolBar = () => {
7777
className="rounded-full cursor-pointer relative flex justify-center items-center transition-opacity duration-500"
7878
onClick={() => setSelected(index)}
7979
>
80-
<Image
81-
src={item.icon}
82-
height={32}
83-
width={32}
84-
alt={item.name}
85-
/>
80+
<Image src={item.icon} height={32} width={32} alt={item.name} />
8681
</Link>
8782
</div>
8883
);
@@ -118,4 +113,4 @@ function pathToSelected(path: string) {
118113
}
119114

120115
return -1;
121-
}
116+
}

app/(Layout)/splitBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ const SplitBlock = ({ children }: { children: React.ReactNode }) => {
1515
);
1616
};
1717

18-
export default SplitBlock;
18+
export default SplitBlock;

app/(Layout)/splitBlockNew.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ const SplitBlock = ({ children }: { children: React.ReactNode }) => {
1515
);
1616
};
1717

18-
export default SplitBlock;
18+
export default SplitBlock;

app/(home)/desktop/Information.tsx

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,27 @@ type MinimalThread = Pick<TThread, "_id" | "title"> & { likes: number };
2222

2323
function HeartIcon(props: React.SVGProps<SVGSVGElement>) {
2424
return (
25-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" {...props}>
25+
<svg
26+
viewBox="0 0 24 24"
27+
fill="none"
28+
stroke="currentColor"
29+
strokeWidth="1.8"
30+
{...props}
31+
>
2632
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
2733
</svg>
2834
);
2935
}
3036

3137
function UsersIcon(props: React.SVGProps<SVGSVGElement>) {
3238
return (
33-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" {...props}>
39+
<svg
40+
viewBox="0 0 24 24"
41+
fill="none"
42+
stroke="currentColor"
43+
strokeWidth="1.8"
44+
{...props}
45+
>
3446
<path d="M17 21v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2" />
3547
<circle cx="9" cy="7" r="4" />
3648
<path d="M23 21v-2a4 4 0 0 0-3-3.87" />
@@ -40,7 +52,10 @@ function UsersIcon(props: React.SVGProps<SVGSVGElement>) {
4052
}
4153

4254
function SectionHeader({
43-
icon, title, count, action,
55+
icon,
56+
title,
57+
count,
58+
action,
4459
}: {
4560
icon: "heart" | "users";
4661
title: string;
@@ -57,7 +72,9 @@ function SectionHeader({
5772
<h2 className="text-lg font-bold text-[#3c69b4] leading-[1.8rem]">
5873
{title}
5974
{typeof count !== "undefined" && (
60-
<span className="ml-2 text-sm font-medium text-gray-400">{count}</span>
75+
<span className="ml-2 text-sm font-medium text-gray-400">
76+
{count}
77+
</span>
6178
)}
6279
</h2>
6380
</div>
@@ -104,7 +121,12 @@ function SigCard({ sig }: { sig: Sig }) {
104121
}}
105122
>
106123
{maxMatch(sig.name).map((name, index) => (
107-
<span key={index} className="break-words drop-shadow-[0_1px_0_rgba(0,0,0,0.15)]">{name}</span>
124+
<span
125+
key={index}
126+
className="break-words drop-shadow-[0_1px_0_rgba(0,0,0,0.15)]"
127+
>
128+
{name}
129+
</span>
108130
))}
109131
</div>
110132
</Link>
@@ -141,7 +163,8 @@ export default function Information() {
141163
const all = (json?.data ?? []) as Sig[];
142164
setSigs(all);
143165
} catch (err: any) {
144-
if (err?.name !== "AbortError") setSigsError(err?.message || "Failed to load SIGs.");
166+
if (err?.name !== "AbortError")
167+
setSigsError(err?.message || "Failed to load SIGs.");
145168
} finally {
146169
setSigsLoading(false);
147170
}
@@ -152,7 +175,11 @@ export default function Information() {
152175

153176
// Top posts
154177
const pageSize = 3;
155-
const { data, isLoading: postsLoading, isError: postsError } = useTopPost({ pageSize });
178+
const {
179+
data,
180+
isLoading: postsLoading,
181+
isError: postsError,
182+
} = useTopPost({ pageSize });
156183

157184
const posts: MinimalThread[] = useMemo(() => {
158185
const raw = Array.isArray((data as any)?.pages)
@@ -164,7 +191,12 @@ export default function Information() {
164191
return (raw as any[]).map((item) => ({
165192
_id: item._id,
166193
title: item.title,
167-
likes: typeof item.likes === "number" ? item.likes : typeof item.like === "number" ? item.like : 0,
194+
likes:
195+
typeof item.likes === "number"
196+
? item.likes
197+
: typeof item.like === "number"
198+
? item.like
199+
: 0,
168200
}));
169201
}, [data]);
170202

@@ -177,8 +209,8 @@ export default function Information() {
177209
.filter((s) =>
178210
q
179211
? s.name.toLowerCase().includes(q) ||
180-
(s.customId?.toLowerCase().includes(q) ?? false)
181-
: true
212+
(s.customId?.toLowerCase().includes(q) ?? false)
213+
: true,
182214
);
183215
}, [sigs, sigQuery]);
184216

@@ -195,11 +227,15 @@ export default function Information() {
195227
<SectionHeader icon="heart" title="Top 3 Posts" />
196228
<div className="mt-2 flex flex-col divide-y divide-gray-100">
197229
{postsError && (
198-
<p className="text-sm text-red-500">Failed to load posts. Please try again later.</p>
230+
<p className="text-sm text-red-500">
231+
Failed to load posts. Please try again later.
232+
</p>
199233
)}
200234

201235
{!postsError && posts.length === 0 && (
202-
<p className="text-sm text-gray-500">No posts yet. Check back soon!</p>
236+
<p className="text-sm text-gray-500">
237+
No posts yet. Check back soon!
238+
</p>
203239
)}
204240

205241
{!postsError && posts.length > 0 && (
@@ -222,7 +258,9 @@ export default function Information() {
222258
count={filteredSigs.length}
223259
action={
224260
<div className="relative">
225-
<label htmlFor="sig-search" className="sr-only">Search SIGs</label>
261+
<label htmlFor="sig-search" className="sr-only">
262+
Search SIGs
263+
</label>
226264
<input
227265
id="sig-search"
228266
value={sigQuery}
@@ -235,7 +273,9 @@ export default function Information() {
235273
/>
236274

237275
<div className="absolute top-[2.6rem] left-0 right-0 bottom-0 mt-2 overflow-y-auto custom-scrollbar">
238-
{sigsError && <p className="text-sm text-red-500 px-0.5">{sigsError}</p>}
276+
{sigsError && (
277+
<p className="text-sm text-red-500 px-0.5">{sigsError}</p>
278+
)}
239279

240280
{!sigsError && (
241281
<ul className="flex flex-wrap items-start justify-center gap-4 px-0.5">

app/(home)/desktop/ThreadsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ const ThreadsList = () => {
3636
);
3737
};
3838

39-
export default ThreadsList;
39+
export default ThreadsList;

app/(home)/mobile/ButtonTools.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ const ButtonTools = ({ switchCallback, sigListCallback }: Props) => {
1313
{/* Toggle Button */}
1414
<div className="flex bg-white/50 backdrop-blur-sm rounded-full relative select-none w-40">
1515
<div
16-
className={`absolute w-20 h-10 bg-md-dark-green rounded-full transition-all duration-500 ${activeTab === "latest" ? "left-0" : "left-20"
17-
}`}
16+
className={`absolute w-20 h-10 bg-md-dark-green rounded-full transition-all duration-500 ${
17+
activeTab === "latest" ? "left-0" : "left-20"
18+
}`}
1819
/>
1920
<button
20-
className={`w-20 text-center relative h-10 transition-colors duration-500 text-sm md:text-base ${activeTab === "latest" ? "text-white" : "text-md-dark-green"
21-
}`}
21+
className={`w-20 text-center relative h-10 transition-colors duration-500 text-sm md:text-base ${
22+
activeTab === "latest" ? "text-white" : "text-md-dark-green"
23+
}`}
2224
onClick={() => {
2325
setActiveTab("latest");
2426
switchCallback(1);
@@ -27,8 +29,9 @@ const ButtonTools = ({ switchCallback, sigListCallback }: Props) => {
2729
Latest
2830
</button>
2931
<button
30-
className={`w-20 text-center relative h-10 transition-colors duration-500 text-sm md:text-base ${activeTab === "top" ? "text-white" : "text-md-dark-green"
31-
}`}
32+
className={`w-20 text-center relative h-10 transition-colors duration-500 text-sm md:text-base ${
33+
activeTab === "top" ? "text-white" : "text-md-dark-green"
34+
}`}
3235
onClick={() => {
3336
setActiveTab("top");
3437
switchCallback(0);
@@ -49,4 +52,4 @@ const ButtonTools = ({ switchCallback, sigListCallback }: Props) => {
4952
);
5053
};
5154

52-
export default ButtonTools;
55+
export default ButtonTools;

app/(home)/mobile/SigList.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ const SIG = (child: any) => {
1616
>
1717
<div className="absolute inset-0 bg-white/0 group-hover:bg-white/10 rounded-2xl transition-colors duration-300" />
1818
{maxMatch(child.name).map((name, index) => (
19-
<p key={index} className="text-white text-xs leading-3 font-semibold relative z-10 text-center">
19+
<p
20+
key={index}
21+
className="text-white text-xs leading-3 font-semibold relative z-10 text-center"
22+
>
2023
{name}
2124
</p>
2225
))}
@@ -103,13 +106,11 @@ const SigList = ({ sigListToggle }: { sigListToggle: Function }) => {
103106

104107
{/* Footer */}
105108
<div className="sticky bottom-0 bg-gradient-to-t from-white/95 to-transparent px-6 py-3 text-center">
106-
<p className="text-gray-500 text-xs">
107-
選擇一個 SIG 來探索更多內容
108-
</p>
109+
<p className="text-gray-500 text-xs">選擇一個 SIG 來探索更多內容</p>
109110
</div>
110111
</div>
111112
</div>
112113
);
113114
};
114115

115-
export default SigList;
116+
export default SigList;

0 commit comments

Comments
 (0)