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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { useTranslation } from 'react-i18next';
|
| 3 |
+
|
| 4 |
+
const LoadingScreen = () => {
|
| 5 |
+
const { t, i18n } = useTranslation();
|
| 6 |
+
|
| 7 |
+
const handleLanguageChange = (e) => {
|
| 8 |
+
i18n.changeLanguage(e.target.value);
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
return (
|
| 12 |
+
<div style={{
|
| 13 |
+
position: 'fixed',
|
| 14 |
+
top: 0,
|
| 15 |
+
left: 0,
|
| 16 |
+
width: '100vw',
|
| 17 |
+
height: '100vh',
|
| 18 |
+
background: 'linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #4CAF50 100%)',
|
| 19 |
+
display: 'flex',
|
| 20 |
+
flexDirection: 'column',
|
| 21 |
+
justifyContent: 'center',
|
| 22 |
+
alignItems: 'center',
|
| 23 |
+
zIndex: 9999,
|
| 24 |
+
padding: '20px'
|
| 25 |
+
}}>
|
| 26 |
+
{/* Language Selector */}
|
| 27 |
+
<div style={{
|
| 28 |
+
position: 'absolute',
|
| 29 |
+
top: '20px',
|
| 30 |
+
right: '20px',
|
| 31 |
+
background: 'rgba(255, 255, 255, 0.1)',
|
| 32 |
+
padding: '8px',
|
| 33 |
+
borderRadius: '8px'
|
| 34 |
+
}}>
|
| 35 |
+
<select
|
| 36 |
+
id="language-select-loading"
|
| 37 |
+
onChange={handleLanguageChange}
|
| 38 |
+
value={i18n.language}
|
| 39 |
+
style={{
|
| 40 |
+
background: 'transparent',
|
| 41 |
+
color: 'white',
|
| 42 |
+
border: '1px solid white',
|
| 43 |
+
borderRadius: '5px',
|
| 44 |
+
padding: '5px 10px',
|
| 45 |
+
cursor: 'pointer',
|
| 46 |
+
fontSize: '1rem'
|
| 47 |
+
}}
|
| 48 |
+
>
|
| 49 |
+
<option value="vi" style={{color: 'black'}}>Tiếng Việt</option>
|
| 50 |
+
<option value="en" style={{color: 'black'}}>English</option>
|
| 51 |
+
</select>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
{/* Logo */}
|
| 55 |
+
<div style={{
|
| 56 |
+
textAlign: 'center',
|
| 57 |
+
marginBottom: '40px'
|
| 58 |
+
}}>
|
| 59 |
+
<div style={{
|
| 60 |
+
fontSize: '6rem',
|
| 61 |
+
marginBottom: '20px',
|
| 62 |
+
animation: 'pulse 2s ease-in-out infinite'
|
| 63 |
+
}}>
|
| 64 |
+
🌱
|
| 65 |
+
</div>
|
| 66 |
+
<h1 style={{
|
| 67 |
+
fontSize: '4rem',
|
| 68 |
+
color: 'white',
|
| 69 |
+
margin: 0,
|
| 70 |
+
fontWeight: 'bold',
|
| 71 |
+
textShadow: '2px 2px 4px rgba(0,0,0,0.3)',
|
| 72 |
+
animation: 'fadeInUp 1s ease-out'
|
| 73 |
+
}}>
|
| 74 |
+
{t('loadingScreen.title')}
|
| 75 |
+
</h1>
|
| 76 |
+
<p style={{
|
| 77 |
+
fontSize: '1.5rem',
|
| 78 |
+
color: '#E8F5E9',
|
| 79 |
+
margin: '10px 0 0 0',
|
| 80 |
+
fontWeight: '300',
|
| 81 |
+
animation: 'fadeInUp 1s ease-out 0.3s both'
|
| 82 |
+
}}>
|
| 83 |
+
{t('loadingScreen.subtitle')}
|
| 84 |
+
</p>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
{/* Loading Animation */}
|
| 88 |
+
<div style={{
|
| 89 |
+
display: 'flex',
|
| 90 |
+
gap: '8px',
|
| 91 |
+
marginTop: '20px'
|
| 92 |
+
}}>
|
| 93 |
+
<div style={{
|
| 94 |
+
width: '12px',
|
| 95 |
+
height: '12px',
|
| 96 |
+
borderRadius: '50%',
|
| 97 |
+
background: 'white',
|
| 98 |
+
animation: 'bounce 1.4s ease-in-out infinite both',
|
| 99 |
+
animationDelay: '0s'
|
| 100 |
+
}}></div>
|
| 101 |
+
<div style={{
|
| 102 |
+
width: '12px',
|
| 103 |
+
height: '12px',
|
| 104 |
+
borderRadius: '50%',
|
| 105 |
+
background: 'white',
|
| 106 |
+
animation: 'bounce 1.4s ease-in-out infinite both',
|
| 107 |
+
animationDelay: '0.16s'
|
| 108 |
+
}}></div>
|
| 109 |
+
<div style={{
|
| 110 |
+
width: '12px',
|
| 111 |
+
height: '12px',
|
| 112 |
+
borderRadius: '50%',
|
| 113 |
+
background: 'white',
|
| 114 |
+
animation: 'bounce 1.4s ease-in-out infinite both',
|
| 115 |
+
animationDelay: '0.32s'
|
| 116 |
+
}}></div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
{/* Loading Text */}
|
| 120 |
+
<p style={{
|
| 121 |
+
color: 'white',
|
| 122 |
+
fontSize: '1.1rem',
|
| 123 |
+
marginTop: '30px',
|
| 124 |
+
opacity: 0.9,
|
| 125 |
+
animation: 'fadeIn 2s ease-in-out'
|
| 126 |
+
}}>
|
| 127 |
+
{t('loadingScreen.loadingText')}
|
| 128 |
+
</p>
|
| 129 |
+
|
| 130 |
+
<style jsx>{`
|
| 131 |
+
@keyframes pulse {
|
| 132 |
+
0%, 100% {
|
| 133 |
+
transform: scale(1);
|
| 134 |
+
}
|
| 135 |
+
50% {
|
| 136 |
+
transform: scale(1.1);
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
@keyframes fadeInUp {
|
| 141 |
+
from {
|
| 142 |
+
opacity: 0;
|
| 143 |
+
transform: translateY(30px);
|
| 144 |
+
}
|
| 145 |
+
to {
|
| 146 |
+
opacity: 1;
|
| 147 |
+
transform: translateY(0);
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
@keyframes fadeIn {
|
| 152 |
+
from {
|
| 153 |
+
opacity: 0;
|
| 154 |
+
}
|
| 155 |
+
to {
|
| 156 |
+
opacity: 1;
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
@keyframes bounce {
|
| 161 |
+
0%, 80%, 100% {
|
| 162 |
+
transform: scale(0);
|
| 163 |
+
}
|
| 164 |
+
40% {
|
| 165 |
+
transform: scale(1);
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
`}</style>
|
| 169 |
+
</div>
|
| 170 |
+
);
|
| 171 |
+
};
|
| 172 |
+
|
| 173 |
+
export default LoadingScreen;
|