Skip to content

Commit

Permalink
Merge pull request #82 from tempfiles-Team/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ananjaemin committed Nov 16, 2022
2 parents 49c30e5 + f861ab8 commit f5560e3
Showing 1 changed file with 56 additions and 45 deletions.
101 changes: 56 additions & 45 deletions src/pages/download/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { toast } from 'react-toastify';

import { Button, FileBox } from '../../components';
import { Button, FileBox, SkeletonUI } from '../../components';
import { useDeletePageNavigator } from '../../hooks';
import { RootState } from '../../state/reducers';
import { getDate, getFileSize } from '../../utils';
Expand All @@ -13,6 +13,7 @@ import * as S from './styled';
export const DownloadPage: React.FC = () => {
const navigate = useNavigate();
const downloadFileProps: any = useSelector((state: RootState) => state.DownloadFileProps);
const [loading, setLoading] = useState(true);
const [fileProps, setFileProps] = useState({
filename: '',
// fileId: '',
Expand All @@ -38,6 +39,7 @@ export const DownloadPage: React.FC = () => {
}`,
})
.then((res) => {
setLoading(false);
setFileProps({
filename: res.data.filename,
// fileId: res.data.fileId,
Expand Down Expand Up @@ -65,51 +67,60 @@ export const DownloadPage: React.FC = () => {
}, [downloadFileProps, navigate]);
return (
<S.DownloadPageContainer>
<FileBox>
ํŒŒ์ผ์ด๋ฆ„:{fileProps.filename} / ํฌ๊ธฐ:{fileProps.size} / ์—…๋กœ๋“œ๋œ ๋‚ ์งœ:
{fileProps.uploadDate.year}-{fileProps.uploadDate.month}-{fileProps.uploadDate.day}
</FileBox>
<S.DownloadPageButtonSection>
<a
href={`${fileProps.download_url}${
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
}`}
>
<Button click={() => {}} bgColor="var(--color-button-primary)" label="๋‹ค์šด๋กœ๋“œ" />
</a>
<Button
click={() => {
navigator.clipboard.writeText(
`${fileProps.download_url}${
{!loading ? (
<>
<FileBox>
ํŒŒ์ผ์ด๋ฆ„:{fileProps.filename} / ํฌ๊ธฐ:{fileProps.size} / ์—…๋กœ๋“œ๋œ ๋‚ ์งœ:
{fileProps.uploadDate.year}-{fileProps.uploadDate.month}-{fileProps.uploadDate.day}
</FileBox>
<S.DownloadPageButtonSection>
<a
href={`${fileProps.download_url}${
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
}`,
);
toast.success('๋ณต์‚ฌ ์™„๋ฃŒ', {
autoClose: 1000,
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
bgColor="var(--color-button-primary)"
label="๋งํฌ๋ณต์‚ฌ"
/>
<Button
click={() => {
move();
}}
bgColor="var(--color-button-secondary)"
label="ํŒŒ์ผ์‚ญ์ œ"
/>
<Button
click={() => {
toast.success('์ œ์ž‘์ค‘!', {
autoClose: 1000,
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
bgColor="var(--color-button-secondary)"
label="์‹ ๊ณ "
/>
</S.DownloadPageButtonSection>
}`}
>
<Button click={() => {}} bgColor="var(--color-button-primary)" label="๋‹ค์šด๋กœ๋“œ" />
</a>
<Button
click={() => {
navigator.clipboard.writeText(
`${fileProps.download_url}${
fileProps.isEncrypted ? `?token=${downloadFileProps.token}` : ''
}`,
);
toast.success('๋ณต์‚ฌ ์™„๋ฃŒ', {
autoClose: 1000,
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
bgColor="var(--color-button-primary)"
label="๋งํฌ๋ณต์‚ฌ"
/>
<Button
click={() => {
move();
}}
bgColor="var(--color-button-secondary)"
label="ํŒŒ์ผ์‚ญ์ œ"
/>
<Button
click={() => {
toast.success('์ œ์ž‘์ค‘!', {
autoClose: 1000,
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
bgColor="var(--color-button-secondary)"
label="์‹ ๊ณ "
/>
</S.DownloadPageButtonSection>
</>
) : (
<>
<SkeletonUI width="80rem" height="4.6rem" margin="0" />
<SkeletonUI width="64rem" height="6rem" margin="3rem 0px 0px 0px" />
</>
)}
</S.DownloadPageContainer>
);
};

0 comments on commit f5560e3

Please sign in to comment.