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

93 upload 로딩후 백엔드 작업 로딩 추가 #95

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
6 changes: 4 additions & 2 deletions src/components/common/Progress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ type ProgressBarProps = {
value: number;
fileName: string;
typing: string;
stateText: string;
};

export const Progress: React.FC<ProgressBarProps> = ({ value, fileName, typing }) => {
export const Progress: React.FC<ProgressBarProps> = ({ value, fileName, typing, stateText }) => {
const likecontainer = useRef();
useEffect(() => {
Lottie.loadAnimation({
Expand All @@ -26,7 +27,8 @@ export const Progress: React.FC<ProgressBarProps> = ({ value, fileName, typing }
<S.ProgressAnimationBox ref={likecontainer} />
<S.ProgressBar width={value} />
<S.ProgressText>
{fileName} uploading{typing}
{fileName} {stateText}
{typing}
</S.ProgressText>
</S.ProgressContainer>
);
Expand Down
9 changes: 7 additions & 2 deletions src/pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const MainPage: React.FC = () => {
const typingText = ['.', '..', '...'];
const [typingCount, setTypingCount] = useState(0);
const [uploading, setUploading] = useState(true);
const [progressValue, serProgressValue] = useState(0);
const [progressValue, setProgressValue] = useState(0);
const [progressStateText, setProgressStateText] = useState('uploading');

const [retentionPeriod, setRetentionPeriod] = useState(false);
const [downloadCount, setDownloadCount] = useState(false);
Expand Down Expand Up @@ -58,7 +59,10 @@ export const MainPage: React.FC = () => {
},
onUploadProgress(progress) {
setUploading(false);
serProgressValue(Math.floor((progress.loaded / progress.total) * 100));
setProgressValue(Math.floor((progress.loaded / progress.total) * 100));
if (Math.floor((progress.loaded / progress.total) * 100) === 100) {
setProgressStateText('백엔드 처리중');
}
},
})
.then(async (res) => {
Expand Down Expand Up @@ -151,6 +155,7 @@ export const MainPage: React.FC = () => {
value={progressValue}
fileName={fileProps.filename}
typing={typingText[typingCount]}
stateText={progressStateText}
/>
)}
</S.MainPageContainer>
Expand Down