From 9b9f8d9ac618a96e4353c1d3f5c9fe7c4771127c Mon Sep 17 00:00:00 2001 From: anjaemin Date: Thu, 17 Nov 2022 15:47:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20file=EC=9D=B4=20=EC=97=86=EC=9D=84?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/filelist/index.tsx | 54 +++++++++++++++++++++--------------- src/pages/filelist/styled.ts | 6 ++++ 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/pages/filelist/index.tsx b/src/pages/filelist/index.tsx index 3d108ba..cbe7d63 100644 --- a/src/pages/filelist/index.tsx +++ b/src/pages/filelist/index.tsx @@ -12,6 +12,7 @@ import * as S from './styled'; export const FileListPage: React.FC = () => { const navigate = useNavigate(); const [loading, setLoading] = useState(false); + const [listZero, setListZero] = useState(true); //test: true const SkeletonUIRandomWidth = ['50', '55', '60', '65', '70', '75', '80']; const dispatch = useDispatch(); const { SetDownloadFileProps } = bindActionCreators(actionCreators, dispatch); @@ -23,6 +24,9 @@ export const FileListPage: React.FC = () => { }) .then((res) => { setFileList(res.data.list); //파일리스트 요소 갯수에 따른 핸들링 추가예정 + if (res.data.numberOfList === 0) { + setListZero(true); + } setTimeout(() => { setLoading(true); //loading 확인하고싶으면 false로 바꿔주세요. }, 1000); @@ -39,28 +43,34 @@ export const FileListPage: React.FC = () => { {loading ? ( <> - {fileList?.map((item, index) => ( - { - if (item.isEncrypted) { - navigate(`/checkpw/${item.fileId}`); - } else { - SetDownloadFileProps({ - fileId: item.fileId, - isEncrypted: item.isEncrypted, - token: null, - }); - navigate(`/download/${item.fileId}`); - } - }} - /> - ))} + {!listZero ? ( + <> + {fileList?.map((item, index) => ( + { + if (item.isEncrypted) { + navigate(`/checkpw/${item.fileId}`); + } else { + SetDownloadFileProps({ + fileId: item.fileId, + isEncrypted: item.isEncrypted, + token: null, + }); + navigate(`/download/${item.fileId}`); + } + }} + /> + ))} + + ) : ( + 업로드된 파일이 없습니다. + )} diff --git a/src/pages/filelist/styled.ts b/src/pages/filelist/styled.ts index 2d99b87..33509d8 100644 --- a/src/pages/filelist/styled.ts +++ b/src/pages/filelist/styled.ts @@ -18,3 +18,9 @@ export const FileListPageBoxShoadow = styled.div` top: -2.5rem; //-25px background: linear-gradient(180deg, rgba(40, 42, 58, 0) 0%, #282a3a 45.31%); `; + +export const FileListZero = styled.div` + font-size: 3rem; + font-weight: 700; + margin: 5rem; +`; From cb97549e523899f24dbd219d208b00ae5f9aa2d4 Mon Sep 17 00:00:00 2001 From: anjaemin Date: Thu, 17 Nov 2022 15:48:22 +0900 Subject: [PATCH 2/2] fix: test code --- src/pages/filelist/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/filelist/index.tsx b/src/pages/filelist/index.tsx index cbe7d63..234d43d 100644 --- a/src/pages/filelist/index.tsx +++ b/src/pages/filelist/index.tsx @@ -12,7 +12,7 @@ import * as S from './styled'; export const FileListPage: React.FC = () => { const navigate = useNavigate(); const [loading, setLoading] = useState(false); - const [listZero, setListZero] = useState(true); //test: true + const [listZero, setListZero] = useState(false); //test: true const SkeletonUIRandomWidth = ['50', '55', '60', '65', '70', '75', '80']; const dispatch = useDispatch(); const { SetDownloadFileProps } = bindActionCreators(actionCreators, dispatch);