-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from SAT-Duel/128-fix-user-login
revised a lot
- Loading branch information
Showing
12 changed files
with
245 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { Modal, Typography, Spin } from 'antd'; | ||
import { LoadingOutlined } from '@ant-design/icons'; | ||
import styled, { keyframes } from 'styled-components'; | ||
|
||
const { Text } = Typography; | ||
|
||
const spin = keyframes` | ||
from { transform: rotate(0deg); } | ||
to { transform: rotate(360deg); } | ||
`; | ||
|
||
const StyledLoadingIcon = styled(LoadingOutlined)` | ||
font-size: 48px; | ||
color: #4C3D97; | ||
margin-bottom: 24px; | ||
`; | ||
|
||
const MatchingContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
padding: 24px; | ||
text-align: center; | ||
`; | ||
|
||
const LoadingText = styled(Text)` | ||
font-size: 18px; | ||
margin-top: 16px; | ||
color: #4A4A4A; | ||
`; | ||
|
||
const sentences = [ | ||
"Searching for opponents...", | ||
"Getting ready for the battle...", | ||
"Preparing your duel...", | ||
"Almost there...", | ||
"Setting up your battle arena..." | ||
]; | ||
|
||
const MatchingModal = ({ visible, onCancel }) => { | ||
const [loadingMessage, setLoadingMessage] = useState(sentences[0]); | ||
|
||
useEffect(() => { | ||
if (visible) { | ||
const interval = setInterval(() => { | ||
setLoadingMessage((prev) => { | ||
const currentIndex = sentences.indexOf(prev); | ||
return sentences[(currentIndex + 1) % sentences.length]; | ||
}); | ||
}, 3000); | ||
return () => clearInterval(interval); | ||
} | ||
}, [visible]); | ||
|
||
return ( | ||
<Modal | ||
visible={visible} | ||
onCancel={onCancel} | ||
footer={null} | ||
closable={true} | ||
centered | ||
width={400} | ||
maskStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.6)' }} | ||
bodyStyle={{ padding: 0 }} | ||
> | ||
<MatchingContainer> | ||
<StyledLoadingIcon spin /> | ||
<LoadingText>{loadingMessage}</LoadingText> | ||
</MatchingContainer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default MatchingModal; |
2 changes: 1 addition & 1 deletion
2
src/components/BattleHistory.js → src/components/Profile/BattleHistory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/components/Inventory.js → src/components/Profile/Inventory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.