@@ -13,26 +13,32 @@ import styles from "./index.module.css";
1313import { humanizeFileSize } from "utils/humanize" ;
1414
1515import Tooltip from "components/Tooltip/index" ;
16+ import { TableCellsIcon } from "@heroicons/react/24/solid" ;
1617
1718// TODO: how to download? by open a link in browser
1819// or as background job?
1920
20- export type ValidFileType = ".txt" | ".pdf" | ".doc" | ".docx" | ".md" ;
21- export function GetValidFileTypeList ( ) {
22- return [ ".txt" , ".pdf" , ".doc" , ".docx" , ".md" ] ;
21+ export enum ValidFileTypeEnum {
22+ TXT = ".txt" ,
23+ PDF = ".pdf" ,
24+ DOC = ".doc" ,
25+ DOCX = ".docx" ,
26+ MD = ".md" ,
27+ XLS = ".xls" ,
2328}
24- export function IsValidFileType ( ext : string ) {
25- if ( ! ext ) return false ;
26- ext = ext . toLowerCase ( ) ;
27- return GetValidFileTypeList ( ) . includes ( ext ) ;
29+ export type ValidFileType = keyof ValidFileTypeEnum ;
30+
31+ export enum TabIDsEnum {
32+ ReportsReview = "reports-review" ,
33+ StudyAbroadPlanning = "study-abroad-planning" ,
2834}
2935
3036export interface FileCardCommonProps {
31- type : "review" ;
37+ tab : TabIDsEnum ;
3238
3339 className ?: string ;
3440
35- filetype : ValidFileType ;
41+ filetype : ValidFileTypeEnum ;
3642 filesize : number ;
3743 filename : string ;
3844 uploadProgress : number ; // percentage, i.e. 0 - 1
@@ -51,8 +57,6 @@ export interface FileCardNotDoneProps {
5157}
5258
5359export 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,13 +148,13 @@ export function FileCard(props: FileCardProps) {
145148 </ div >
146149 { props . done && (
147150 < div className = { s ( "card vertical shadow" ) } >
148- { props . type === "review" && (
151+ { props . tab && (
149152 < div className = "w-full" >
150- < h2 > 审核概述 </ h2 >
153+ < h2 > 处理结果 </ h2 >
151154 < DashedSparator className = { s ( "my-4" ) } />
152155 < p className = { s ( "overview" ) } > { props . overview } </ p >
153156 < DashedSparator className = { s ( "my-4" ) } />
154- < div className = { s ( "card horizontal bordered" ) } >
157+ { /* <div className={s("card horizontal bordered")}>
155158 <div className="flex flex-row space-x-4 items-center flex-1 w-0">
156159 <DocumentIcon type={props.filetype} />
157160 <div className={s("file-info-wrap")}>
@@ -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>
@@ -177,10 +178,10 @@ export function FileCard(props: FileCardProps) {
177178 mentioned={props.mentioned}
178179 mentionables={props.mentionables}
179180 onCopyOverview={handleOverviewCopy}
180- />
181+ /> */ }
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 >
@@ -286,15 +287,16 @@ export function DocumentIcon({
286287 type,
287288 classNames,
288289} : {
289- type : ValidFileType ;
290+ type : ValidFileTypeEnum ;
290291 classNames ?: string ;
291292} ) {
292- const mappings : Record < ValidFileType , ReactElement > = {
293+ const mappings : Record < ValidFileTypeEnum , ReactElement > = {
293294 ".txt" : < TxtIcon className = { classNames } /> ,
294295 ".pdf" : < PdfIcon className = { classNames } /> ,
295296 ".doc" : < DocIcon className = { classNames } /> ,
296297 ".docx" : < DocIcon className = { classNames } /> ,
297- ".md" : < DocIcon className = { classNames } /> ,
298+ ".md" : < TxtIcon className = { classNames } /> ,
299+ ".xls" : < ExcelIcon className = { classNames } /> ,
298300 } ;
299301
300302 return mappings [ type ] ;
@@ -386,3 +388,38 @@ const DocIcon = forwardRef<SVGSVGElement, React.HTMLProps<SVGSVGElement>>(
386388 ) ;
387389 }
388390) ;
391+
392+ const ExcelIcon = forwardRef < SVGSVGElement , React . HTMLProps < SVGSVGElement > > (
393+ ( props , ref ) => {
394+ return (
395+ < svg
396+ ref = { ref }
397+ { ...props }
398+ width = "40"
399+ height = "40"
400+ viewBox = "0 0 40 40"
401+ fill = "none"
402+ xmlns = "http://www.w3.org/2000/svg"
403+
404+ // stroke-width="1.5"
405+ // stroke="currentColor"
406+ // class="w-6 h-6"
407+ >
408+ { /* <path
409+ d="M5 6C5 3.79086 6.79086 2 9 2H27C31.4183 2 35 5.58172 35 10V34C35 36.2091 33.2091 38 31 38H9C6.79086 38 5 36.2091 5 34V6Z"
410+ fill="#9CCC65"
411+ />
412+ <path
413+ d="M26.5 3.5C30.366 3.5 33.5 6.63401 33.5 10.5H26.5V3.5Z"
414+ fill="white"
415+ /> */ }
416+ < path
417+ stroke-linecap = "round"
418+ stroke-linejoin = "round"
419+ d = "M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 01-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0112 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"
420+ fill = "#9ECC65"
421+ />
422+ </ svg >
423+ ) ;
424+ }
425+ ) ;
0 commit comments