diff --git a/src/elements/GenerateCard/index.tsx b/src/elements/GenerateCard/index.tsx index 125e15a..67043e1 100644 --- a/src/elements/GenerateCard/index.tsx +++ b/src/elements/GenerateCard/index.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Button } from '../Button' import { Block } from '../Block' import './style.css' +import { useNavigate } from "react-router-dom"; @@ -9,7 +10,8 @@ import './style.css' export const GenerateCard:React.FC = (props) =>{ - + let navigate = useNavigate() + return( @@ -19,8 +21,7 @@ export const GenerateCard:React.FC = (props) =>{ - - + ); diff --git a/src/elements/Header/index.tsx b/src/elements/Header/index.tsx index 074d325..933afb1 100644 --- a/src/elements/Header/index.tsx +++ b/src/elements/Header/index.tsx @@ -1,22 +1,23 @@ import React from "react"; +import { useNavigate } from "react-router-dom"; import './style.css' export const RusPassHeader:React.FC = () =>{ + let navigate = useNavigate() return(
- - - - - + navigate('/')}> + navigate('/')}> + navigate('/event-match')}> + navigate('/')}>
- - + navigate('/favorites')}> + navigate('/login')} >
diff --git a/src/elements/Prefernces/index.tsx b/src/elements/Prefernces/index.tsx index 88e4b53..79599cd 100644 --- a/src/elements/Prefernces/index.tsx +++ b/src/elements/Prefernces/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { Carousel, Tabs } from 'antd'; +import { Carousel, Spin, Tabs } from 'antd'; import type { TabsProps } from 'antd'; import { Button } from "../Button"; import './style.css' @@ -9,6 +9,7 @@ import axios from "axios"; import { backend } from "../../consts"; import { HotelCard, HotelCardIE } from "../HotelCard"; import { AttractionCard, AttractionCardIE } from "../AttractionCard"; +import { useNavigate } from "react-router-dom"; export const Prefernces = () =>{ const [activeTab, setActiveTab] = useState(1) const [cities, setCities] = useState([]) @@ -265,6 +266,7 @@ export const Prefernces = () =>{

Выберите понравившеися вам отели

{ + hotels.length == 0? : hotels.map((hotel:HotelCardIE)=>) }
@@ -296,7 +298,9 @@ export const Prefernces = () =>{

Выберите самое интересное

+ { + events.length == 0? : events.map((event:AttractionCardIE)=>{ return }) @@ -307,9 +311,15 @@ export const Prefernces = () =>{ }, ]; + let navigate = useNavigate() - - + const onNextClick = () =>{ + setActiveTab((activeTab+1)%5) + if (activeTab+1 == 5){ + localStorage.setItem('firstAuth', 'false'); + navigate('/') + } + } return(
@@ -318,7 +328,7 @@ export const Prefernces = () =>{
Отметьте свои предпочтения, чтобы мы смогли предоставить лучшие рекомендации туров
setActiveTab(Number(e))} /> - +
diff --git a/src/elements/Prefernces/style.css b/src/elements/Prefernces/style.css index 8def387..25aedf2 100644 --- a/src/elements/Prefernces/style.css +++ b/src/elements/Prefernces/style.css @@ -20,9 +20,13 @@ } .prefsbg{ + position: absolute; + right: 0; + top:0; width: 100%; height: 100vh; background-color: rgba(0,0,0,0.2); + z-index: 1000000; } .hotelsCardWrapper{ diff --git a/src/elements/map/index.tsx b/src/elements/map/index.tsx index 227c1e6..3b9fe01 100644 --- a/src/elements/map/index.tsx +++ b/src/elements/map/index.tsx @@ -63,7 +63,7 @@ export const MyMap: React.FC = (props) =>{ 'line-cap': 'round' }, paint: { - 'line-color': '#3887be', + 'line-color': '#FFCF08', 'line-width': 5, 'line-opacity': 0.75 } diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 3a2d233..e5d9a95 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -1,6 +1,44 @@ import react from 'react' +import { Block } from '../../elements/Block' +import { Input } from '../../elements/Input' +import './style.css' +import { Button } from '../../elements/Button' +import { register, signin } from '../../client' +import { useNavigate } from "react-router-dom"; + +const yandexConnect = require('react-yandex-login') + +const {YandexLogin, YandexLogout} = yandexConnect; +const clientID = '11e53cfa7add4c55b84168d408a22eb1'; + export const Login: react.FC = () => { + const navigate = useNavigate(); + const [username, setUseranme] = react.useState(''); + const [password, setPassword] = react.useState(''); - return
Login
+ + return
+ +

Вход

+ + + +
+
+ или +
+
+ {}}> + + +
+
} \ No newline at end of file diff --git a/src/pages/Login/style.css b/src/pages/Login/style.css new file mode 100644 index 0000000..2bf7a67 --- /dev/null +++ b/src/pages/Login/style.css @@ -0,0 +1,31 @@ +.centered{ + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + margin-top: 50px; +} + +.reg-block{ + padding-left: 50px; + padding-right: 50px; + display: flex; + flex-direction: column; + gap: 20px; + align-items: center; +} + +.reg-input{ + display: block; + width: 400px; +} + +.btn-y{ + width: 440px!important; + background-color: #FFCF08; + border-radius: 10px; + padding: 15px 50px; + outline: none; + border: none; + cursor: pointer; +} \ No newline at end of file diff --git a/src/pages/Main/index.tsx b/src/pages/Main/index.tsx index f5db348..17a2f01 100644 --- a/src/pages/Main/index.tsx +++ b/src/pages/Main/index.tsx @@ -13,12 +13,21 @@ import type { RangePickerProps } from 'antd/es/date-picker'; import { Search } from '../../elements/Search'; import { AttractionCard } from '../../elements/AttractionCard'; import { EventCard, EventCardIE } from '../../elements/EventCard'; +import { Prefernces } from '../../elements/Prefernces'; export const Main: react.FC = () => { const [events, setEvents] = useState([]) const [favorites, setFavorites] = useState([]) + let navigate = useNavigate() + + let token = localStorage.getItem('token') + + let firstAuth = localStorage.getItem('firstAuth') useEffect(()=>{ + if (null == localStorage.getItem('token')){ + navigate('/login') + } if (favorites.length == 0){ backend.get('user/favorite').then((e)=>setFavorites(e.data)) } @@ -39,6 +48,9 @@ export const Main: react.FC = () => { return (
+ { + firstAuth == 'true'? :null + }
diff --git a/src/pages/Register/index.tsx b/src/pages/Register/index.tsx index 3fbdbd2..c91ac33 100644 --- a/src/pages/Register/index.tsx +++ b/src/pages/Register/index.tsx @@ -27,8 +27,9 @@ export const Register: react.FC = () => {