From 9152bd48ebfae263d97870da611abef743ddb1c0 Mon Sep 17 00:00:00 2001 From: Georgy Shive Date: Fri, 30 May 2025 02:33:02 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=83=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8,=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=84?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + public/favicon.ico | Bin 0 -> 15406 bytes src/App.css | 79 +++++------ src/App.tsx | 2 + src/components/FormButton.css | 138 ++++++++++++++++++++ src/components/FormButton.tsx | 43 ++++++ src/components/FormInput.css | 104 +++++++++++++++ src/components/FormInput.tsx | 45 +++++++ src/pages/Login.css | 238 ++++++++++++++++++++++++++++++++++ src/pages/Login.tsx | 80 ++++++++---- src/pages/PotreeViewer.tsx | 28 ++-- src/pages/Register.tsx | 164 +++++++++++++++++++++++ 12 files changed, 837 insertions(+), 85 deletions(-) create mode 100644 public/favicon.ico create mode 100644 src/components/FormButton.css create mode 100644 src/components/FormButton.tsx create mode 100644 src/components/FormInput.css create mode 100644 src/components/FormInput.tsx create mode 100644 src/pages/Login.css create mode 100644 src/pages/Register.tsx diff --git a/index.html b/index.html index f071723..666197f 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ + Кварц diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..61f0e516cb556f2e57eb0d7a8f53c0fa21069608 GIT binary patch literal 15406 zcmeI3d306P6^FM=mbMNHq=HHTqc|WIWl*tNW>7GK31AFiij08}AcQaqG6xipSyYrk zYM{g-;K<+vfkvJZpX2_wGHzK6^Uno;=LX zva_v11=BUgQp%a#VrDTh1>b94WcHNq)u|JDevR3dN@g`xM@`hC;Jz+rE}QN5cBkdp z9hO(Kd)2%KX*Kg2^#32#J66uK=6VjB?AB8{``B(&4{j~Zr_G+|a~I6^NmC~H%(*js z_Pm*%HnO{0V?DoFd~LN)X`gSEt%;u9Z9aMGa9{POrT+YL*`B@h34e9n8Xq-1%_W=L zAB5Y*r?hver-Pl)96X?vuFXWF(0BTd6-o9l{d?9a?YWU?AKP7e+ECmh7z^46`fV#Z z*^$$>*J;onsD+_Jk(-zom zs)L@GYts;nA1`ha18i2I?FZO{_B++NUobxMhV|A_pX-VY8&+uh`PMtIabMMAOyorl z=Fn5zC>C0mLfbFZjBBdSy@K%=8+r-sa)VeYjTTl8X@(6{hq*8A8d?eol>W-&5>>YamxLl-xzA|+uu!5 z{j-v5H7s4viYiAWL1AT!r4{z5r1!})F`|heKSflISvOm6ivrf^`f`XDb$vms4Y5Yo z;_{*TEN*$$CabFdlv-7*dQ!9IMUvRGnO}I$IVZIZ`dMWYi#xpSwA8>yZ-=JFVA_#mp-$|+a@X_XS%Okv)tc&`!(PC zm(4zSNV>l%J?z^5uD`kUb&nsQ@jI&>`ny_?vpiTHizk8G6+xascJiijRK@KTyaXVKY;C8LJO7sy)0(}6vjGPO|XP*M#~=*Ok6&3vxd5N4NMDYclH@YY1xzW6ED_kU%Hc?=j1bc>KAxE*JwDupe`b z5s891v38&v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MEAriK0jCBCj$hz z9X}z@4i@Ah@)c_VzE8gGF7O*{(_dge;)r;_e#As0Y5q<9E-cz*jrwe&Jvn+sZ|Hrd zU><1#pCAU%aiTyLz+U(TvJMPgxlfxb#3(^q=7gU$(CK8ZYDT;4R-g5>u3V%sE)Maa zuJ{JB;3whSi7(;L_)m5)I^9-NIhO{LkB>edn+ML33#zqw$3p|^TR z4ssv*MBYgPUnVEv!+^gtAM^^uXM2$-h#_pmcl`erK@2ny)3tZN+oE02=n(xD_Cobe z44f~J5q+i##*Y{Hdzk9_%$^_&HX0v{w7;Qy5c_N2a_;rH4_$ye0#?`>M3 zU-C9Sfgh2J#tCFcZuAexiQL3BdZ#Wql6uX=AVI#uPRy11aUx$)QdWhNXZ!*AkPDqo z6!-wTjfCN_9iS7C|5NEBC@R3%kv1*Gg>5p8nQk3L3WyPH@tL!w5fgiKp z62FtQ-h3quMp_OkV#lZ@aeKAknk_q)W#K(0M;gNB#9gBP@4+j2+hc8rw78w8-%&iH z{F5J?Q4j;q*}+J=iMal1`z-hy&jlK9qV{tqlyyp4jw}1N)~{zOs;`U18&UXsV^Ol~ z)cQzXWc~S8zYHr);T?UoqK6#ZN9@%OrL4<-rncdm9j(J1WIHp}nh)#rNcD9XBgsMFPT@}Y0F8;e%ir=4n+a=|*C29$OAUaS0x u;Dq?>s15anPKEdB7cTE } /> } /> + } /> } /> {/* Все остальные маршруты ведут на логин */} } /> diff --git a/src/components/FormButton.css b/src/components/FormButton.css new file mode 100644 index 0000000..22e293e --- /dev/null +++ b/src/components/FormButton.css @@ -0,0 +1,138 @@ +/* Основная кнопка */ +.form-button { + position: relative; + width: 100%; + padding: 1rem 2rem; + border: none; + border-radius: 8px; + font-size: 1rem; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + overflow: hidden; + backdrop-filter: blur(10px); + animation: slideUpFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +/* Основная кнопка */ +.form-button.primary { + background: linear-gradient(135deg, #4CAF50, #45a049); + color: white; + box-shadow: + 0 4px 15px rgba(76, 175, 80, 0.3), + inset 0 1px 0 rgba(255, 255, 255, 0.2); +} + +.form-button.primary:hover:not(:disabled) { + background: linear-gradient(135deg, #45a049, #3d8b40); + box-shadow: + 0 6px 20px rgba(76, 175, 80, 0.4), + inset 0 1px 0 rgba(255, 255, 255, 0.3); + transform: translateY(-2px); +} + +.form-button.primary:active:not(:disabled) { + transform: translateY(0); + box-shadow: + 0 2px 10px rgba(76, 175, 80, 0.3), + inset 0 1px 0 rgba(255, 255, 255, 0.1); +} + +/* Вторичная кнопка */ +.form-button.secondary { + background: rgba(255, 255, 255, 0.1); + color: white; + border: 2px solid rgba(255, 255, 255, 0.3); +} + +.form-button.secondary:hover:not(:disabled) { + background: rgba(255, 255, 255, 0.2); + border-color: rgba(255, 255, 255, 0.5); + transform: translateY(-2px); + box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1); +} + +.form-button.secondary:active:not(:disabled) { + transform: translateY(0); + background: rgba(255, 255, 255, 0.15); +} + +/* Отключенная кнопка */ +.form-button:disabled { + opacity: 0.6; + cursor: not-allowed; + transform: none !important; +} + +/* Состояние загрузки */ +.form-button.loading { + cursor: wait; +} + +/* Спиннер загрузки */ +.button-spinner { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.spinner-ring { + width: 20px; + height: 20px; + border: 2px solid rgba(255, 255, 255, 0.3); + border-top: 2px solid white; + border-radius: 50%; + animation: spin 1s linear infinite; +} + +/* Текст кнопки */ +.button-text { + transition: opacity 0.3s ease; +} + +.button-text.hidden { + opacity: 0; +} + +/* Анимация вращения спиннера */ +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +/* Анимация появления снизу */ +@keyframes slideUpFade { + 0% { + opacity: 0; + transform: translateY(30px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +/* Эффект пульсации для основной кнопки */ +.form-button.primary::before { + content: ''; + position: absolute; + top: 0; + left: -100%; + width: 100%; + height: 100%; + background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); + transition: left 0.5s ease; +} + +.form-button.primary:hover::before { + left: 100%; +} + +/* Адаптивность */ +@media (max-width: 768px) { + .form-button { + padding: 0.875rem 1.5rem; + font-size: 0.9rem; + } +} \ No newline at end of file diff --git a/src/components/FormButton.tsx b/src/components/FormButton.tsx new file mode 100644 index 0000000..a4f668f --- /dev/null +++ b/src/components/FormButton.tsx @@ -0,0 +1,43 @@ +import React from 'react'; +import './FormButton.css'; + +interface FormButtonProps { + type?: 'button' | 'submit'; + children: React.ReactNode; + onClick?: () => void; + disabled?: boolean; + loading?: boolean; + variant?: 'primary' | 'secondary'; + delay?: number; +} + +const FormButton: React.FC = ({ + type = 'button', + children, + onClick, + disabled = false, + loading = false, + variant = 'primary', + delay = 0 +}) => { + return ( + + ); +}; + +export default FormButton; \ No newline at end of file diff --git a/src/components/FormInput.css b/src/components/FormInput.css new file mode 100644 index 0000000..fcca931 --- /dev/null +++ b/src/components/FormInput.css @@ -0,0 +1,104 @@ +/* Контейнер поля ввода */ +.form-input-container { + position: relative; + margin-bottom: 1.5rem; + animation: slideUpFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +/* Само поле ввода */ +.form-input { + width: 100%; + padding: 1rem 0.75rem 0.5rem 0.75rem; + border: 2px solid rgba(255, 255, 255, 0.2); + border-radius: 8px; + background: rgba(0, 0, 0, 0.3); + color: white; + font-size: 1rem; + transition: all 0.3s ease; + outline: none; + backdrop-filter: blur(10px); +} + +.form-input:focus { + border-color: #4CAF50; + background: rgba(0, 0, 0, 0.4); + box-shadow: + 0 0 20px rgba(76, 175, 80, 0.3), + inset 0 0 10px rgba(76, 175, 80, 0.1); +} + +.form-input::placeholder { + color: transparent; +} + +/* Плавающий лейбл */ +.form-label { + position: absolute; + left: 0.75rem; + top: 50%; + transform: translateY(-50%); + color: rgba(255, 255, 255, 0.7); + font-size: 1rem; + pointer-events: none; + transition: all 0.3s ease; + background: transparent; + padding: 0 0.25rem; +} + +.form-label.focused { + top: 0; + transform: translateY(-50%); + font-size: 0.75rem; + color: #4CAF50; + background: rgba(0, 0, 0, 0.8); + border-radius: 4px; +} + +/* Анимированная граница */ +.form-input-border { + position: absolute; + bottom: 0; + left: 50%; + width: 0; + height: 2px; + background: linear-gradient(90deg, #4CAF50, #45a049); + transition: all 0.3s ease; + transform: translateX(-50%); +} + +.form-input:focus + .form-label + .form-input-border { + width: 100%; +} + +/* Анимация появления снизу */ +@keyframes slideUpFade { + 0% { + opacity: 0; + transform: translateY(30px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +/* Адаптивность */ +@media (max-width: 768px) { + .form-input-container { + margin-bottom: 1.25rem; + } + + .form-input { + padding: 0.875rem 0.625rem 0.5rem 0.625rem; + font-size: 0.9rem; + } + + .form-label { + left: 0.625rem; + font-size: 0.9rem; + } + + .form-label.focused { + font-size: 0.7rem; + } +} \ No newline at end of file diff --git a/src/components/FormInput.tsx b/src/components/FormInput.tsx new file mode 100644 index 0000000..ecee495 --- /dev/null +++ b/src/components/FormInput.tsx @@ -0,0 +1,45 @@ +import React, { useState } from 'react'; +import './FormInput.css'; + +interface FormInputProps { + type: string; + placeholder: string; + value: string; + onChange: (value: string) => void; + required?: boolean; + delay?: number; +} + +const FormInput: React.FC = ({ + type, + placeholder, + value, + onChange, + required = false, + delay = 0 +}) => { + const [isFocused, setIsFocused] = useState(false); + + return ( +
+ onChange(e.target.value)} + onFocus={() => setIsFocused(true)} + onBlur={() => setIsFocused(false)} + required={required} + className={`form-input ${isFocused || value ? 'focused' : ''}`} + /> + +
+
+ ); +}; + +export default FormInput; \ No newline at end of file diff --git a/src/pages/Login.css b/src/pages/Login.css new file mode 100644 index 0000000..3edfec5 --- /dev/null +++ b/src/pages/Login.css @@ -0,0 +1,238 @@ +/* Основная страница авторизации */ +.auth-page { + min-height: 100vh; + display: flex; + align-items: center; + justify-content: center; + padding: 1rem; + background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%); + position: relative; + overflow: hidden; +} + +/* Анимированный фон */ +.auth-page::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: + radial-gradient(circle at 20% 80%, rgba(76, 175, 80, 0.1) 0%, transparent 50%), + radial-gradient(circle at 80% 20%, rgba(76, 175, 80, 0.1) 0%, transparent 50%), + radial-gradient(circle at 40% 40%, rgba(76, 175, 80, 0.05) 0%, transparent 50%); + animation: backgroundPulse 8s ease-in-out infinite; +} + +@keyframes backgroundPulse { + 0%, 100% { opacity: 0.5; } + 50% { opacity: 1; } +} + +/* Фоновый контейнер */ +.auth-background { + position: relative; + z-index: 1; + backdrop-filter: blur(10px); + border-radius: 16px; + padding: 2rem; + background: rgba(0, 0, 0, 0.3); + border: 1px solid rgba(255, 255, 255, 0.1); + box-shadow: + 0 20px 40px rgba(0, 0, 0, 0.3), + inset 0 1px 0 rgba(255, 255, 255, 0.1); + animation: containerSlideIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +/* Контейнер формы */ +.auth-container { + width: 100%; + max-width: 400px; + margin: 0 auto; +} + +/* Заголовок */ +.auth-header { + text-align: center; + margin-bottom: 2rem; + animation: headerFadeIn 1s ease-out both; +} + +.auth-title { + font-size: 2rem; + font-weight: 700; + color: white; + margin: 0 0 0.5rem 0; + background: linear-gradient(135deg, #4CAF50, #45a049); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + text-shadow: 0 2px 10px rgba(76, 175, 80, 0.3); +} + +.auth-subtitle { + font-size: 1rem; + color: rgba(255, 255, 255, 0.7); + margin: 0; + font-weight: 400; +} + +/* Форма */ +.auth-form { + display: flex; + flex-direction: column; + gap: 0; +} + +/* Сообщение об ошибке */ +.error-message { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 1rem; + margin-bottom: 1.5rem; + background: rgba(244, 67, 54, 0.1); + border: 1px solid rgba(244, 67, 54, 0.3); + border-radius: 8px; + color: #ff6b6b; + font-size: 0.9rem; + backdrop-filter: blur(10px); + animation: slideUpFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +.error-icon { + font-size: 1.2rem; + color: #ff6b6b; +} + +/* Сообщение об успехе */ +.success-message { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 1rem; + margin-bottom: 1.5rem; + background: rgba(76, 175, 80, 0.1); + border: 1px solid rgba(76, 175, 80, 0.3); + border-radius: 8px; + color: #4CAF50; + font-size: 0.9rem; + backdrop-filter: blur(10px); + animation: slideUpFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +.success-icon { + font-size: 1.2rem; + color: #4CAF50; + font-weight: bold; +} + +/* Ссылки */ +.auth-links { + text-align: center; + margin-top: 1.5rem; + animation: slideUpFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; +} + +.auth-links p { + color: rgba(255, 255, 255, 0.7); + margin: 0 0 0.5rem 0; + font-size: 0.9rem; +} + +.auth-link { + color: #4CAF50; + text-decoration: none; + font-weight: 600; + transition: all 0.3s ease; + position: relative; +} + +.auth-link::after { + content: ''; + position: absolute; + bottom: -2px; + left: 0; + width: 0; + height: 2px; + background: linear-gradient(90deg, #4CAF50, #45a049); + transition: width 0.3s ease; +} + +.auth-link:hover { + color: #45a049; + text-shadow: 0 0 10px rgba(76, 175, 80, 0.5); +} + +.auth-link:hover::after { + width: 100%; +} + +/* Анимации */ +@keyframes containerSlideIn { + 0% { + opacity: 0; + transform: translateY(50px) scale(0.9); + } + 100% { + opacity: 1; + transform: translateY(0) scale(1); + } +} + +@keyframes headerFadeIn { + 0% { + opacity: 0; + transform: translateY(-20px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideUpFade { + 0% { + opacity: 0; + transform: translateY(30px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +/* Адаптивность */ +@media (max-width: 768px) { + .auth-page { + padding: 0.5rem; + } + + .auth-background { + padding: 1.5rem; + } + + .auth-title { + font-size: 1.75rem; + } + + .auth-subtitle { + font-size: 0.9rem; + } + + .auth-header { + margin-bottom: 1.5rem; + } +} + +@media (max-width: 480px) { + .auth-background { + padding: 1rem; + border-radius: 12px; + } + + .auth-title { + font-size: 1.5rem; + } +} \ No newline at end of file diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index b00fbbd..35f9227 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -1,6 +1,9 @@ import React, { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, Link } from 'react-router-dom'; import type { FormEvent } from 'react'; +import FormInput from '../components/FormInput'; +import FormButton from '../components/FormButton'; +import './Login.css'; export default function Login() { const [username, setUsername] = useState(''); @@ -69,29 +72,58 @@ export default function Login() { }; return ( -
-

Вход в систему

-
- setUsername(e.target.value)} - /> - setPassword(e.target.value)} - /> - - {loading &&
Загрузка...
} - {error &&
{error}
} -
+
+
+
+
+

Добро пожаловать в Кварц

+

Войдите в систему для продолжения

+
+ +
+ + + + + {error && ( +
+ ⚠ + {error} +
+ )} + + + Войти + + +
+

Нет аккаунта?

+ + Зарегистрироваться + +
+ +
+
); } \ No newline at end of file diff --git a/src/pages/PotreeViewer.tsx b/src/pages/PotreeViewer.tsx index 3c93f37..3605497 100644 --- a/src/pages/PotreeViewer.tsx +++ b/src/pages/PotreeViewer.tsx @@ -12,7 +12,7 @@ const PotreeViewer: React.FC = () => { const navigate = useNavigate(); const renderAreaRef = useRef(null); const [isLoading, setIsLoading] = useState(true); - const [loadingMessage, setLoadingMessage] = useState('Инициализация...'); + const [loadingMessage, setLoadingMessage] = useState('Подготовка к волшебству...'); const [error, setError] = useState(null); const [viewer, setViewer] = useState(null); const [showLoadingScreen, setShowLoadingScreen] = useState(true); @@ -86,7 +86,7 @@ const PotreeViewer: React.FC = () => { const loadPotreeScripts = async () => { try { console.log('loadPotreeScripts started'); - setLoadingMessage('Проверка готовности...'); + setLoadingMessage('Подготовка к волшебству...'); // Ждем, пока компонент полностью отрендерится await new Promise(resolve => setTimeout(resolve, 100)); @@ -110,7 +110,7 @@ const PotreeViewer: React.FC = () => { return; } - setLoadingMessage('Загрузка стилей...'); + setLoadingMessage('Собираем пиксели...'); // Загружаем CSS const cssLinks = [ @@ -132,19 +132,19 @@ const PotreeViewer: React.FC = () => { } }); - setLoadingMessage('Загрузка библиотек...'); + setLoadingMessage('Будим драконов...'); // Пробуем основную стратегию загрузки с проверками try { await loadScriptsWithChecks(); } catch (err) { console.warn('Main loading strategy failed, trying fallback:', err); - setLoadingMessage('Переключение на альтернативную загрузку...'); + setLoadingMessage('Ищем запасной план...'); // Если основная стратегия не сработала, пробуем простую загрузку await loadScriptsSimple(); } - setLoadingMessage('Проверка библиотек...'); + setLoadingMessage('Считаем единорогов...'); // Дополнительная проверка готовности console.log('Checking loaded libraries:', { @@ -164,7 +164,7 @@ const PotreeViewer: React.FC = () => { throw new Error('jQuery not loaded'); } - setLoadingMessage('Инициализация Potree...'); + setLoadingMessage('Запускаем квантовый двигатель...'); // Ждем немного перед инициализацией и еще раз проверяем render area await new Promise(resolve => setTimeout(resolve, 500)); @@ -178,7 +178,7 @@ const PotreeViewer: React.FC = () => { await initializePotree(); } catch (err) { console.error('Error loading Potree:', err); - setError(`Ошибка загрузки Potree: ${err.message}`); + setError(`Что-то пошло не так: ${err.message}`); setIsLoading(false); } }; @@ -278,7 +278,7 @@ const PotreeViewer: React.FC = () => { } console.log('Creating Potree viewer...'); - setLoadingMessage('Создание viewer...'); + setLoadingMessage('Строим виртуальную реальность...'); // Проверяем поддержку WebGL const canvas = document.createElement('canvas'); @@ -339,7 +339,7 @@ const PotreeViewer: React.FC = () => { } console.log('Viewer configured successfully'); - setLoadingMessage('Завершение инициализации...'); + setLoadingMessage('Полируем кнопочки...'); // Добавляем обработчик изменения размера окна const handleResize = () => { @@ -385,7 +385,7 @@ const PotreeViewer: React.FC = () => { // Загружаем GUI console.log('Loading GUI...'); - setLoadingMessage('Загрузка интерфейса...'); + setLoadingMessage('Настраиваем магию...'); try { await new Promise((resolve, reject) => { @@ -457,7 +457,7 @@ const PotreeViewer: React.FC = () => { // Загружаем облако точек console.log('Loading point cloud...'); - setLoadingMessage('Загрузка облака точек...'); + setLoadingMessage('Материализуем точки...'); const pointCloudOptions = [ { url: "/pointclouds/lion_takanawa.copc.laz", name: "lion_takanawa" }, @@ -471,7 +471,7 @@ const PotreeViewer: React.FC = () => { try { console.log(`Trying to load point cloud: ${option.url}`); - setLoadingMessage(`Загрузка ${option.name}...`); + setLoadingMessage('Материализуем точки...'); await new Promise((resolve, reject) => { const timeout = setTimeout(() => { @@ -533,7 +533,7 @@ const PotreeViewer: React.FC = () => { if (!pointCloudLoaded) { console.warn('No point cloud could be loaded, creating test point cloud...'); - setLoadingMessage('Создание тестового облака точек...'); + setLoadingMessage('Рисуем из воздуха...'); try { // Создаем простое тестовое облако точек diff --git a/src/pages/Register.tsx b/src/pages/Register.tsx new file mode 100644 index 0000000..95d7ce7 --- /dev/null +++ b/src/pages/Register.tsx @@ -0,0 +1,164 @@ +import React, { useState } from 'react'; +import { useNavigate, Link } from 'react-router-dom'; +import type { FormEvent } from 'react'; +import FormInput from '../components/FormInput'; +import FormButton from '../components/FormButton'; +import './Login.css'; // Используем те же стили + +export default function Register() { + const [username, setUsername] = useState(''); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [confirmPassword, setConfirmPassword] = useState(''); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(''); + const [success, setSuccess] = useState(''); + const navigate = useNavigate(); + + const handleSubmit = async (e: FormEvent) => { + e.preventDefault(); + setLoading(true); + setError(''); + setSuccess(''); + + // Валидация + if (password !== confirmPassword) { + setError('Пароли не совпадают'); + setLoading(false); + return; + } + + if (password.length < 6) { + setError('Пароль должен содержать минимум 6 символов'); + setLoading(false); + return; + } + + try { + console.log('Отправка данных регистрации:', { username, email, password }); + + const response = await fetch('/api/register', { + method: 'POST', + credentials: 'include', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify({ username, email, password }) + }); + + console.log('Статус ответа:', response.status); + + let data; + try { + const text = await response.text(); + console.log('Текст ответа:', text); + + if (text.trim()) { + data = JSON.parse(text); + } else { + data = { success: false, message: 'Пустой ответ от сервера' }; + } + } catch (parseError) { + console.error('Ошибка при разборе JSON:', parseError); + data = { success: false, message: 'Некорректный формат ответа' }; + } + + if (response.ok && data.success) { + setSuccess('Регистрация успешна! Перенаправление...'); + setTimeout(() => { + navigate('/login'); + }, 2000); + return; + } + + setError(data.message || 'Ошибка при регистрации'); + setLoading(false); + } catch (err) { + console.error('Ошибка запроса:', err); + setError('Произошла ошибка при подключении к серверу'); + setLoading(false); + } + }; + + return ( +
+
+
+
+

Присоединяйтесь к Кварцу

+

Создайте аккаунт для начала работы

+
+ +
+ + + + + + + + + {error && ( +
+ ⚠ + {error} +
+ )} + + {success && ( +
+ ✓ + {success} +
+ )} + + + Зарегистрироваться + + +
+

Уже есть аккаунт?

+ + Войти + +
+ +
+
+
+ ); +} \ No newline at end of file