Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Commit 7b13803

Browse files
author
Weidows
committed
adjust homepage
1 parent 538a900 commit 7b13803

3 files changed

Lines changed: 193 additions & 135 deletions

File tree

react-app/src/components/FileCard/index.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ import Tooltip from "components/Tooltip/index";
1818
// or as background job?
1919

2020
export type ValidFileType = ".txt" | ".pdf" | ".doc" | ".docx" | ".md";
21+
export type TabIDs = "reports-review" | "study-abroad-planning";
22+
export enum TabIDsEnum {
23+
ReportsReview = "reports-review",
24+
StudyAbroadPlanning = "study-abroad-planning",
25+
}
26+
2127
export function GetValidFileTypeList() {
2228
return [".txt", ".pdf", ".doc", ".docx", ".md"];
2329
}
@@ -28,7 +34,7 @@ export function IsValidFileType(ext: string) {
2834
}
2935

3036
export interface FileCardCommonProps {
31-
type: "review";
37+
tab: TabIDsEnum;
3238

3339
className?: string;
3440

@@ -51,8 +57,6 @@ export interface FileCardNotDoneProps {
5157
}
5258

5359
export interface FileCardReviewProps {
54-
type: "review";
55-
5660
done: true;
5761
overview: string;
5862
grade: number;
@@ -77,8 +81,7 @@ export function FileCard(props: FileCardProps) {
7781
<div className={s("file-info-wrap")}>
7882
<span className={s("file-name")}> {props.filename} </span>
7983
<span className={s("file-size")}>
80-
{" "}
81-
{humanizeFileSize(props.filesize)}{" "}
84+
{humanizeFileSize(props.filesize)}
8285
</span>
8386
</div>
8487
</div>
@@ -145,7 +148,7 @@ export function FileCard(props: FileCardProps) {
145148
</div>
146149
{props.done && (
147150
<div className={s("card vertical shadow")}>
148-
{props.type === "review" && (
151+
{props.tab === TabIDsEnum.ReportsReview && (
149152
<div className="w-full">
150153
<h2> 审核概述 </h2>
151154
<DashedSparator className={s("my-4")} />
@@ -160,12 +163,10 @@ export function FileCard(props: FileCardProps) {
160163
"file-name text-indigo-500 dark:text-indigo-300"
161164
)}
162165
>
163-
{" "}
164-
{props.filename}{" "}
166+
{props.filename}
165167
</span>
166168
<span className={s("file-size")}>
167-
{" "}
168-
{humanizeFileSize(props.filesize)}{" "}
169+
{humanizeFileSize(props.filesize)}
169170
</span>
170171
</div>
171172
</div>
@@ -180,7 +181,7 @@ export function FileCard(props: FileCardProps) {
180181
/>
181182
</div>
182183
)}
183-
{props.type === "review" && (
184+
{props.tab === TabIDsEnum.ReportsReview && (
184185
<div className="w-full">
185186
<h2> 评分结果 </h2>
186187
<span className={s("grade")}>{props.grade}</span>

react-app/src/index.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,20 @@ const RootComponent = () => {
8585
}, [])
8686

8787
return (
88-
<div id="app">
89-
<ThemeContext.Provider value={{ theme: currentTheme, setTheme: changeTheme }}>
90-
<HashRouter>
91-
<Routes>
92-
<Route path="/" element={<Index />} />
93-
<Route path="/login" element={<Login />} />
94-
<Route path="/home/:tab?/:workspace?" element={<Home />} />
95-
</Routes>
96-
</HashRouter>
97-
</ThemeContext.Provider>
98-
</div >
99-
)
88+
<div id="app">
89+
<ThemeContext.Provider
90+
value={{ theme: currentTheme, setTheme: changeTheme }}
91+
>
92+
<HashRouter>
93+
<Routes>
94+
<Route path="/" element={<Index />} />
95+
<Route path="/login" element={<Login />} />
96+
<Route path="/home/:tabID?/:workspaceID?" element={<Home />} />
97+
</Routes>
98+
</HashRouter>
99+
</ThemeContext.Provider>
100+
</div>
101+
);
100102
};
101103

102104
/**

0 commit comments

Comments
 (0)