Skip to content

Commit f5560e3

Browse files
authored
Merge pull request #82 from tempfiles-Team/dev
Dev
2 parents 49c30e5 + f861ab8 commit f5560e3

File tree

1 file changed

+56
-45
lines changed

1 file changed

+56
-45
lines changed

src/pages/download/index.tsx

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useSelector } from 'react-redux';
44
import { useNavigate } from 'react-router-dom';
55
import { toast } from 'react-toastify';
66

7-
import { Button, FileBox } from '../../components';
7+
import { Button, FileBox, SkeletonUI } from '../../components';
88
import { useDeletePageNavigator } from '../../hooks';
99
import { RootState } from '../../state/reducers';
1010
import { getDate, getFileSize } from '../../utils';
@@ -13,6 +13,7 @@ import * as S from './styled';
1313
export const DownloadPage: React.FC = () => {
1414
const navigate = useNavigate();
1515
const downloadFileProps: any = useSelector((state: RootState) => state.DownloadFileProps);
16+
const [loading, setLoading] = useState(true);
1617
const [fileProps, setFileProps] = useState({
1718
filename: '',
1819
// fileId: '',
@@ -38,6 +39,7 @@ export const DownloadPage: React.FC = () => {
3839
}`,
3940
})
4041
.then((res) => {
42+
setLoading(false);
4143
setFileProps({
4244
filename: res.data.filename,
4345
// fileId: res.data.fileId,
@@ -65,51 +67,60 @@ export const DownloadPage: React.FC = () => {
6567
}, [downloadFileProps, navigate]);
6668
return (
6769
<S.DownloadPageContainer>
68-
<FileBox>
69-
파일이름:{fileProps.filename} / 크기:{fileProps.size} / 업로드된 날짜:
70-
{fileProps.uploadDate.year}-{fileProps.uploadDate.month}-{fileProps.uploadDate.day}
71-
</FileBox>
72-
<S.DownloadPageButtonSection>
73-
<a
74-
href={`${fileProps.download_url}${
75-
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
76-
}`}
77-
>
78-
<Button click={() => {}} bgColor="var(--color-button-primary)" label="다운로드" />
79-
</a>
80-
<Button
81-
click={() => {
82-
navigator.clipboard.writeText(
83-
`${fileProps.download_url}${
70+
{!loading ? (
71+
<>
72+
<FileBox>
73+
파일이름:{fileProps.filename} / 크기:{fileProps.size} / 업로드된 날짜:
74+
{fileProps.uploadDate.year}-{fileProps.uploadDate.month}-{fileProps.uploadDate.day}
75+
</FileBox>
76+
<S.DownloadPageButtonSection>
77+
<a
78+
href={`${fileProps.download_url}${
8479
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
85-
}`,
86-
);
87-
toast.success('복사 완료', {
88-
autoClose: 1000,
89-
position: toast.POSITION.BOTTOM_RIGHT,
90-
});
91-
}}
92-
bgColor="var(--color-button-primary)"
93-
label="링크복사"
94-
/>
95-
<Button
96-
click={() => {
97-
move();
98-
}}
99-
bgColor="var(--color-button-secondary)"
100-
label="파일삭제"
101-
/>
102-
<Button
103-
click={() => {
104-
toast.success('제작중!', {
105-
autoClose: 1000,
106-
position: toast.POSITION.BOTTOM_RIGHT,
107-
});
108-
}}
109-
bgColor="var(--color-button-secondary)"
110-
label="신고"
111-
/>
112-
</S.DownloadPageButtonSection>
80+
}`}
81+
>
82+
<Button click={() => {}} bgColor="var(--color-button-primary)" label="다운로드" />
83+
</a>
84+
<Button
85+
click={() => {
86+
navigator.clipboard.writeText(
87+
`${fileProps.download_url}${
88+
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
89+
}`,
90+
);
91+
toast.success('복사 완료', {
92+
autoClose: 1000,
93+
position: toast.POSITION.BOTTOM_RIGHT,
94+
});
95+
}}
96+
bgColor="var(--color-button-primary)"
97+
label="링크복사"
98+
/>
99+
<Button
100+
click={() => {
101+
move();
102+
}}
103+
bgColor="var(--color-button-secondary)"
104+
label="파일삭제"
105+
/>
106+
<Button
107+
click={() => {
108+
toast.success('제작중!', {
109+
autoClose: 1000,
110+
position: toast.POSITION.BOTTOM_RIGHT,
111+
});
112+
}}
113+
bgColor="var(--color-button-secondary)"
114+
label="신고"
115+
/>
116+
</S.DownloadPageButtonSection>
117+
</>
118+
) : (
119+
<>
120+
<SkeletonUI width="80rem" height="4.6rem" margin="0" />
121+
<SkeletonUI width="64rem" height="6rem" margin="3rem 0px 0px 0px" />
122+
</>
123+
)}
113124
</S.DownloadPageContainer>
114125
);
115126
};

0 commit comments

Comments
 (0)