Skip to content

Commit 8b46546

Browse files
authored
Merge branch '15-filelist-page-개편-및-다운로드-패스워드-확인' into 24-download-page-구조-개편-및-합치기
2 parents eeaa120 + 1f05c02 commit 8b46546

File tree

22 files changed

+182
-132
lines changed

22 files changed

+182
-132
lines changed

.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
PUBLIC_URL=/tempfiles-frontend
2-
REACT_APP_BACKEND_BASEURL= localhost:5000
2+
REACT_APP_BACKEND_BASEURL=http://localhost:5000
3+
# dev - http://localhost:5000
4+
# main - https://tfb.minpeter.cf

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import 'react-toastify/dist/ReactToastify.css';
77
import { Navbar } from './components';
88
import {
99
MainPage,
10-
SuccessPage,
1110
DownloadPage,
1211
DeletePage,
1312
FileListPage,
1413
ApiPage,
1514
NotFoundPage,
15+
CheckPasswordPage,
1616
} from './pages';
1717
import { store } from './state/store';
1818

@@ -45,11 +45,11 @@ export const App: React.FC = () => (
4545
}
4646
>
4747
<Route index element={<MainPage />} />
48-
<Route path="/success" element={<SuccessPage />} />
4948
<Route path="/download" element={<DownloadPage />} />
5049
<Route path="/delete" element={<DeletePage />} />
5150
<Route path="/filelist" element={<FileListPage />} />
5251
<Route path="/api/*" element={<ApiPage />} />
52+
<Route path="/checkpw" element={<CheckPasswordPage />} />
5353
<Route path="*" element={<NotFoundPage />} />
5454
</Route>
5555
</Routes>

src/assets/lockIcon.svg

Lines changed: 22 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import styled from '@emotion/styled';
2+
3+
export const FileBox = styled.div`
4+
background-color: var(--color-backgorund-filelistbox);
5+
color: var(--color-text-tertiary);
6+
border-radius: 10px;
7+
padding: 1.2rem 1.2rem 1.2rem 1.2rem;
8+
display: flex;
9+
flex-direction: row;
10+
align-items: center;
11+
font-size: 2.2rem;
12+
`;

src/components/common/FileListBox/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import React from 'react';
22

3+
import { ReactComponent as LockIcon } from '../../../assets/lockIcon.svg';
34
import * as S from './styled';
45

56
type FileListBoxProps = {
67
filename: string;
78
size: string;
89
LastModified: any;
10+
isEncrypted: boolean;
911
click: () => void;
1012
};
1113

