Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

35 filelist page file이 없을때 #91

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 32 additions & 22 deletions src/pages/filelist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(false); //test: true
const SkeletonUIRandomWidth = ['50', '55', '60', '65', '70', '75', '80'];
const dispatch = useDispatch();
const { SetDownloadFileProps } = bindActionCreators(actionCreators, dispatch);
Expand All @@ -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);
Expand All @@ -39,28 +43,34 @@ export const FileListPage: React.FC = () => {
{loading ? (
<>
<S.FileListPageContainer>
{fileList?.map((item, index) => (
<FileListBox
key={index}
filename={getShortFileName(item.filename)}
fileId={item.fileId}
size={getFileSize(item.size)}
uploadDate={getDate(item.uploadDate)}
isEncrypted={item.isEncrypted}
click={() => {
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) => (
<FileListBox
key={index}
filename={getShortFileName(item.filename)}
fileId={item.fileId}
size={getFileSize(item.size)}
uploadDate={getDate(item.uploadDate)}
isEncrypted={item.isEncrypted}
click={() => {
if (item.isEncrypted) {
navigate(`/checkpw/${item.fileId}`);
} else {
SetDownloadFileProps({
fileId: item.fileId,
isEncrypted: item.isEncrypted,
token: null,
});
navigate(`/download/${item.fileId}`);
}
}}
/>
))}
</>
) : (
<S.FileListZero>업로드된 파일이 없습니다.</S.FileListZero>
)}
</S.FileListPageContainer>
<S.FileListPageBoxShoadow />
</>
Expand Down
6 changes: 6 additions & 0 deletions src/pages/filelist/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
`;