1214
export const FileListBox: React.FC<FileListBoxProps> = ({
1315
filename,
1416
size,
1517
LastModified,
18+
isEncrypted,
1619
click,
1720
}) => (
1821
<S.FileListBoxContainer onClick={click}>
22+
{isEncrypted ? <LockIcon width={'2.3rem'} style={{ marginRight: '0.5rem' }} /> : <></>}
1923
파일이름: {filename} / 크기:{size} / 업로드날짜:{LastModified.year}-{LastModified.month}-
2024
{LastModified.day}
2125
</S.FileListBoxContainer>

src/components/common/FileListBox/styled.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export const FileListBoxContainer = styled.div`
77
padding: 1.2rem 1.2rem 1.2rem 1.2rem;
88
display: flex;
99
flex-direction: row;
10-
align-items: center;
10+
justify-content: center;
11+
align-items: flex-end;
1112
font-size: 2.2rem;
1213
margin-bottom: 1.5rem;
1314
cursor: pointer;

src/components/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './Button';
88
export * from './FileListBox';
99
export * from './Progress';
1010
export * from './SkeletonUIBox';
11+
export * from './FileBox';

src/pages/checkpw/index.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { useEffect } from 'react';
2+
import { useSelector } from 'react-redux';
3+
import { useDispatch } from 'react-redux';
4+
import { bindActionCreators } from 'redux';
5+
6+
import { FileBox } from '../../components';
7+
import { actionCreators } from '../../state';
8+
import { RootState } from '../../state/reducers';
9+
import * as S from './styled';
10+
11+
export const CheckPasswordPage: React.FC = () => {
12+
const checkPasswordFileProps = useSelector((state: RootState) => state.CheckPasswordFileProps);
13+
const { year, month, day } = checkPasswordFileProps.lastModified;
14+
const dispatch = useDispatch();
15+
// eslint-disable-next-line
16+
const { SetDownloadFileProps } = bindActionCreators(actionCreators, dispatch);
17+
18+
useEffect(() => {});
19+
return (
20+
<S.CheckPasswordPageContainer>
21+
<FileBox>
22+
파일이름:{checkPasswordFileProps.filename} / 크기:{checkPasswordFileProps.size} / 업로드된
23+
날짜: {year}-{month}-{day}
24+
</FileBox>
25+
<S.PasswordInputSection>
26+
<S.CheckPasswordInput
27+
onChange={(text) => {
28+
console.log(text);
29+
}}
30+
placeholder="비밀번호를 입력해주세요."
31+
/>
32+
</S.PasswordInputSection>
33+
</S.CheckPasswordPageContainer>
34+
);
35+
};

src/pages/checkpw/styled.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import styled from '@emotion/styled';
2+
3+
export const CheckPasswordPageContainer = styled.div`
4+
display: flex;
5+
flex-direction: column;
6+
width: 100%;
7+
`;
8+
9+
export const PasswordInputSection = styled.div``;
10+
11+
export const CheckPasswordInput = styled.input`
12+
border: 4px solid var(--color-border);
13+
border-radius: 10px;
14+
outline: none;
15+
width: 40rem;
16+
height: 5rem;
17+
padding-left: 12px;
18+
font-size: 1.8rem;
19+
font-weight: 700;
20+
margin-top: 20px;
21+
`;
22+
23+
export const CheckPasswordButton = styled.button``;

src/pages/download/index.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,35 @@ import { useSelector } from 'react-redux';
33
import { useNavigate } from 'react-router-dom';
44
import { toast } from 'react-toastify';
55

6-
import { Button } from '../../components';
6+
import { Button, FileBox } from '../../components';
77
import { RootState } from '../../state/reducers';
8-
import { getFileSize, getDate } from '../../utils';
98
import * as S from './styled';
109

1110
export const DownloadPage: React.FC = () => {
1211
const navigate = useNavigate();
1312
const downloadFileProps: any = useSelector((state: RootState) => state.DownloadFileProps);
14-
const { year, month, day } = getDate(downloadFileProps.LastModified);
13+
const { year, month, day } = downloadFileProps.lastModified;
1514
useEffect(() => {
1615
if (
17-
downloadFileProps.Name === null ||
18-
downloadFileProps.Size === null ||
19-
downloadFileProps.LastModified === null
16+
downloadFileProps.filename === null ||
17+
downloadFileProps.size === null ||
18+
downloadFileProps.lastModified === null
2019
) {
2120
navigate('/');
2221
}
2322
}, [navigate, downloadFileProps]);
2423
return (
2524
<S.DownloadPageContainer>
26-
<S.DonwloadFileBox>
27-
파일이름:{downloadFileProps.Name} / 크기:{getFileSize(downloadFileProps.Size)} / 업로드된
28-
날짜:
25+
<FileBox>
26+
파일이름:{downloadFileProps.filename} / 크기:{downloadFileProps.size} / 업로드된 날짜:
2927
{year}-{month}-{day}
30-
</S.DonwloadFileBox>
28+
</FileBox>
3129
<S.DownloadPageButtonSection>
32-
<a href={`${process.env.REACT_APP_BACKEND_BASEURL}/dl/${downloadFileProps.Name}`}>
30+
<a
31+
href={`${process.env.REACT_APP_BACKEND_BASEURL}/dl/${downloadFileProps.name}${
32+
downloadFileProps.token != null ? `?${downloadFileProps.token}` : ''
33+
}`}
34+
>
3335
<Button click={() => {}} bgColor="var(--color-button-primary)" label="다운로드" />
3436
</a>
3537
<Button

0 commit comments

Comments
 (0)