From a96756fdb62a047af22e6d0e4cb10e7b35c53933 Mon Sep 17 00:00:00 2001 From: Maks Date: Fri, 30 Aug 2024 10:50:01 +0300 Subject: [PATCH] Format react application --- src/web/src/App.jsx | 20 +- src/web/src/components/Accordion/index.jsx | 55 ++-- .../src/components/AdvantagesCard/index.jsx | 24 +- src/web/src/components/Alert/index.jsx | 50 +-- src/web/src/components/Avatar/index.jsx | 21 +- .../src/components/BarcodeGenerator/index.jsx | 33 +- src/web/src/components/Carousel/index.jsx | 130 ++++---- src/web/src/components/Circles/index.jsx | 26 +- src/web/src/components/Container/index.jsx | 2 +- src/web/src/components/DiscountCard/Timer.jsx | 98 +++--- src/web/src/components/DiscountCard/index.jsx | 301 ++++++++---------- src/web/src/components/EventCard/index.jsx | 34 +- src/web/src/components/Footer/index.jsx | 104 +++--- src/web/src/components/Header/Hamburger.jsx | 25 +- .../src/components/Header/MobileHeader.jsx | 121 +++---- .../components/Header/MobileMenuContent.jsx | 132 ++++---- src/web/src/components/Header/UserDetails.jsx | 38 ++- src/web/src/components/Header/index.jsx | 6 +- src/web/src/components/Layout/index.jsx | 50 +-- src/web/src/components/Loader/index.jsx | 24 +- src/web/src/components/PageWrapper/index.jsx | 72 ++--- src/web/src/components/PartnerCard/index.jsx | 29 +- .../src/components/ProtectedRoute/index.jsx | 20 +- .../src/components/QrcodeGenerator/index.jsx | 2 +- .../src/components/RegistrationForm/index.jsx | 1 - src/web/src/components/SimpleModal/index.jsx | 33 +- src/web/src/components/Svg/index.jsx | 8 +- src/web/src/features/advantagesSlice.js | 36 +-- src/web/src/features/alertSlice.js | 62 ++-- src/web/src/features/discountSlice.js | 84 ++--- src/web/src/features/eventsSlice.js | 57 ++-- src/web/src/features/index.js | 16 +- src/web/src/features/loginSlice.js | 22 +- src/web/src/features/partnersSlice.js | 34 +- src/web/src/features/questionsSlice.js | 45 ++- src/web/src/features/userSlice.js | 177 +++++----- src/web/src/pages/Event/index.jsx | 62 ++-- src/web/src/pages/Events/index.jsx | 38 +-- src/web/src/pages/ExternalRedirect/index.jsx | 17 +- .../src/pages/Main/components/Advantages.jsx | 96 +++--- src/web/src/pages/Main/components/Events.jsx | 46 +-- src/web/src/pages/Main/components/Landing.jsx | 32 +- .../src/pages/Main/components/Partners.jsx | 38 +-- .../pages/Main/components/SharedDiscounts.jsx | 45 +-- src/web/src/pages/Main/components/Socials.jsx | 92 +++--- .../Main/components/TypicalQuestions.jsx | 28 +- src/web/src/pages/Main/index.jsx | 48 +-- src/web/src/pages/NotFound/index.jsx | 44 +-- src/web/src/pages/Profile/DiscountsList.jsx | 101 +++--- src/web/src/pages/Profile/Field.jsx | 12 +- src/web/src/pages/Profile/ProfileSidebar.jsx | 163 +++++----- src/web/src/pages/Profile/UserStatus.jsx | 77 +++-- src/web/src/pages/Profile/index.jsx | 40 +-- src/web/src/pages/VerifyDiscount/index.jsx | 117 +++---- src/web/src/pages/routes.jsx | 72 ++--- src/web/src/pages/routesProtection.js | 4 +- src/web/src/services/AdvantagesService.js | 14 +- src/web/src/services/AuthenticateService.js | 40 +-- src/web/src/services/DiscountService.js | 38 +-- src/web/src/services/EventService.js | 24 +- src/web/src/services/GoogleAuth.js | 14 +- src/web/src/services/PartnersService.js | 14 +- src/web/src/services/QuestionsService.js | 18 +- src/web/src/services/TokenService.js | 20 +- src/web/src/services/UserService.js | 22 +- src/web/src/services/config/ApiService.js | 124 ++++---- src/web/src/services/config/axios.config.js | 10 +- src/web/src/types/alertTypes.js | 6 +- src/web/src/types/discountType.js | 10 +- src/web/src/types/memberStatus.js | 14 +- src/web/src/ui/Buttons/Button.jsx | 16 +- src/web/src/ui/Buttons/GoogleButton.jsx | 12 +- src/web/src/ui/Buttons/PrimaryButton.jsx | 21 +- src/web/src/ui/Fields/TextField.jsx | 27 +- src/web/src/utils/mocks.js | 239 +++++++------- 75 files changed, 1843 insertions(+), 2004 deletions(-) diff --git a/src/web/src/App.jsx b/src/web/src/App.jsx index c993a81..fdc7c8b 100644 --- a/src/web/src/App.jsx +++ b/src/web/src/App.jsx @@ -8,17 +8,17 @@ const router = createBrowserRouter(routes); const googleClientId = process.env.REACT_APP_GOOGLE_API_KEY; function App() { - React.useEffect(() => { - document.body.style.height = `${window.innerHeight}px`; - }, []); + React.useEffect(() => { + document.body.style.height = `${window.innerHeight}px`; + }, []); - return ( - - - - - - ); + return ( + + + + + + ); } export default App; diff --git a/src/web/src/components/Accordion/index.jsx b/src/web/src/components/Accordion/index.jsx index a3c0dac..b66f497 100644 --- a/src/web/src/components/Accordion/index.jsx +++ b/src/web/src/components/Accordion/index.jsx @@ -1,37 +1,34 @@ import React, { useState } from 'react'; const Accordion = ({ title, details }) => { - const [open, setOpen] = useState(false); + const [open, setOpen] = useState(false); - const toggle = () => { - setOpen(!open); - }; + const toggle = () => { + setOpen(!open); + }; - return ( -
-

- {title} - -

- {open && ( -
-

e.stopPropagation()} - className='editor' - style={{ paddingRight: '30px' }} - dangerouslySetInnerHTML={{ __html: details }} - >

-
- )} -
- ); + return ( +
+

+ {title} + +

+ {open && ( +
+

e.stopPropagation()} + className='editor' + style={{ paddingRight: '30px' }} + dangerouslySetInnerHTML={{ __html: details }} + >

+
+ )} +
+ ); }; export default Accordion; diff --git a/src/web/src/components/AdvantagesCard/index.jsx b/src/web/src/components/AdvantagesCard/index.jsx index 63c67fc..c5be6eb 100644 --- a/src/web/src/components/AdvantagesCard/index.jsx +++ b/src/web/src/components/AdvantagesCard/index.jsx @@ -1,16 +1,16 @@ -import React from 'react' +import React from 'react'; const AdvantagesCard = ({ advantages }) => { - const { mainText, subText } = advantages; + const { mainText, subText } = advantages; - return ( -
-

#{mainText}

-
-

{subText}

-
-
- ) -} + return ( +
+

#{mainText}

+
+

{subText}

+
+
+ ); +}; -export default AdvantagesCard \ No newline at end of file +export default AdvantagesCard; diff --git a/src/web/src/components/Alert/index.jsx b/src/web/src/components/Alert/index.jsx index a42edff..e71d7b8 100644 --- a/src/web/src/components/Alert/index.jsx +++ b/src/web/src/components/Alert/index.jsx @@ -1,31 +1,35 @@ -import React, { useEffect } from 'react' -import { useDispatch } from 'react-redux' +import React, { useEffect } from 'react'; +import { useDispatch } from 'react-redux'; import { closeAlert } from '../../features/alertSlice'; import { AlertType } from '../../types/alertTypes'; -import SimpleModal from '../SimpleModal' +import SimpleModal from '../SimpleModal'; const Alert = ({ duration = 3000, type = AlertType.ERROR, text }) => { - const dispatch = useDispatch(); + const dispatch = useDispatch(); - useEffect(() => { - const timeout = setTimeout(() => { - dispatch(closeAlert()); - }, duration); + useEffect(() => { + const timeout = setTimeout(() => { + dispatch(closeAlert()); + }, duration); - return () => clearTimeout(timeout); - }, []) + return () => clearTimeout(timeout); + }, []); - return ( - dispatch(closeAlert())}> -
-

{type === AlertType.ERROR ? "От халепа" : "Успішно"}

-
- alert-type -
-

{text}

-
-
- ) -} + return ( + dispatch(closeAlert())}> +
+

{type === AlertType.ERROR ? 'От халепа' : 'Успішно'}

+
+ alert-type +
+

{text}

+
+
+ ); +}; -export default Alert \ No newline at end of file +export default Alert; diff --git a/src/web/src/components/Avatar/index.jsx b/src/web/src/components/Avatar/index.jsx index 287ef6e..f4e8911 100644 --- a/src/web/src/components/Avatar/index.jsx +++ b/src/web/src/components/Avatar/index.jsx @@ -1,14 +1,11 @@ -import React from 'react' +import React from 'react'; -const Avatar = ({ src, className = "" }) => { - return ( -
- Avatar -
- ) -} +const Avatar = ({ src, className = '' }) => { + return ( +
+ Avatar +
+ ); +}; -export default Avatar \ No newline at end of file +export default Avatar; diff --git a/src/web/src/components/BarcodeGenerator/index.jsx b/src/web/src/components/BarcodeGenerator/index.jsx index 6987285..172f5a8 100644 --- a/src/web/src/components/BarcodeGenerator/index.jsx +++ b/src/web/src/components/BarcodeGenerator/index.jsx @@ -1,22 +1,21 @@ -import React from 'react' +import React from 'react'; import Barcode from 'react-barcode'; - const BarcodeGenerator = ({ value, disabled }) => { - const options = { - value: value, - displayValue: false, - background: "transparent", - } + const options = { + value: value, + displayValue: false, + background: 'transparent', + }; - return disabled ? ( -
- -
-
- ) : ( - - ) -} + return disabled ? ( +
+ +
+
+ ) : ( + + ); +}; -export default BarcodeGenerator \ No newline at end of file +export default BarcodeGenerator; diff --git a/src/web/src/components/Carousel/index.jsx b/src/web/src/components/Carousel/index.jsx index 8fcc5fd..5517045 100644 --- a/src/web/src/components/Carousel/index.jsx +++ b/src/web/src/components/Carousel/index.jsx @@ -1,72 +1,68 @@ -import React, { useState } from 'react' -import Slider from 'react-slick' -import 'slick-carousel/slick/slick.css' -import 'slick-carousel/slick/slick-theme.css' +import React, { useState } from 'react'; +import Slider from 'react-slick'; +import 'slick-carousel/slick/slick.css'; +import 'slick-carousel/slick/slick-theme.css'; const Carousel = ({ children }) => { - const [index, setIndex] = useState(0); + const [index, setIndex] = useState(0); - const settings = { - dots: true, - infinite: true, - speed: 800, - arrows: false, - slidesToShow: 4, - autoplay: true, - autoplaySpeed: 5000, - initialSlide: 0, - pauseOnHover: true, - afterChange: (i) => setIndex(i), - appendDots: (dots) =>
    {dots}
, - customPaging: (i) => ( -
  • -
    -
    -
  • - ), - responsive: [ - { - breakpoint: 1024, - settings: { - slidesToShow: 3, - slidesToScroll: 3, - infinite: true, - dots: true - } - }, - { - breakpoint: 600, - settings: { - slidesToShow: 2, - slidesToScroll: 2, - initialSlide: 2 - } - }, - { - breakpoint: 480, - settings: { - slidesToShow: 1, - slidesToScroll: 1 - } - }, - { - breakpoint: 380, - settings: { - slidesToShow: 1, - slidesToScroll: 1, - } - } - ] - } + const settings = { + dots: true, + infinite: true, + speed: 800, + arrows: false, + slidesToShow: 4, + autoplay: true, + autoplaySpeed: 5000, + initialSlide: 0, + pauseOnHover: true, + afterChange: (i) => setIndex(i), + appendDots: (dots) =>
      {dots}
    , + customPaging: (i) => ( +
  • +
    +
  • + ), + responsive: [ + { + breakpoint: 1024, + settings: { + slidesToShow: 3, + slidesToScroll: 3, + infinite: true, + dots: true, + }, + }, + { + breakpoint: 600, + settings: { + slidesToShow: 2, + slidesToScroll: 2, + initialSlide: 2, + }, + }, + { + breakpoint: 480, + settings: { + slidesToShow: 1, + slidesToScroll: 1, + }, + }, + { + breakpoint: 380, + settings: { + slidesToShow: 1, + slidesToScroll: 1, + }, + }, + ], + }; - return ( - - {children} - - ) -} + return ( + + {children} + + ); +}; -export default Carousel \ No newline at end of file +export default Carousel; diff --git a/src/web/src/components/Circles/index.jsx b/src/web/src/components/Circles/index.jsx index aea9cfe..396a32e 100644 --- a/src/web/src/components/Circles/index.jsx +++ b/src/web/src/components/Circles/index.jsx @@ -1,15 +1,15 @@ -import React from 'react' +import React from 'react'; -const Circles = ({ className = "", children }) => { - return ( -
    -
    -
    -
    - {children} -
    -
    - ) -} +const Circles = ({ className = '', children }) => { + return ( +
    +
    +
    +
    + {children} +
    +
    + ); +}; -export default Circles \ No newline at end of file +export default Circles; diff --git a/src/web/src/components/Container/index.jsx b/src/web/src/components/Container/index.jsx index 53b3ad5..68995ba 100644 --- a/src/web/src/components/Container/index.jsx +++ b/src/web/src/components/Container/index.jsx @@ -1,7 +1,7 @@ import React from 'react'; const Container = ({ children, className = '' }) => { - return
    {children}
    ; + return
    {children}
    ; }; export default Container; diff --git a/src/web/src/components/DiscountCard/Timer.jsx b/src/web/src/components/DiscountCard/Timer.jsx index b9ecb43..8ce3179 100644 --- a/src/web/src/components/DiscountCard/Timer.jsx +++ b/src/web/src/components/DiscountCard/Timer.jsx @@ -1,55 +1,55 @@ import React, { useState, useEffect } from 'react'; const Timer = ({ finishHandler = null, isTimerStarted, setIsTimerStarted }) => { - const [seconds, setSeconds] = useState(60); - - useEffect(() => { - let intervalId; - - if (isTimerStarted) { - intervalId = setInterval(() => { - setSeconds((prevSeconds) => { - if (prevSeconds > 0) { - return prevSeconds - 1; - } else { - finishHandler && finishHandler(); - clearInterval(intervalId); - setIsTimerStarted(false); - return 0; - } - }); - }, 1000); - } - - return () => { - clearInterval(intervalId); - }; - }, [isTimerStarted]); - - const formatTime = (time) => { - const minutes = Math.floor(time / 60) - .toString() - .padStart(2, '0'); - const seconds = (time % 60).toString().padStart(2, '0'); - return `${minutes}:${seconds}`; - }; - - const lineColor = isTimerStarted ? 'bg-blue-600' : 'bg-gray-500'; - const lineWidth = (seconds / 60) * 100; - - return ( -
    -
    -
    -
    -
    -
    {formatTime(seconds)}
    -
    -
    - ); + const [seconds, setSeconds] = useState(60); + + useEffect(() => { + let intervalId; + + if (isTimerStarted) { + intervalId = setInterval(() => { + setSeconds((prevSeconds) => { + if (prevSeconds > 0) { + return prevSeconds - 1; + } else { + finishHandler && finishHandler(); + clearInterval(intervalId); + setIsTimerStarted(false); + return 0; + } + }); + }, 1000); + } + + return () => { + clearInterval(intervalId); + }; + }, [isTimerStarted]); + + const formatTime = (time) => { + const minutes = Math.floor(time / 60) + .toString() + .padStart(2, '0'); + const seconds = (time % 60).toString().padStart(2, '0'); + return `${minutes}:${seconds}`; + }; + + const lineColor = isTimerStarted ? 'bg-blue-600' : 'bg-gray-500'; + const lineWidth = (seconds / 60) * 100; + + return ( +
    +
    +
    +
    +
    +
    {formatTime(seconds)}
    +
    +
    + ); }; export default Timer; diff --git a/src/web/src/components/DiscountCard/index.jsx b/src/web/src/components/DiscountCard/index.jsx index 93d91bd..4b1b1e3 100644 --- a/src/web/src/components/DiscountCard/index.jsx +++ b/src/web/src/components/DiscountCard/index.jsx @@ -10,191 +10,154 @@ import { useMediaQuery } from 'react-responsive'; const service = new DiscountService(); const DiscountCard = ({ discount, blocked = false }) => { - const { name, withBarCode, withQrCode } = discount; - const [isQrCodeModalOpen, setQrCodeModalOpen] = React.useState(false); - const [isBarCodeOpen, setIsBarCodeOpen] = useState(false); - const [isInfoModalOpen, setIsInfoOpen] = useState(false); + const { name, withBarCode, withQrCode } = discount; + const [isQrCodeModalOpen, setQrCodeModalOpen] = React.useState(false); + const [isBarCodeOpen, setIsBarCodeOpen] = useState(false); + const [isInfoModalOpen, setIsInfoOpen] = useState(false); - const toggleQrCodeModal = () => { - setIsBarCodeOpen(false); - setQrCodeModalOpen(!isQrCodeModalOpen); - }; + const toggleQrCodeModal = () => { + setIsBarCodeOpen(false); + setQrCodeModalOpen(!isQrCodeModalOpen); + }; - const toggleBarCodeModal = () => { - setIsBarCodeOpen(!isBarCodeOpen); - }; + const toggleBarCodeModal = () => { + setIsBarCodeOpen(!isBarCodeOpen); + }; - const toggleInfoModal = () => { - setIsBarCodeOpen(false); - setQrCodeModalOpen(false); - setIsInfoOpen(!isInfoModalOpen); - }; + const toggleInfoModal = () => { + setIsBarCodeOpen(false); + setQrCodeModalOpen(false); + setIsInfoOpen(!isInfoModalOpen); + }; - return ( -
    -
    -
    -

    - {name} -

    - {!blocked && ( - - {withQrCode && !withBarCode && 'Ця знижка доступна тільки по QR коду'} - {withBarCode && - !withQrCode && - 'Ця знижка доступна тільки по Штрих коду'} - {withBarCode && - withQrCode && - 'Цю знижку можна сканувати будь яким способом'} - - )} - {blocked && ( -

    - Щоб розблокувати цю знижку вам потрібно сплатити профспілкові внески -

    - )} -
    + return ( +
    +
    +
    +

    {name}

    + {!blocked && ( + + {withQrCode && !withBarCode && 'Ця знижка доступна тільки по QR коду'} + {withBarCode && !withQrCode && 'Ця знижка доступна тільки по Штрих коду'} + {withBarCode && withQrCode && 'Цю знижку можна сканувати будь яким способом'} + + )} + {blocked && ( +

    + Щоб розблокувати цю знижку вам потрібно сплатити профспілкові внески +

    + )} +
    -
    - {!blocked && ( - - - {withQrCode && ( - - )} - {withBarCode && ( - - )} - - )} -
    - {isQrCodeModalOpen && ( - - )} - {isBarCodeOpen && ( - - )} - {isInfoModalOpen && ( - - )} -
    - {} -
    - ); +
    + {!blocked && ( + + + {withQrCode && ( + + )} + {withBarCode && ( + + )} + + )} +
    + {isQrCodeModalOpen && } + {isBarCodeOpen && } + {isInfoModalOpen && } +
    + {} +
    + ); }; const DiscountCardModal = ({ discount, close, isQrDiscount = true }) => { - const [loading, setLoading] = React.useState(true); - const [isTimerStarted, setIsTimerStarted] = useState(true); - const [qrCodeValue, setQrCodeValue] = useState(''); - const isSmScreen = useMediaQuery({ maxWidth: '475px' }); + const [loading, setLoading] = React.useState(true); + const [isTimerStarted, setIsTimerStarted] = useState(true); + const [qrCodeValue, setQrCodeValue] = useState(''); + const isSmScreen = useMediaQuery({ maxWidth: '475px' }); - useEffect(() => { - if (isQrDiscount) { - loadDiscount(); - } else { - setLoading(false); - } - }, []); + useEffect(() => { + if (isQrDiscount) { + loadDiscount(); + } else { + setLoading(false); + } + }, []); - const loadDiscount = async () => { - if (!isQrDiscount) { - close(); - } - setLoading(true); + const loadDiscount = async () => { + if (!isQrDiscount) { + close(); + } + setLoading(true); - const { data } = await service.getQrCode(discount.id); - const url = `${window.location.origin}/verify-discount/${data.discount.id}/${data.code}`; + const { data } = await service.getQrCode(discount.id); + const url = `${window.location.origin}/verify-discount/${data.discount.id}/${data.code}`; - setQrCodeValue(url); - setLoading(false); - setIsTimerStarted(true); - }; + setQrCodeValue(url); + setLoading(false); + setIsTimerStarted(true); + }; - return ( - -
    -

    #знижка

    -

    {discount.name}

    - {discount.description.length < 100 && ( -
    - )} -
    - {loading ? ( -
    - -
    - ) : ( -
    - {isQrDiscount ? ( -
    - -
    - ) : ( - -
    - -
    -
    - )} - -
    - )} -
    - -
    -
    - ); + return ( + +
    +

    #знижка

    +

    {discount.name}

    + {discount.description.length < 100 && ( +
    + )} +
    + {loading ? ( +
    + +
    + ) : ( +
    + {isQrDiscount ? ( +
    + +
    + ) : ( + +
    + +
    +
    + )} + +
    + )} +
    + +
    +
    + ); }; export const DiscountInfoModal = ({ discount, close }) => ( - -
    -

    {discount.name}

    -
    -
    - -
    -
    + +
    +

    {discount.name}

    +
    +
    + +
    +
    ); export default DiscountCard; diff --git a/src/web/src/components/EventCard/index.jsx b/src/web/src/components/EventCard/index.jsx index 693296c..a9364f4 100644 --- a/src/web/src/components/EventCard/index.jsx +++ b/src/web/src/components/EventCard/index.jsx @@ -3,24 +3,24 @@ import React from 'react'; import { useNavigate } from 'react-router-dom'; const EventCard = ({ event }) => { - const navigate = useNavigate(); - const smStyles = 'max-sm:max-w-sm max-sm:h-52 max-sm:mb-3'; - const { id, title, shortDescription } = event; - return ( -
    navigate(`/events/${id}`)} - className={`relative flex-1 flex flex-col justify-between max-w-xs p-5 border border-black rounded-standart h-80 duration-150 cursor-pointer hover:text-white hover:bg-primary hover:border-primary ${smStyles}`} - key={id} - > -
    -

    {title}

    - {shortDescription &&

    {shortDescription}

    } -
    + const navigate = useNavigate(); + const smStyles = 'max-sm:max-w-sm max-sm:h-52 max-sm:mb-3'; - {/*

    {format(new Date(date), 'dd.MM.yyyy')}

    */} - -
    - ); + const { id, title, shortDescription } = event; + + return ( +
    navigate(`/events/${id}`)} + className={`relative flex-1 flex flex-col justify-between max-w-xs p-5 border border-black rounded-standart h-80 duration-150 cursor-pointer hover:text-white hover:bg-primary hover:border-primary ${smStyles}`} + key={id} + > +
    +

    {title}

    + {shortDescription &&

    {shortDescription}

    } +
    + +
    + ); }; export default EventCard; diff --git a/src/web/src/components/Footer/index.jsx b/src/web/src/components/Footer/index.jsx index 64b1653..a08411b 100644 --- a/src/web/src/components/Footer/index.jsx +++ b/src/web/src/components/Footer/index.jsx @@ -5,66 +5,52 @@ import Circles from '../Circles'; import Container from '../Container'; const Footer = () => { - const media = useMediaQuery({ maxWidth: '768px' }); + const media = useMediaQuery({ maxWidth: '768px' }); - return ( -
    - -
    - Transparent logo -
    -
    -

    Посилання

    - - Головна - - - Події - - - Особистий кабінет - -
    - - {!media && } -
    -
    - ); + return ( +
    + +
    + Transparent logo +
    +
    +

    Посилання

    + + Головна + + + Події + + + Особистий кабінет + +
    + + {!media && } +
    +
    + ); }; export default Footer; diff --git a/src/web/src/components/Header/Hamburger.jsx b/src/web/src/components/Header/Hamburger.jsx index 18b3654..196e575 100644 --- a/src/web/src/components/Header/Hamburger.jsx +++ b/src/web/src/components/Header/Hamburger.jsx @@ -1,18 +1,15 @@ -import React from 'react' +import React from 'react'; const Hamburger = ({ isOpen, setIsOpen }) => { - const genericHamburgerLine = `h-1 w-10 my-1 rounded-full bg-black transition ease transform duration-300`; + const genericHamburgerLine = `h-1 w-10 my-1 rounded-full bg-black transition ease transform duration-300`; - return ( -
    setIsOpen(!isOpen)} - > -
    -
    -
    -
    - ); -} + return ( +
    setIsOpen(!isOpen)}> +
    +
    +
    +
    + ); +}; -export default Hamburger \ No newline at end of file +export default Hamburger; diff --git a/src/web/src/components/Header/MobileHeader.jsx b/src/web/src/components/Header/MobileHeader.jsx index ff1c7cc..99004c7 100644 --- a/src/web/src/components/Header/MobileHeader.jsx +++ b/src/web/src/components/Header/MobileHeader.jsx @@ -8,80 +8,63 @@ import { useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; const MobileHeader = () => { - const [menuOpen, setMenuOpen] = useState(false); - const [headerState, setHeaderState] = useState(0); - const user = useSelector(selectUserData); - const navigate = useNavigate(); + const [menuOpen, setMenuOpen] = useState(false); + const [headerState, setHeaderState] = useState(0); + const user = useSelector(selectUserData); + const navigate = useNavigate(); - useEffect(() => { - if (user) { - setHeaderState(0); - } - }, [user]); + useEffect(() => { + if (user) { + setHeaderState(0); + } + }, [user]); - const handleClick = () => { - setMenuOpen(!menuOpen); - setHeaderState(0); - }; + const handleClick = () => { + setMenuOpen(!menuOpen); + setHeaderState(0); + }; - const handleNavigate = () => { - navigate('/'); - setMenuOpen(false); - }; + const handleNavigate = () => { + navigate('/'); + setMenuOpen(false); + }; - const renderModileHeaderContent = () => { - switch (headerState) { - case 0: { - return ( - setMenuOpen(false)} - user={user} - /> - ); - } - case 1: { - return ( -
    -

    #реєстрація

    - -
    - ); - } - } - }; + const renderModileHeaderContent = () => { + switch (headerState) { + case 0: + return setMenuOpen(false)} user={user} />; + case 1: + return ( +
    +

    #реєстрація

    + +
    + ); + } + }; - return ( -
    - -
    -
    - profspilka-logo -
    - -
    -
    - {menuOpen && ( -
    - - {renderModileHeaderContent()} -

    - ПРОФСПІЛКОВА ОРГАНІЗАЦІЯ СТУДЕНТІВ ЧЕРНІВЕЦЬКОГО НАЦІОНАЛЬНОГО - УНІВЕРСИТЕТУ ІМЕНІ ЮРІЯ ФЕДЬКОВИЧА -

    -
    -
    - )} -
    - ); + return ( +
    + +
    +
    + profspilka-logo +
    + +
    +
    + {menuOpen && ( +
    + + {renderModileHeaderContent()} +

    + ПРОФСПІЛКОВА ОРГАНІЗАЦІЯ СТУДЕНТІВ ЧЕРНІВЕЦЬКОГО НАЦІОНАЛЬНОГО УНІВЕРСИТЕТУ ІМЕНІ ЮРІЯ ФЕДЬКОВИЧА +

    +
    +
    + )} +
    + ); }; export default MobileHeader; diff --git a/src/web/src/components/Header/MobileMenuContent.jsx b/src/web/src/components/Header/MobileMenuContent.jsx index 777a92f..97285fd 100644 --- a/src/web/src/components/Header/MobileMenuContent.jsx +++ b/src/web/src/components/Header/MobileMenuContent.jsx @@ -1,85 +1,75 @@ import React from 'react'; import { HashLink as Link } from 'react-router-hash-link'; import Button from '../../ui/Buttons/Button'; -// import PrimaryButton from '../../ui/Buttons/PrimaryButton'; import Avatar from '../Avatar'; import { useNavigate } from 'react-router-dom'; import { Token } from '../../services/TokenService'; const MobileMenuContent = ({ setHeaderState, handleClose, user }) => { - const navigate = useNavigate(); - const links = [ - { - name: 'Події', - link: '/events', - }, - { - name: 'Переваги', - link: '/#advantages', - }, - { - name: 'Ми в соц мережах', - link: '/#socials', - }, - { - name: 'Партнери', - link: '/#partners', - }, - { - name: 'Типові питання', - link: '/#questions', - }, - ]; + const navigate = useNavigate(); + const links = [ + { + name: 'Події', + link: '/events', + }, + { + name: 'Переваги', + link: '/#advantages', + }, + { + name: 'Ми в соц мережах', + link: '/#socials', + }, + { + name: 'Партнери', + link: '/#partners', + }, + { + name: 'Типові питання', + link: '/#questions', + }, + ]; - const handleNavigate = () => { - navigate('/profile'); - handleClose(); - }; + const handleNavigate = () => { + navigate('/profile'); + handleClose(); + }; - const MenuItem = ({ item }) => { - return ( - -

    {item.name}

    - - - ); - }; + const MenuItem = ({ item }) => { + return ( + +

    {item.name}

    + + + ); + }; - return ( -
    -

    #меню

    -
      - {links.map((link, index) => ( - - ))} -
    - {Token.get() ? ( -
    handleNavigate()} - className='flex items-center mb-12 border border-white rounded-standart px-2 py-2' - > -

    {user.fullName}

    - -
    - ) : ( -
    - - {/* setHeaderState(1)} - > - Зареєструватись - */} -
    - )} -
    - ); + return ( +
    +

    #меню

    +
      + {links.map((link, index) => ( + + ))} +
    + {Token.get() ? ( +
    handleNavigate()} className='flex items-center mb-12 border border-white rounded-standart px-2 py-2'> +

    {user.fullName}

    + +
    + ) : ( +
    + +
    + )} +
    + ); }; export default MobileMenuContent; diff --git a/src/web/src/components/Header/UserDetails.jsx b/src/web/src/components/Header/UserDetails.jsx index ef32d22..444671b 100644 --- a/src/web/src/components/Header/UserDetails.jsx +++ b/src/web/src/components/Header/UserDetails.jsx @@ -4,28 +4,26 @@ import Avatar from '../Avatar'; import { useMediaQuery } from 'react-responsive'; const UserDetails = ({ user }) => { - const media = useMediaQuery({ maxWidth: '700px' }); - const navigate = useNavigate(); + const media = useMediaQuery({ maxWidth: '700px' }); + const navigate = useNavigate(); - const handleNavigate = () => { - navigate('/profile'); - }; + const handleNavigate = () => { + navigate('/profile'); + }; - return !media ? ( -
    -

    - {user.fullName} -

    - -
    - ) : ( -
    - -
    - ); + return !media ? ( +
    +

    {user.fullName}

    + +
    + ) : ( +
    + +
    + ); }; export default UserDetails; diff --git a/src/web/src/components/Header/index.jsx b/src/web/src/components/Header/index.jsx index 67c2f92..501037b 100644 --- a/src/web/src/components/Header/index.jsx +++ b/src/web/src/components/Header/index.jsx @@ -14,9 +14,9 @@ const Header = () => { const user = useSelector(selectUserData); const isMobile = useMediaQuery({ maxWidth: '450px' }); - return isMobile ? ( - - ) : ( + if (isMobile) return ; + + return (
    diff --git a/src/web/src/components/Layout/index.jsx b/src/web/src/components/Layout/index.jsx index d8f7d74..36eea6f 100644 --- a/src/web/src/components/Layout/index.jsx +++ b/src/web/src/components/Layout/index.jsx @@ -11,34 +11,34 @@ import RegistrationForm from '../RegistrationForm'; import SimpleModal from '../SimpleModal'; const Layout = ({ children }) => { - const { open } = useSelector(selectLoginState); - const isMobile = useMediaQuery({ maxWidth: '480px' }); - const alert = useSelector(selectAlertState); - const dispatch = useDispatch(); + const { open } = useSelector(selectLoginState); + const isMobile = useMediaQuery({ maxWidth: '480px' }); + const alert = useSelector(selectAlertState); + const dispatch = useDispatch(); - useEffect(() => { - dispatch(fetchDiscounts()); - const token = Token.get(); - if (token) { - dispatch(fetchUserThunk()); - } - }, []); + useEffect(() => { + dispatch(fetchDiscounts()); + const token = Token.get(); + if (token) { + dispatch(fetchUserThunk()); + } + }, []); - const handleClose = () => { - dispatch(handleOpen()); - }; + const handleClose = () => { + dispatch(handleOpen()); + }; - return ( -
    - {children} - {!isMobile && open && ( - - - - )} - {alert.open && } -
    - ); + return ( +
    + {children} + {!isMobile && open && ( + + + + )} + {alert.open && } +
    + ); }; export default Layout; diff --git a/src/web/src/components/Loader/index.jsx b/src/web/src/components/Loader/index.jsx index 03c9fa3..24978cd 100644 --- a/src/web/src/components/Loader/index.jsx +++ b/src/web/src/components/Loader/index.jsx @@ -3,18 +3,18 @@ import { useMediaQuery } from 'react-responsive'; import { BounceLoader } from 'react-spinners'; const Loader = ({ className = '' }) => { - const isSmScreen = useMediaQuery({ maxWidth: '400px' }); - return ( -
    - -
    - ); + const isSmScreen = useMediaQuery({ maxWidth: '400px' }); + return ( +
    + +
    + ); }; export default Loader; diff --git a/src/web/src/components/PageWrapper/index.jsx b/src/web/src/components/PageWrapper/index.jsx index 56ca00e..3cd20b6 100644 --- a/src/web/src/components/PageWrapper/index.jsx +++ b/src/web/src/components/PageWrapper/index.jsx @@ -11,45 +11,45 @@ import Loader from '../Loader'; import { useNavigate, ScrollRestoration } from 'react-router-dom'; const PageWrapper = ({ element, withFooter = true }) => { - const dispatch = useDispatch(); - const [loading, setLoading] = useState(true); + const dispatch = useDispatch(); + const [loading, setLoading] = useState(true); - const navigate = useNavigate(); + const navigate = useNavigate(); - useEffect(() => { - Promise.all([ - dispatch(fetchDiscounts()), - dispatch(fetchEvents()), - dispatch(fetchAdvantages()), - dispatch(fetchPartners()), - dispatch(fetchQuestions()), - dispatch(fetchSharedDiscounts()), - ]) - .then(() => { - setLoading(false); - }) - .catch(() => { - setLoading(false); - navigate('/not-found'); - }); - }, []); + useEffect(() => { + Promise.all([ + dispatch(fetchDiscounts()), + dispatch(fetchEvents()), + dispatch(fetchAdvantages()), + dispatch(fetchPartners()), + dispatch(fetchQuestions()), + dispatch(fetchSharedDiscounts()), + ]) + .then(() => { + setLoading(false); + }) + .catch(() => { + setLoading(false); + navigate('/not-found'); + }); + }, []); - return ( -
    - {loading ? ( -
    - -
    - ) : ( - -
    - {element} - {withFooter &&
    } - - - )} -
    - ); + return ( +
    + {loading ? ( +
    + +
    + ) : ( + +
    + {element} + {withFooter &&
    } + + + )} +
    + ); }; export default PageWrapper; diff --git a/src/web/src/components/PartnerCard/index.jsx b/src/web/src/components/PartnerCard/index.jsx index 532c0a7..cea1642 100644 --- a/src/web/src/components/PartnerCard/index.jsx +++ b/src/web/src/components/PartnerCard/index.jsx @@ -1,24 +1,19 @@ import React from 'react'; const PartnerCard = ({ partner }) => { - const { mainText, subText, subTextLink, image } = partner; + const { mainText, subText, subTextLink, image } = partner; - return ( -
    -
    - {mainText} -
    -

    {mainText}

    - - {subText} - -
    - ); + return ( +
    +
    + {mainText} +
    +

    {mainText}

    + + {subText} + +
    + ); }; export default PartnerCard; diff --git a/src/web/src/components/ProtectedRoute/index.jsx b/src/web/src/components/ProtectedRoute/index.jsx index be44535..6f8b693 100644 --- a/src/web/src/components/ProtectedRoute/index.jsx +++ b/src/web/src/components/ProtectedRoute/index.jsx @@ -1,14 +1,14 @@ -import React from 'react' -import { Navigate } from 'react-router-dom' +import React from 'react'; +import { Navigate } from 'react-router-dom'; -const ProtectedRoute = ({ children, protectWhen, redirectTo = "/" }) => { - const isDisabled = protectWhen(); +const ProtectedRoute = ({ children, protectWhen, redirectTo = '/' }) => { + const isDisabled = protectWhen(); - if (isDisabled) { - return - } + if (isDisabled) { + return ; + } - return children; -} + return children; +}; -export default ProtectedRoute; \ No newline at end of file +export default ProtectedRoute; diff --git a/src/web/src/components/QrcodeGenerator/index.jsx b/src/web/src/components/QrcodeGenerator/index.jsx index 73cc629..7319c90 100644 --- a/src/web/src/components/QrcodeGenerator/index.jsx +++ b/src/web/src/components/QrcodeGenerator/index.jsx @@ -2,7 +2,7 @@ import React from 'react'; import QrCode from 'react-qr-code'; const QrcodeGenerator = ({ size = 300, value }) => { - return ; + return ; }; export default QrcodeGenerator; diff --git a/src/web/src/components/RegistrationForm/index.jsx b/src/web/src/components/RegistrationForm/index.jsx index dac96f1..9c7da3e 100644 --- a/src/web/src/components/RegistrationForm/index.jsx +++ b/src/web/src/components/RegistrationForm/index.jsx @@ -10,7 +10,6 @@ const RegistrationForm = ({ className = '' }) => {
    -

    Авторизація здійснюється за допомогою корпоративного облікового запису diff --git a/src/web/src/components/SimpleModal/index.jsx b/src/web/src/components/SimpleModal/index.jsx index c112ac9..7667c54 100644 --- a/src/web/src/components/SimpleModal/index.jsx +++ b/src/web/src/components/SimpleModal/index.jsx @@ -1,25 +1,22 @@ import React from 'react'; const SimpleModal = ({ children, handleClose = null, className = '' }) => { - const handleClick = () => { - if (handleClose) { - handleClose(); - } - }; + const handleClick = () => { + if (handleClose) { + handleClose(); + } + }; - return ( -

    -
    e.stopPropagation()} - className={`w-5/6 bg-white shadow-sm h-3/4 rounded-standart sm:h-5/6 lg:w-1/3 xl:w-1/3 xl:h-2/3 ${className}`} - > -
    {children}
    -
    -
    - ); + return ( +
    +
    e.stopPropagation()} + className={`w-5/6 bg-white shadow-sm h-3/4 rounded-standart sm:h-5/6 lg:w-1/3 xl:w-1/3 xl:h-2/3 ${className}`} + > +
    {children}
    +
    +
    + ); }; export default SimpleModal; diff --git a/src/web/src/components/Svg/index.jsx b/src/web/src/components/Svg/index.jsx index ecebddc..4558075 100644 --- a/src/web/src/components/Svg/index.jsx +++ b/src/web/src/components/Svg/index.jsx @@ -2,9 +2,7 @@ import React from 'react'; import svgs from '../../assets/svgs'; const Svg = ({ name, className = '' }) => { - return ( - - ) -} + return ; +}; -export default Svg; \ No newline at end of file +export default Svg; diff --git a/src/web/src/features/advantagesSlice.js b/src/web/src/features/advantagesSlice.js index 8e36737..e8914a9 100644 --- a/src/web/src/features/advantagesSlice.js +++ b/src/web/src/features/advantagesSlice.js @@ -2,31 +2,31 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; import { AdvantagesService } from '../services/AdvantagesService'; const initialState = { - data: [], + data: [], }; export const fetchAdvantages = createAsyncThunk( - 'advantages/fetchAdvantages', - async (_, { fulfillWithValue, rejectWithValue }, api = new AdvantagesService()) => { - try { - const { data } = await api.getAdvantages(); + 'advantages/fetchAdvantages', + async (_, { fulfillWithValue, rejectWithValue }, api = new AdvantagesService()) => { + try { + const { data } = await api.getAdvantages(); - return fulfillWithValue(data); - } catch (error) { - return rejectWithValue(undefined); - } - } + return fulfillWithValue(data); + } catch (error) { + return rejectWithValue(undefined); + } + } ); const advantagesSlice = createSlice({ - name: 'advantages', - initialState: initialState, - reducers: {}, - extraReducers: { - [fetchAdvantages.fulfilled]: (state, action) => { - state.data = action.payload; - }, - }, + name: 'advantages', + initialState: initialState, + reducers: {}, + extraReducers: { + [fetchAdvantages.fulfilled]: (state, action) => { + state.data = action.payload; + }, + }, }); export const selectAdvantages = (state) => state.advantages.data; diff --git a/src/web/src/features/alertSlice.js b/src/web/src/features/alertSlice.js index ff6a573..ba60bfa 100644 --- a/src/web/src/features/alertSlice.js +++ b/src/web/src/features/alertSlice.js @@ -1,40 +1,40 @@ -import { createSlice } from "@reduxjs/toolkit"; -import { AlertType } from "../types/alertTypes"; +import { createSlice } from '@reduxjs/toolkit'; +import { AlertType } from '../types/alertTypes'; const initialState = { - open: false, - text: "Шось пішло не так!", - type: AlertType.ERROR, - duration: 3000 -} + open: false, + text: 'Шось пішло не так!', + type: AlertType.ERROR, + duration: 3000, +}; export const alertSlice = createSlice({ - name: "alert", - initialState: initialState, - reducers: { - showAlert: (state, action) => { - state.duration = action.payload.duration; - state.type = action.payload.type; - state.text = action.payload.text; - state.open = action.payload.open; - }, - toggleAlert: (state) => { - state.open = !state.open; - }, - closeAlert: (state) => { - state.open = false; - }, - showDefaultAlert: (state) => { - state.duration = initialState.duration; - state.text = initialState.text; - state.type = initialState.type; - state.open = true; - } - } -}) + name: 'alert', + initialState: initialState, + reducers: { + showAlert: (state, action) => { + state.duration = action.payload.duration; + state.type = action.payload.type; + state.text = action.payload.text; + state.open = action.payload.open; + }, + toggleAlert: (state) => { + state.open = !state.open; + }, + closeAlert: (state) => { + state.open = false; + }, + showDefaultAlert: (state) => { + state.duration = initialState.duration; + state.text = initialState.text; + state.type = initialState.type; + state.open = true; + }, + }, +}); export const { closeAlert, toggleAlert, showDefaultAlert, showAlert } = alertSlice.actions; export const selectAlertState = (state) => state.alert; -export default alertSlice.reducer; \ No newline at end of file +export default alertSlice.reducer; diff --git a/src/web/src/features/discountSlice.js b/src/web/src/features/discountSlice.js index c448f46..ba4177e 100644 --- a/src/web/src/features/discountSlice.js +++ b/src/web/src/features/discountSlice.js @@ -2,57 +2,57 @@ import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; import { DiscountService } from '../services/DiscountService'; const initialState = { - data: [], - sharedDiscounts: [], - sharedDiscountsLoading: false, - loading: false, + data: [], + sharedDiscounts: [], + sharedDiscountsLoading: false, + loading: false, }; export const fetchDiscounts = createAsyncThunk( - 'discount/fetchDiscounts', - async (_, { fulfillWithValue, rejectWithValue }, service = new DiscountService()) => { - try { - const { data } = await service.getAll(); - return fulfillWithValue(data); - } catch (error) { - return rejectWithValue(error); - } - } + 'discount/fetchDiscounts', + async (_, { fulfillWithValue, rejectWithValue }, service = new DiscountService()) => { + try { + const { data } = await service.getAll(); + return fulfillWithValue(data); + } catch (error) { + return rejectWithValue(error); + } + } ); export const fetchSharedDiscounts = createAsyncThunk( - 'discount/fetchSharedDiscounts', - async (_, { fulfillWithValue, rejectWithValue }, service = new DiscountService()) => { - try { - const { data } = await service.getSharedDiscounts(); - console.log(data); - return fulfillWithValue(data); - } catch (error) { - return rejectWithValue(error); - } - } + 'discount/fetchSharedDiscounts', + async (_, { fulfillWithValue, rejectWithValue }, service = new DiscountService()) => { + try { + const { data } = await service.getSharedDiscounts(); + console.log(data); + return fulfillWithValue(data); + } catch (error) { + return rejectWithValue(error); + } + } ); export const discountSlice = createSlice({ - name: 'discount', - initialState: initialState, - reducers: {}, - extraReducers: { - [fetchDiscounts.pending]: (state) => { - state.loading = true; - }, - [fetchDiscounts.fulfilled]: (state, action) => { - state.data = action.payload; - state.loading = false; - }, - [fetchSharedDiscounts.pending]: (state) => { - state.sharedDiscountsLoading = true; - }, - [fetchSharedDiscounts.fulfilled]: (state, action) => { - state.sharedDiscounts = action.payload; - state.sharedDiscountsLoading = false; - }, - }, + name: 'discount', + initialState: initialState, + reducers: {}, + extraReducers: { + [fetchDiscounts.pending]: (state) => { + state.loading = true; + }, + [fetchDiscounts.fulfilled]: (state, action) => { + state.data = action.payload; + state.loading = false; + }, + [fetchSharedDiscounts.pending]: (state) => { + state.sharedDiscountsLoading = true; + }, + [fetchSharedDiscounts.fulfilled]: (state, action) => { + state.sharedDiscounts = action.payload; + state.sharedDiscountsLoading = false; + }, + }, }); export const selectDiscounts = (state) => state.discounts.data; diff --git a/src/web/src/features/eventsSlice.js b/src/web/src/features/eventsSlice.js index 4eacac1..fef3e94 100644 --- a/src/web/src/features/eventsSlice.js +++ b/src/web/src/features/eventsSlice.js @@ -1,38 +1,37 @@ -import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; -import { EventService } from "../services/EventService"; +import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; +import { EventService } from '../services/EventService'; const initialState = { - data: [], - loading: false -} + data: [], + loading: false, +}; export const fetchEvents = createAsyncThunk( - 'events/fetchEvents', - async (_, { fulfillWithValue, rejectWithValue }, api = new EventService()) => { - try { - const { data } = await api.getEvents(); - return fulfillWithValue(data); - } catch (error) { - return rejectWithValue(undefined); - } - } -) + 'events/fetchEvents', + async (_, { fulfillWithValue, rejectWithValue }, api = new EventService()) => { + try { + const { data } = await api.getEvents(); + return fulfillWithValue(data); + } catch (error) { + return rejectWithValue(undefined); + } + } +); const eventsSlice = createSlice({ - name: 'events', - initialState: initialState, - reducers: { - }, - extraReducers: { - [fetchEvents.pending]: (state) => { - state.loading = true; - }, - [fetchEvents.fulfilled]: (state, action) => { - state.data = action.payload; - state.loading = false; - } - } -}) + name: 'events', + initialState: initialState, + reducers: {}, + extraReducers: { + [fetchEvents.pending]: (state) => { + state.loading = true; + }, + [fetchEvents.fulfilled]: (state, action) => { + state.data = action.payload; + state.loading = false; + }, + }, +}); export const selectEvents = (state) => state.events.data; diff --git a/src/web/src/features/index.js b/src/web/src/features/index.js index 4d69598..d7c2e8b 100644 --- a/src/web/src/features/index.js +++ b/src/web/src/features/index.js @@ -1,10 +1,10 @@ -import login from "./loginSlice"; -import user from "./userSlice"; -import events from "./eventsSlice"; -import advantages from "./advantagesSlice"; -import partners from "./partnersSlice" -import alert from "./alertSlice"; +import login from './loginSlice'; +import user from './userSlice'; +import events from './eventsSlice'; +import advantages from './advantagesSlice'; +import partners from './partnersSlice'; +import alert from './alertSlice'; import discounts from './discountSlice'; -import questions from "./questionsSlice"; +import questions from './questionsSlice'; -export default { login, user, events, advantages, partners, alert, discounts, questions }; \ No newline at end of file +export default { login, user, events, advantages, partners, alert, discounts, questions }; diff --git a/src/web/src/features/loginSlice.js b/src/web/src/features/loginSlice.js index cec49e3..a615023 100644 --- a/src/web/src/features/loginSlice.js +++ b/src/web/src/features/loginSlice.js @@ -1,18 +1,18 @@ -import { createSlice } from "@reduxjs/toolkit"; +import { createSlice } from '@reduxjs/toolkit'; const initialState = { - open: false, -} + open: false, +}; const loginSlice = createSlice({ - name: 'login', - initialState: initialState, - reducers: { - handleOpen: (state) => { - state.open = !state.open; - } - }, -}) + name: 'login', + initialState: initialState, + reducers: { + handleOpen: (state) => { + state.open = !state.open; + }, + }, +}); export const { handleOpen } = loginSlice.actions; diff --git a/src/web/src/features/partnersSlice.js b/src/web/src/features/partnersSlice.js index 09be8ca..4a91031 100644 --- a/src/web/src/features/partnersSlice.js +++ b/src/web/src/features/partnersSlice.js @@ -2,30 +2,30 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; import { PartnersService } from '../services/PartnersService'; const initialState = { - data: [], + data: [], }; export const fetchPartners = createAsyncThunk( - 'partners/fetchPartners', - async (_, { fulfillWithValue }, service = new PartnersService()) => { - try { - const { data } = await service.getPartners(); + 'partners/fetchPartners', + async (_, { fulfillWithValue }, service = new PartnersService()) => { + try { + const { data } = await service.getPartners(); - return fulfillWithValue(data); - } catch (error) { - console.log(error); - } - } + return fulfillWithValue(data); + } catch (error) { + console.log(error); + } + } ); const partnersSlice = createSlice({ - name: 'partners', - initialState: initialState, - extraReducers: { - [fetchPartners.fulfilled]: (state, action) => { - state.data = action.payload; - }, - }, + name: 'partners', + initialState: initialState, + extraReducers: { + [fetchPartners.fulfilled]: (state, action) => { + state.data = action.payload; + }, + }, }); export const selectPartners = (state) => state.partners.data; diff --git a/src/web/src/features/questionsSlice.js b/src/web/src/features/questionsSlice.js index 8f40edd..f31b95e 100644 --- a/src/web/src/features/questionsSlice.js +++ b/src/web/src/features/questionsSlice.js @@ -1,33 +1,32 @@ -import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; -import { QuestionsService } from "../services/QuestionsService"; +import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; +import { QuestionsService } from '../services/QuestionsService'; const initialState = { - data: [] -} + data: [], +}; export const fetchQuestions = createAsyncThunk( - 'questions/fetch', - async (_, { fulfillWithValue, rejectWithValue }, service = new QuestionsService()) => { - try { - const { data } = await service.get(); + 'questions/fetch', + async (_, { fulfillWithValue, rejectWithValue }, service = new QuestionsService()) => { + try { + const { data } = await service.get(); - return fulfillWithValue(data); - } catch (error) { - return rejectWithValue(error); - } - } -) + return fulfillWithValue(data); + } catch (error) { + return rejectWithValue(error); + } + } +); const questionsSlice = createSlice({ - name: 'questions', - initialState: initialState, - extraReducers: { - [fetchQuestions.fulfilled]: (state, { payload }) => { - state.data = payload; - } - } -}) -// export const { fetchQuestions } = questionsSlice.actions + name: 'questions', + initialState: initialState, + extraReducers: { + [fetchQuestions.fulfilled]: (state, { payload }) => { + state.data = payload; + }, + }, +}); export const selectQuestions = (state) => state.questions.data; diff --git a/src/web/src/features/userSlice.js b/src/web/src/features/userSlice.js index 9e7da2f..fd3aa31 100644 --- a/src/web/src/features/userSlice.js +++ b/src/web/src/features/userSlice.js @@ -9,108 +9,105 @@ import { AlertType } from '../types/alertTypes'; import { handleOpen } from './loginSlice'; const initialState = { - loading: false, - data: { - id: null, - fullName: null, - facultet: null, - course: 2, - status: MemberStatus.NOT_VERIFICATED, - avatar: '', - role: MemberStatus.NotVerified, - email: '', - }, + loading: false, + data: { + id: null, + fullName: null, + facultet: null, + course: 2, + status: MemberStatus.NOT_VERIFICATED, + avatar: '', + role: MemberStatus.NotVerified, + email: '', + }, }; const authService = new AuthenticateService(); const alert = { - open: true, - text: '', - type: AlertType.SUCCESS, - duration: 4000, + open: true, + text: '', + type: AlertType.SUCCESS, + duration: 4000, }; export const googleAuthenticateThunk = createAsyncThunk( - 'user/authenticate', - async (googleToken, { fulfillWithValue, rejectWithValue, dispatch }) => { - try { - const googleResponse = await googleDataProvider(googleToken); - - const { name, picture, email, hd } = googleResponse; - const { data, status } = await authService.authenticateGoogle({ - name, - picture, - email, - hd, - }); - - if (status === HttpStatusCode.Created) { - alert.text = 'Ваш аккаунт було успішно створено!'; - dispatch(showAlert(alert)); - } - - if (status === HttpStatusCode.Ok) { - alert.text = 'З поверненням!'; - dispatch(showAlert(alert)); - } - - dispatch(fetchUserThunk(data.token)); - - dispatch(handleOpen()); - return fulfillWithValue(); - } catch (error) { - alert.type = 'error'; - alert.text = 'Щось пішло не так! :('; - dispatch(showAlert(alert)); - return rejectWithValue(null); - } - } + 'user/authenticate', + async (googleToken, { fulfillWithValue, rejectWithValue, dispatch }) => { + try { + const googleResponse = await googleDataProvider(googleToken); + + const { name, picture, email, hd } = googleResponse; + const { data, status } = await authService.authenticateGoogle({ + name, + picture, + email, + hd, + }); + + if (status === HttpStatusCode.Created) { + alert.text = 'Ваш аккаунт було успішно створено!'; + dispatch(showAlert(alert)); + } + + if (status === HttpStatusCode.Ok) { + alert.text = 'З поверненням!'; + dispatch(showAlert(alert)); + } + + dispatch(fetchUserThunk(data.token)); + + dispatch(handleOpen()); + return fulfillWithValue(); + } catch (error) { + alert.type = 'error'; + alert.text = 'Щось пішло не так! :('; + dispatch(showAlert(alert)); + return rejectWithValue(null); + } + } ); -export const fetchUserThunk = createAsyncThunk( - 'user/fetchUser', - async (token, { fulfillWithValue, rejectWithValue, dispatch }) => { - try { - const userResponse = await getUser(token); - - return fulfillWithValue(userResponse.data); - } catch (error) { - dispatch(showDefaultAlert()); - return rejectWithValue(null); - } - } -); +export const fetchUserThunk = createAsyncThunk('user/fetchUser', async (token, { fulfillWithValue, rejectWithValue, dispatch }) => { + try { + const userResponse = await getUser(token); + + return fulfillWithValue(userResponse.data); + } catch (error) { + dispatch(showDefaultAlert()); + return rejectWithValue(null); + } +}); const userSlice = createSlice({ - name: 'user', - initialState: initialState, - reducers: { - logout: (state) => { - state.data = { ...initialState.data }; - }, - }, - extraReducers: { - [googleAuthenticateThunk.pending]: (state) => { - state.loading = true; - }, - [googleAuthenticateThunk.fulfilled]: (state) => { - state.loading = false; - }, - [googleAuthenticateThunk.rejected]: (state) => { - state.loading = false; - }, - [fetchUserThunk.pending]: (state) => { - state.loading = true; - }, - [fetchUserThunk.fulfilled]: (state, action) => { - state.data = action.payload; - state.loading = false; - }, - [fetchUserThunk.rejected]: (state) => { - state.loading = false; - }, - }, + name: 'user', + initialState: initialState, + reducers: { + logout: (state) => { + state.data = { ...initialState.data }; + }, + }, + extraReducers: { + [googleAuthenticateThunk.pending]: (state) => { + state.loading = true; + }, + [googleAuthenticateThunk.fulfilled]: (state) => { + state.loading = false; + }, + [googleAuthenticateThunk.rejected]: (state) => { + state.loading = false; + }, + [fetchUserThunk.pending]: (state) => { + state.loading = true; + }, + [fetchUserThunk.fulfilled]: (state, action) => { + state.data = action.payload; + state.loading = false; + }, + [fetchUserThunk.rejected]: (state) => { + state.loading = false; + }, + }, }); export const selectIsAuthorized = (state) => state.user.autorized; diff --git a/src/web/src/pages/Event/index.jsx b/src/web/src/pages/Event/index.jsx index 13c5c81..92aaad4 100644 --- a/src/web/src/pages/Event/index.jsx +++ b/src/web/src/pages/Event/index.jsx @@ -5,42 +5,36 @@ import Loader from '../../components/Loader'; import Container from '../../components/Container'; const Event = () => { - const service = new EventService(); - const { id } = useParams(); - const navigate = useNavigate(); - const [event, setEvent] = useState(null); + const service = new EventService(); + const { id } = useParams(); + const navigate = useNavigate(); + const [event, setEvent] = useState(null); - useEffect(() => { - (async () => { - const { data } = await service.getEventById(id); - setEvent(data); - })(); - }, []); + useEffect(() => { + (async () => { + const { data } = await service.getEventById(id); + setEvent(data); + })(); + }, []); - return !event ? ( - - ) : ( - -

    navigate('/events')} - > - #Актуальні новини та події -

    -

    {event.title}

    -
    - {event.images.map((image) => ( -
    - -
    - ))} -
    -
    -
    - ); + return !event ? ( + + ) : ( + +

    navigate('/events')}> + #Актуальні новини та події +

    +

    {event.title}

    +
    + {event.images.map((image) => ( +
    + +
    + ))} +
    +
    +
    + ); }; export default Event; diff --git a/src/web/src/pages/Events/index.jsx b/src/web/src/pages/Events/index.jsx index b52959c..2ecda39 100644 --- a/src/web/src/pages/Events/index.jsx +++ b/src/web/src/pages/Events/index.jsx @@ -5,26 +5,26 @@ import { useSelector } from 'react-redux'; import { selectEvents } from '../../features/eventsSlice'; const Events = () => { - const events = useSelector(selectEvents); + const events = useSelector(selectEvents); - return events.length === 0 ? ( -
    -

    - На данний момент подій немає! Але вони будуть найблищим часом!
    - Приготуйтесь, буде цікаво! -

    -
    - ) : ( - -

    #події

    -

    #Актуальні події та новини профспілки

    -
    - {events.map((item) => ( - - ))} -
    -
    - ); + return events.length === 0 ? ( +
    +

    + На данний момент подій немає! Але вони будуть найблищим часом!
    + Приготуйтесь, буде цікаво! +

    +
    + ) : ( + +

    #події

    +

    #Актуальні події та новини профспілки

    +
    + {events.map((item) => ( + + ))} +
    +
    + ); }; export default Events; diff --git a/src/web/src/pages/ExternalRedirect/index.jsx b/src/web/src/pages/ExternalRedirect/index.jsx index 6e8e92d..c00c9dd 100644 --- a/src/web/src/pages/ExternalRedirect/index.jsx +++ b/src/web/src/pages/ExternalRedirect/index.jsx @@ -1,11 +1,12 @@ -import React from "react"; +import React from 'react'; + class ExternalRedirect extends React.Component { - componentDidMount() { - window.location = (process.env.REACT_APP_ADMIN_PATH); - } - render() { - return null - } + componentDidMount() { + window.location = process.env.REACT_APP_ADMIN_PATH; + } + render() { + return null; + } } -export default ExternalRedirect \ No newline at end of file +export default ExternalRedirect; diff --git a/src/web/src/pages/Main/components/Advantages.jsx b/src/web/src/pages/Main/components/Advantages.jsx index 37bba37..30c4fef 100644 --- a/src/web/src/pages/Main/components/Advantages.jsx +++ b/src/web/src/pages/Main/components/Advantages.jsx @@ -7,63 +7,51 @@ import { selectAdvantages } from '../../../features/advantagesSlice'; import PrimaryButton from '../../../ui/Buttons/PrimaryButton'; const Advantages = () => { - const smCount = 4; - const [count, setCount] = useState(smCount); + const smCount = 4; + const [count, setCount] = useState(smCount); - const isSmMedia = useMediaQuery({ maxWidth: '480px' }); - const advantages = useSelector(selectAdvantages); + const isSmMedia = useMediaQuery({ maxWidth: '480px' }); + const advantages = useSelector(selectAdvantages); - const moreAdvantages = () => { - if (count === smCount) setCount(advantages.data?.length); - else setCount(smCount); - }; + const moreAdvantages = () => { + if (count === smCount) setCount(advantages.data?.length); + else setCount(smCount); + }; - return ( - advantages && - advantages.length > 0 && ( -
    -
    - -
    -
    -

    - Переваги профспілкового -
    - членства -

    -
    - {isSmMedia - ? advantages - .slice(count) - .map((item) => ( - - )) - : advantages.map((item) => ( - - // eslint-disable-next-line no-mixed-spaces-and-tabs - ))} -
    - {isSmMedia && ( - -
    - {count === smCount ? 'Переглянути Всі' : 'Згорнути'} - - ↗ - -
    -
    - )} -
    -
    -
    - ) - ); + return ( + advantages && + advantages.length > 0 && ( +
    +
    + +
    +
    +

    + Переваги профспілкового +
    + членства +

    +
    + {isSmMedia + ? advantages.slice(count).map((item) => ) + : advantages.map((item) => ( + + // eslint-disable-next-line no-mixed-spaces-and-tabs + ))} +
    + {isSmMedia && ( + +
    + {count === smCount ? 'Переглянути Всі' : 'Згорнути'} + +
    +
    + )} +
    +
    +
    + ) + ); }; export default Advantages; diff --git a/src/web/src/pages/Main/components/Events.jsx b/src/web/src/pages/Main/components/Events.jsx index 26fdddb..e05eb04 100644 --- a/src/web/src/pages/Main/components/Events.jsx +++ b/src/web/src/pages/Main/components/Events.jsx @@ -6,30 +6,30 @@ import Button from '../../../ui/Buttons/Button'; import { useNavigate } from 'react-router-dom'; const Events = () => { - const navigate = useNavigate(); - const events = useSelector(selectEvents); + const navigate = useNavigate(); + const events = useSelector(selectEvents); - return ( - events && - events.length > 0 && ( -
    -

    Актуальні новини

    -
    - {events.map((event) => ( - - ))} -
    -
    - -
    -
    - ) - ); + return ( + events && + events.length > 0 && ( +
    +

    Актуальні новини

    +
    + {events.map((event) => ( + + ))} +
    +
    + +
    +
    + ) + ); }; export default Events; diff --git a/src/web/src/pages/Main/components/Landing.jsx b/src/web/src/pages/Main/components/Landing.jsx index c9b0332..0f2733a 100644 --- a/src/web/src/pages/Main/components/Landing.jsx +++ b/src/web/src/pages/Main/components/Landing.jsx @@ -1,19 +1,19 @@ -import React from 'react' -import Circles from '../../../components/Circles' -import Svg from '../../../components/Svg' +import React from 'react'; +import Circles from '../../../components/Circles'; +import Svg from '../../../components/Svg'; const Landing = () => { - return ( -
    -
    - -

    Дбаємо про кожного студента

    -
    -
    - -
    -
    - ) -} + return ( +
    +
    + +

    Дбаємо про кожного студента

    +
    +
    + +
    +
    + ); +}; -export default Landing \ No newline at end of file +export default Landing; diff --git a/src/web/src/pages/Main/components/Partners.jsx b/src/web/src/pages/Main/components/Partners.jsx index 32ba58a..15fc632 100644 --- a/src/web/src/pages/Main/components/Partners.jsx +++ b/src/web/src/pages/Main/components/Partners.jsx @@ -1,23 +1,25 @@ -import React from 'react' -import { useSelector } from 'react-redux' +import React from 'react'; +import { useSelector } from 'react-redux'; import PartnerCard from '../../../components/PartnerCard'; -import { selectPartners } from '../../../features/partnersSlice' +import { selectPartners } from '../../../features/partnersSlice'; import Carousel from '../../../components/Carousel'; const Partners = () => { - const partners = useSelector(selectPartners); - return ( - (partners && partners.length > 0) && (
    -

    Наші партнери

    - - { - partners.map((item) => ( - - )) - } - -
    ) - ) -} + const partners = useSelector(selectPartners); -export default Partners \ No newline at end of file + return ( + partners && + partners.length > 0 && ( +
    +

    Наші партнери

    + + {partners.map((item) => ( + + ))} + +
    + ) + ); +}; + +export default Partners; diff --git a/src/web/src/pages/Main/components/SharedDiscounts.jsx b/src/web/src/pages/Main/components/SharedDiscounts.jsx index c9c56bb..1d0d7e1 100644 --- a/src/web/src/pages/Main/components/SharedDiscounts.jsx +++ b/src/web/src/pages/Main/components/SharedDiscounts.jsx @@ -5,32 +5,33 @@ import { DiscountInfoModal } from '../../../components/DiscountCard'; import Button from '../../../ui/Buttons/Button'; const SharedDiscounts = () => { - const discounts = useSelector(selectSharedDiscounts); + const discounts = useSelector(selectSharedDiscounts); - return ( -
    -

    Знижки які доступні всім студентам

    - {discounts.map((discount) => ( - - ))} -
    - ); + return ( +
    +

    Знижки які доступні всім студентам

    + {discounts.map((discount) => ( + + ))} +
    + ); }; const Discount = ({ discount }) => { - const [isOpen, setIsOpen] = useState(false); - return ( -
    - -
    -

    {discount?.name}

    - -
    - {isOpen && setIsOpen(false)} />} -
    - ); + const [isOpen, setIsOpen] = useState(false); + + return ( +
    + +
    +

    {discount?.name}

    + +
    + {isOpen && setIsOpen(false)} />} +
    + ); }; export default SharedDiscounts; diff --git a/src/web/src/pages/Main/components/Socials.jsx b/src/web/src/pages/Main/components/Socials.jsx index 54bda47..a71123f 100644 --- a/src/web/src/pages/Main/components/Socials.jsx +++ b/src/web/src/pages/Main/components/Socials.jsx @@ -1,53 +1,53 @@ import React from 'react'; const Socials = () => { - const socials = [ - { - icon: 'fa-brands fa-instagram', - text: 'instagram', - link: 'https://www.instagram.com/studprofkom.cv.ua/', - }, - { - icon: 'fa-brands fa-facebook', - text: 'facebook', - link: 'https://www.facebook.com/studprofkom.cv.ua/', - }, - { - icon: 'fab fa-telegram', - text: 'telegram', - link: 'https://t.me/studprofkom_cv_ua', - }, - { - icon: 'fab fa-youtube', - text: 'youtube', - link: 'https://www.youtube.com/@line5581', - }, - { - icon: 'fab fa-tiktok', - text: 'tik tok', - link: 'https://www.tiktok.com/@fedkovych_students', - }, - ]; + const socials = [ + { + icon: 'fa-brands fa-instagram', + text: 'instagram', + link: 'https://www.instagram.com/studprofkom.cv.ua/', + }, + { + icon: 'fa-brands fa-facebook', + text: 'facebook', + link: 'https://www.facebook.com/studprofkom.cv.ua/', + }, + { + icon: 'fab fa-telegram', + text: 'telegram', + link: 'https://t.me/studprofkom_cv_ua', + }, + { + icon: 'fab fa-youtube', + text: 'youtube', + link: 'https://www.youtube.com/@line5581', + }, + { + icon: 'fab fa-tiktok', + text: 'tik tok', + link: 'https://www.tiktok.com/@fedkovych_students', + }, + ]; - return ( -
    -

    Ми в соц мережах

    -
    - {socials.map((item) => ( - - -

    {item.text}

    -
    - ))} -
    -
    - ); + return ( +
    +

    Ми в соц мережах

    +
    + {socials.map((item) => ( + + +

    {item.text}

    +
    + ))} +
    +
    + ); }; export default Socials; diff --git a/src/web/src/pages/Main/components/TypicalQuestions.jsx b/src/web/src/pages/Main/components/TypicalQuestions.jsx index bfabd7a..fe8e925 100644 --- a/src/web/src/pages/Main/components/TypicalQuestions.jsx +++ b/src/web/src/pages/Main/components/TypicalQuestions.jsx @@ -4,21 +4,21 @@ import { useSelector } from 'react-redux'; import { selectQuestions } from '../../../features/questionsSlice'; const TipicalQuestions = () => { - const questions = useSelector(selectQuestions); + const questions = useSelector(selectQuestions); - return ( - questions && - questions.length > 0 && ( -
    -

    Типові запитання

    -
    - {questions.map((item) => ( - - ))} -
    -
    - ) - ); + return ( + questions && + questions.length > 0 && ( +
    +

    Типові запитання

    +
    + {questions.map((item) => ( + + ))} +
    +
    + ) + ); }; export default TipicalQuestions; diff --git a/src/web/src/pages/Main/index.jsx b/src/web/src/pages/Main/index.jsx index 02b6ecf..653ed4e 100644 --- a/src/web/src/pages/Main/index.jsx +++ b/src/web/src/pages/Main/index.jsx @@ -16,32 +16,32 @@ import { fetchDiscounts } from '../../features/discountSlice'; import SharedDiscounts from './components/SharedDiscounts'; const Main = () => { - const dispatch = useDispatch(); + const dispatch = useDispatch(); - useEffect(() => { - dispatch(fetchDiscounts()); - dispatch(fetchEvents()); - dispatch(fetchAdvantages()); - dispatch(fetchPartners()); - dispatch(fetchQuestions()); - }, []); + useEffect(() => { + dispatch(fetchDiscounts()); + dispatch(fetchEvents()); + dispatch(fetchAdvantages()); + dispatch(fetchPartners()); + dispatch(fetchQuestions()); + }, []); - return ( -
    - - - - - - - - - - - - -
    - ); + return ( +
    + + + + + + + + + + + + +
    + ); }; export default Main; diff --git a/src/web/src/pages/NotFound/index.jsx b/src/web/src/pages/NotFound/index.jsx index e32de9a..761856e 100644 --- a/src/web/src/pages/NotFound/index.jsx +++ b/src/web/src/pages/NotFound/index.jsx @@ -1,25 +1,27 @@ -import React from 'react' -import { useNavigate } from 'react-router-dom' -import Circles from '../../components/Circles' -import Container from '../../components/Container' -import PrimaryButton from '../../ui/Buttons/PrimaryButton' +import React from 'react'; +import { useNavigate } from 'react-router-dom'; +import Circles from '../../components/Circles'; +import Container from '../../components/Container'; +import PrimaryButton from '../../ui/Buttons/PrimaryButton'; const NotFound = () => { - const navigate = useNavigate(); + const navigate = useNavigate(); - return ( - -
    - -

    404

    -
    -
    -

    упс... щось пішло не так

    - navigate("/")} className='mt-16'>На головну -
    -
    -
    - ) -} + return ( + +
    + +

    404

    +
    +
    +

    упс... щось пішло не так

    + navigate('/')} className='mt-16'> + На головну + +
    +
    +
    + ); +}; -export default NotFound \ No newline at end of file +export default NotFound; diff --git a/src/web/src/pages/Profile/DiscountsList.jsx b/src/web/src/pages/Profile/DiscountsList.jsx index 482a1e7..f9b6b37 100644 --- a/src/web/src/pages/Profile/DiscountsList.jsx +++ b/src/web/src/pages/Profile/DiscountsList.jsx @@ -7,68 +7,55 @@ import { MemberStatus } from '../../types/memberStatus'; import { DiscountType } from '../../types/discountType'; const DiscountsList = ({ status }) => { - const discounts = useSelector(selectDiscounts); - const loading = useSelector(selectDiscountsLoading); + const discounts = useSelector(selectDiscounts); + const loading = useSelector(selectDiscountsLoading); - const isAvailableDiscount = (discount) => { - return ( - discount.discountType === DiscountType.AvailableForAll || - discount.discountType === DiscountType.OneTimeForAll - ); - }; + const isAvailableDiscount = (discount) => { + return discount.discountType === DiscountType.AvailableForAll || discount.discountType === DiscountType.OneTimeForAll; + }; - const isMemberOfProfDiscount = (discount) => { - return ( - discount.discountType === DiscountType.AvailableForMemberOfProf || - discount.discountType === DiscountType.OneTimeForMemberOfProf - ); - }; + const isMemberOfProfDiscount = (discount) => { + return ( + discount.discountType === DiscountType.AvailableForMemberOfProf || discount.discountType === DiscountType.OneTimeForMemberOfProf + ); + }; - const renderDiscountCards = () => { - if (status === MemberStatus.NotVerified) { - return ( -
    - warning-icon -

    - Для того щоб користуватись знижками вам потрібно верифікуватись! -

    - - Напишіть нам - -
    - ); - } + const renderDiscountCards = () => { + if (status === MemberStatus.NotVerified) { + return ( +
    + warning-icon +

    Для того щоб користуватись знижками вам потрібно верифікуватись!

    + + Напишіть нам + +
    + ); + } - return discounts.map((item) => ( - - )); - }; + return discounts.map((item) => ( + + )); + }; - return ( -
    -

    #Персональні знижки

    -
    - {loading ? :
    {renderDiscountCards()}
    } - {!discounts.length && ( -
    -

    У вас ще немає знижок!

    -
    - )} -
    -
    - ); + return ( +
    +

    #Персональні знижки

    +
    + {loading ? :
    {renderDiscountCards()}
    } + {!discounts.length && ( +
    +

    У вас ще немає знижок!

    +
    + )} +
    +
    + ); }; export default DiscountsList; diff --git a/src/web/src/pages/Profile/Field.jsx b/src/web/src/pages/Profile/Field.jsx index 7c5b201..4344e1a 100644 --- a/src/web/src/pages/Profile/Field.jsx +++ b/src/web/src/pages/Profile/Field.jsx @@ -1,12 +1,12 @@ import React from 'react'; const Field = ({ label, text }) => { - return ( -
    -

    {label}

    -

    {text}

    -
    - ); + return ( +
    +

    {label}

    +

    {text}

    +
    + ); }; export default Field; diff --git a/src/web/src/pages/Profile/ProfileSidebar.jsx b/src/web/src/pages/Profile/ProfileSidebar.jsx index 6298c97..d11c204 100644 --- a/src/web/src/pages/Profile/ProfileSidebar.jsx +++ b/src/web/src/pages/Profile/ProfileSidebar.jsx @@ -12,101 +12,88 @@ import { AuthenticateService } from '../../services/AuthenticateService'; import { Token } from '../../services/TokenService'; const ProfileSidebar = () => { - const service = new AuthenticateService(); - const navigate = useNavigate(); - const dispatch = useDispatch(); + const service = new AuthenticateService(); + const navigate = useNavigate(); + const dispatch = useDispatch(); - const media = useMediaQuery({ maxWidth: '976px' }); - const { fullName, facultet, course, avatar, role } = useSelector(selectUserData); - const [isOpen, setIsOpen] = useState(false); + const media = useMediaQuery({ maxWidth: '976px' }); + const { fullName, facultet, course, avatar, role } = useSelector(selectUserData); + const [isOpen, setIsOpen] = useState(false); - const handleOpen = () => { - setIsOpen(!isOpen); - }; + const handleOpen = () => { + setIsOpen(!isOpen); + }; - const logOut = () => { - service.logout().then(() => { - Token.remove(); - dispatch(logout()); - navigate('/'); - }); - }; + const logOut = () => { + service.logout().then(() => { + Token.remove(); + dispatch(logout()); + navigate('/'); + }); + }; - const checkUserVerificated = (role) => { - return ( - role === MemberStatus.Student || - role === MemberStatus.MemberProfspilka || - role === MemberStatus.Admin || - role === MemberStatus.Moderator - ); - }; + const checkUserVerificated = (role) => { + return ( + role === MemberStatus.Student || + role === MemberStatus.MemberProfspilka || + role === MemberStatus.Admin || + role === MemberStatus.Moderator + ); + }; - const checkUserStatus = (status) => { - switch (status) { - case 1: - return 'Студент'; - case 2: - case 3: - case 4: - case 5: - return 'Член профспілки'; - } - }; + const checkUserStatus = (status) => { + switch (status) { + case 1: + return 'Студент'; + case 2: + case 3: + case 4: + case 5: + return 'Член профспілки'; + } + }; - return !media ? ( -
    -
    - -
    + return !media ? ( +
    +
    + +
    - - {role !== 0 && } - - - - -
    - ) : ( -
    -
    - -
    -

    П.І.Б

    -

    {fullName}

    -
    -
    - - {isOpen && ( -
    - - {role !== 0 && } - - - -
    - )} -
    - ); + + {role !== 0 && } + + + + +
    + ) : ( +
    +
    + +
    +

    П.І.Б

    +

    {fullName}

    +
    +
    + + {isOpen && ( +
    + + {role !== 0 && } + + + +
    + )} +
    + ); }; export default ProfileSidebar; diff --git a/src/web/src/pages/Profile/UserStatus.jsx b/src/web/src/pages/Profile/UserStatus.jsx index 9317310..16502ad 100644 --- a/src/web/src/pages/Profile/UserStatus.jsx +++ b/src/web/src/pages/Profile/UserStatus.jsx @@ -1,45 +1,44 @@ import React from 'react'; const UserStatus = ({ status, className = '' }) => { - const defaultStyles = - 'relative rounded-standart font-bold border-2 h-12 w-12 grid place-items-center group/item'; - const helperStyles = - 'absolute invisible -top-10 max-sm:-left-20 max-xl:left-1/2 transform -translate-x-1/2 -translate-y-1/2 group-hover/item:visible text-center p-3 rounded-standart w-72 text-white bg-primary'; - switch (status) { - // Не верифікований - case 0: - return ( -
    - Н -
    -

    Вас НЕ верифіковано

    -
    -
    - ); - //студент - case 1: - return ( -
    - С -
    -

    Вас верифіковано як Студента

    -
    -
    - ); - // Член профіспілки та інші це вже верифіковані користувачі та мають всі права - case 2: - case 3: - case 4: - case 5: - return ( -
    - Ч -
    -

    Вас верифіковано як Члена профспілки

    -
    -
    - ); - } + const defaultStyles = 'relative rounded-standart font-bold border-2 h-12 w-12 grid place-items-center group/item'; + const helperStyles = + 'absolute invisible -top-10 max-sm:-left-20 max-xl:left-1/2 transform -translate-x-1/2 -translate-y-1/2 group-hover/item:visible text-center p-3 rounded-standart w-72 text-white bg-primary'; + switch (status) { + // Не верифікований + case 0: + return ( +
    + Н +
    +

    Вас НЕ верифіковано

    +
    +
    + ); + //студент + case 1: + return ( +
    + С +
    +

    Вас верифіковано як Студента

    +
    +
    + ); + // Член профіспілки та інші це вже верифіковані користувачі та мають всі права + case 2: + case 3: + case 4: + case 5: + return ( +
    + Ч +
    +

    Вас верифіковано як Члена профспілки

    +
    +
    + ); + } }; export default UserStatus; diff --git a/src/web/src/pages/Profile/index.jsx b/src/web/src/pages/Profile/index.jsx index f024768..f885eaa 100644 --- a/src/web/src/pages/Profile/index.jsx +++ b/src/web/src/pages/Profile/index.jsx @@ -7,28 +7,28 @@ import DiscountsList from './DiscountsList'; import Loader from '../../components/Loader'; const Profile = () => { - const loading = useSelector(selectUserLoading); - const user = useSelector(selectUserData); - const dispatch = useDispatch(); + const loading = useSelector(selectUserLoading); + const user = useSelector(selectUserData); + const dispatch = useDispatch(); - useEffect(() => { - if (user && !user.id) { - dispatch(fetchUserThunk()); - } - }, [user]); + useEffect(() => { + if (user && !user.id) { + dispatch(fetchUserThunk()); + } + }, [user]); - return loading ? ( - - ) : ( - -

    #кабінет

    -

    Особистий кабінет

    -
    - - -
    -
    - ); + return loading ? ( + + ) : ( + +

    #кабінет

    +

    Особистий кабінет

    +
    + + +
    +
    + ); }; export default Profile; diff --git a/src/web/src/pages/VerifyDiscount/index.jsx b/src/web/src/pages/VerifyDiscount/index.jsx index e61650d..99cac2c 100644 --- a/src/web/src/pages/VerifyDiscount/index.jsx +++ b/src/web/src/pages/VerifyDiscount/index.jsx @@ -6,74 +6,63 @@ import Loader from '../../components/Loader'; import PrimaryButton from '../../ui/Buttons/PrimaryButton'; const VerifyDiscount = () => { - const { discountId, discountCodeId } = useParams(); + const { discountId, discountCodeId } = useParams(); - // DATA: {"fullName":null,"email":null,"image":null,"discount":null,"isSuccess":false} - // if isSuccess == true then all data must be not null - const [state, setState] = useState({ loading: false, data: null, error: null }); + // DATA: {"fullName":null,"email":null,"image":null,"discount":null,"isSuccess":false} + // if isSuccess == true then all data must be not null + const [state, setState] = useState({ loading: false, data: null, error: null }); - useEffect(() => { - (async () => { - setState({ ...state, loading: true }); - try { - const data = await verifyDiscount(discountId, discountCodeId); + useEffect(() => { + (async () => { + setState({ ...state, loading: true }); + try { + const data = await verifyDiscount(discountId, discountCodeId); - setState({ ...state, loading: false, data }); - } catch (error) { - setState({ ...state, loading: false, error: error.response.data.message }); - } - })(); - }, [discountId, discountCodeId]); + setState({ ...state, loading: false, data }); + } catch (error) { + setState({ ...state, loading: false, error: error.response.data.message }); + } + })(); + }, [discountId, discountCodeId]); - return ( - -
    -

    #Верифікація знижки

    - {state.loading ? ( -
    - -
    - ) : state.data || !state.error ? ( - - {state.data?.isSuccess ? ( -
    -

    QR-код успішно підтверджено!

    -

    - Знижка - - {state.data?.discount?.name} - {' '} - доступна для - {state.data?.fullName} -

    - success - На головну -
    - ) : ( -
    -

    Цей QR-код вже не дійсний!

    -

    Не потрібно нас обманювати:)

    - warning - На головну -
    - )} -
    - ) : ( - -

    Щось пішло не так!

    -
    - )} -
    -
    - ); + return ( + +
    +

    #Верифікація знижки

    + {state.loading ? ( +
    + +
    + ) : state.data || !state.error ? ( + + {state.data?.isSuccess ? ( +
    +

    QR-код успішно підтверджено!

    +

    + Знижка + {state.data?.discount?.name} доступна для + {state.data?.fullName} +

    + success + На головну +
    + ) : ( +
    +

    Цей QR-код вже не дійсний!

    +

    Не потрібно нас обманювати:)

    + warning + На головну +
    + )} +
    + ) : ( + +

    Щось пішло не так!

    +
    + )} +
    +
    + ); }; export default VerifyDiscount; diff --git a/src/web/src/pages/routes.jsx b/src/web/src/pages/routes.jsx index 49a8470..fbb3958 100644 --- a/src/web/src/pages/routes.jsx +++ b/src/web/src/pages/routes.jsx @@ -11,42 +11,42 @@ import Event from './Event'; import VerifyDiscount from './VerifyDiscount'; const routes = [ - { - path: '/', - element: } />, - }, - { - path: '/profile', - element: ( - - - - } - /> - ), - }, - { - path: '/events', - element: } withFooter={true} />, - }, - { - path: '*', - element: } withFooter={false} />, - }, - { - path: '/admin', - element: , - }, - { - path: '/events/:id', - element: } />, - }, - { - path: '/verify-discount/:discountId/:discountCodeId', - element: } />, - }, + { + path: '/', + element: } />, + }, + { + path: '/profile', + element: ( + + + + } + /> + ), + }, + { + path: '/events', + element: } withFooter={true} />, + }, + { + path: '*', + element: } withFooter={false} />, + }, + { + path: '/admin', + element: , + }, + { + path: '/events/:id', + element: } />, + }, + { + path: '/verify-discount/:discountId/:discountCodeId', + element: } />, + }, ]; export default routes; diff --git a/src/web/src/pages/routesProtection.js b/src/web/src/pages/routesProtection.js index 4418f4d..0c05ab5 100644 --- a/src/web/src/pages/routesProtection.js +++ b/src/web/src/pages/routesProtection.js @@ -1,3 +1,3 @@ -import { Token } from "../services/TokenService"; +import { Token } from '../services/TokenService'; -export const authorizeProtection = () => Token.get() === null \ No newline at end of file +export const authorizeProtection = () => Token.get() == null; diff --git a/src/web/src/services/AdvantagesService.js b/src/web/src/services/AdvantagesService.js index 1559829..b48148c 100644 --- a/src/web/src/services/AdvantagesService.js +++ b/src/web/src/services/AdvantagesService.js @@ -1,10 +1,10 @@ -import { ApiService } from "./config/ApiService"; +import { ApiService } from './config/ApiService'; export class AdvantagesService { - #service = new ApiService() - #advantagesUrl = "/advantage"; + #service = new ApiService(); + #advantagesUrl = '/advantage'; - getAdvantages() { - return this.#service.get(this.#advantagesUrl); - } -} \ No newline at end of file + getAdvantages() { + return this.#service.get(this.#advantagesUrl); + } +} diff --git a/src/web/src/services/AuthenticateService.js b/src/web/src/services/AuthenticateService.js index c670543..735d15b 100644 --- a/src/web/src/services/AuthenticateService.js +++ b/src/web/src/services/AuthenticateService.js @@ -4,27 +4,27 @@ import { Token } from './TokenService'; const api = new ApiService(); export class AuthenticateService { - #url = '/authenticate'; + #url = '/authenticate'; - async authenticateGoogle({ name, picture, email, hd }) { - try { - const response = await api.post(`${this.#url}/google`, { - fullName: name, - avatar: picture, - email, - hd, - }); + async authenticateGoogle({ name, picture, email, hd }) { + try { + const response = await api.post(`${this.#url}/google`, { + fullName: name, + avatar: picture, + email, + hd, + }); - if (response.data.token) { - Token.set(response.data.token); - return { data: response.data, status: response.status }; - } - } catch (err) { - throw Error(err); - } - } + if (response.data.token) { + Token.set(response.data.token); + return { data: response.data, status: response.status }; + } + } catch (err) { + throw Error(err); + } + } - logout() { - return api.post(`${this.#url}/logout`); - } + logout() { + return api.post(`${this.#url}/logout`); + } } diff --git a/src/web/src/services/DiscountService.js b/src/web/src/services/DiscountService.js index 1e60971..ca03eea 100644 --- a/src/web/src/services/DiscountService.js +++ b/src/web/src/services/DiscountService.js @@ -2,31 +2,31 @@ import { ApiService } from './config/ApiService'; import api from './config/axios.config'; export class DiscountService { - #apiUrl = '/discount/code'; + #apiUrl = '/discount/code'; - constructor() { - this.service = new ApiService(); - } + constructor() { + this.service = new ApiService(); + } - async getAll() { - return await this.service.get('/discount'); - } + async getAll() { + return await this.service.get('/discount'); + } - async getQrCode(discountId) { - return await this.service.get(`discount/code/${discountId}`); - } + async getQrCode(discountId) { + return await this.service.get(`discount/code/${discountId}`); + } - async getSharedDiscounts() { - return await this.service.get(`discount/shared`); - } + async getSharedDiscounts() { + return await this.service.get(`discount/shared`); + } } export const verifyDiscount = async (discountId, discountCodeId) => { - try { - const { data } = await api.get(`discount/code/verify/${discountId}/${discountCodeId}`); + try { + const { data } = await api.get(`discount/code/verify/${discountId}/${discountCodeId}`); - return data; - } catch (error) { - throw Error(error); - } + return data; + } catch (error) { + throw Error(error); + } }; diff --git a/src/web/src/services/EventService.js b/src/web/src/services/EventService.js index ad3a4fb..43a9763 100644 --- a/src/web/src/services/EventService.js +++ b/src/web/src/services/EventService.js @@ -1,18 +1,18 @@ // import { api } from "./config/axios.config"; -import { ApiService } from "./config/ApiService"; +import { ApiService } from './config/ApiService'; export class EventService { - #eventUrl = '/event'; + #eventUrl = '/event'; - constructor() { - this.api = new ApiService(); - } + constructor() { + this.api = new ApiService(); + } - async getEvents() { - return await this.api.get(this.#eventUrl); - } + async getEvents() { + return await this.api.get(this.#eventUrl); + } - async getEventById(id) { - return await this.api.get(`${this.#eventUrl}/${id}`); - } -} \ No newline at end of file + async getEventById(id) { + return await this.api.get(`${this.#eventUrl}/${id}`); + } +} diff --git a/src/web/src/services/GoogleAuth.js b/src/web/src/services/GoogleAuth.js index da10576..cd3447d 100644 --- a/src/web/src/services/GoogleAuth.js +++ b/src/web/src/services/GoogleAuth.js @@ -1,12 +1,10 @@ import axios from 'axios'; export const googleDataProvider = async (token) => { - try { - const { data } = await axios.get( - `https://www.googleapis.com/oauth2/v3/userinfo?access_token=${token}` - ); - return data; - } catch (err) { - throw Error(err); - } + try { + const { data } = await axios.get(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${token}`); + return data; + } catch (err) { + throw Error(err); + } }; diff --git a/src/web/src/services/PartnersService.js b/src/web/src/services/PartnersService.js index cd33d86..501567b 100644 --- a/src/web/src/services/PartnersService.js +++ b/src/web/src/services/PartnersService.js @@ -1,10 +1,10 @@ -import { ApiService } from "./config/ApiService"; +import { ApiService } from './config/ApiService'; export class PartnersService { - #url = '/partners'; - #service = new ApiService(); + #url = '/partners'; + #service = new ApiService(); - async getPartners() { - return await this.#service.get(this.#url); - } -} \ No newline at end of file + async getPartners() { + return await this.#service.get(this.#url); + } +} diff --git a/src/web/src/services/QuestionsService.js b/src/web/src/services/QuestionsService.js index 1fdbdab..e6cc248 100644 --- a/src/web/src/services/QuestionsService.js +++ b/src/web/src/services/QuestionsService.js @@ -1,13 +1,13 @@ -import { ApiService } from "./config/ApiService"; +import { ApiService } from './config/ApiService'; export class QuestionsService { - #url = "/question" + #url = '/question'; - constructor() { - this.api = new ApiService(); - } + constructor() { + this.api = new ApiService(); + } - async get() { - return await this.api.get(this.#url); - } -} \ No newline at end of file + async get() { + return await this.api.get(this.#url); + } +} diff --git a/src/web/src/services/TokenService.js b/src/web/src/services/TokenService.js index bab784a..47afdf2 100644 --- a/src/web/src/services/TokenService.js +++ b/src/web/src/services/TokenService.js @@ -1,14 +1,14 @@ const TOKEN_KEY = 'token'; export const Token = { - set: (token) => { - localStorage.removeItem(TOKEN_KEY); - localStorage.setItem(TOKEN_KEY, token); - }, - get: () => { - return localStorage.getItem(TOKEN_KEY); - }, - remove: () => { - localStorage.removeItem(TOKEN_KEY); - }, + set: (token) => { + localStorage.removeItem(TOKEN_KEY); + localStorage.setItem(TOKEN_KEY, token); + }, + get: () => { + return localStorage.getItem(TOKEN_KEY); + }, + remove: () => { + localStorage.removeItem(TOKEN_KEY); + }, }; diff --git a/src/web/src/services/UserService.js b/src/web/src/services/UserService.js index d564be2..2b74cea 100644 --- a/src/web/src/services/UserService.js +++ b/src/web/src/services/UserService.js @@ -4,20 +4,20 @@ import { Token } from './TokenService'; const api = new ApiService(); export class UserService { - #url = '/user'; + #url = '/user'; - constructor() {} + constructor() {} - async get(token = null) { - return await api.get('/user', token); - } + async get(token = null) { + return await api.get('/user', token); + } } export const getUser = async (token = null) => { - return axiosInstance.get('/user', { - headers: { - Authorization: `Bearer ${token ?? Token.get()}`, - }, - withCredentials: true, - }); + return axiosInstance.get('/user', { + headers: { + Authorization: `Bearer ${token ?? Token.get()}`, + }, + withCredentials: true, + }); }; diff --git a/src/web/src/services/config/ApiService.js b/src/web/src/services/config/ApiService.js index fc8e00e..19856ff 100644 --- a/src/web/src/services/config/ApiService.js +++ b/src/web/src/services/config/ApiService.js @@ -2,78 +2,78 @@ import { Token } from '../TokenService'; import api from './axios.config'; export class ApiService { - async post(url, data) { - const call = async () => { - return await api.post(url, data, { withCredentials: true }); - }; + async post(url, data) { + const call = async () => { + return await api.post(url, data, { withCredentials: true }); + }; - let res = null; + let res = null; - try { - res = await call(url); - } catch (error) { - if (error.response.status === 401 && (await this.refreshHandler())) { - // one more try - res = await call(url); - } - } - return res; - } + try { + res = await call(url); + } catch (error) { + if (error.response.status === 401 && (await this.refreshHandler())) { + // one more try + res = await call(url); + } + } + return res; + } - async get(url, token = null) { - const call = () => { - return api.get(url, { - headers: { - Authorization: `Bearer ${token ?? Token.get() ?? ''}`, - }, - }); - }; + async get(url, token = null) { + const call = () => { + return api.get(url, { + headers: { + Authorization: `Bearer ${token ?? Token.get() ?? ''}`, + }, + }); + }; - let res = null; + let res = null; - try { - res = await call(url); - } catch (error) { - if (error.response.status === 401 && (await this.refreshHandler())) { - // one more try - res = await call(url); - } - } - return res; - } + try { + res = await call(url); + } catch (error) { + if (error.response.status === 401 && (await this.refreshHandler())) { + // one more try + res = await call(url); + } + } + return res; + } - async put(url, data) { - const call = async () => { - return await api.put(url, data, { withCredentials: true }); - }; + async put(url, data) { + const call = async () => { + return await api.put(url, data, { withCredentials: true }); + }; - let res = null; + let res = null; - try { - res = await call(url); - } catch (error) { - if (error.response.status === 401 && (await this.refreshHandler())) { - // one more try - res = await call(url); - } - } - return res; - } + try { + res = await call(url); + } catch (error) { + if (error.response.status === 401 && (await this.refreshHandler())) { + // one more try + res = await call(url); + } + } + return res; + } - async delete(url) { - return api.delete(url, { withCredentials: true }); - } + async delete(url) { + return api.delete(url, { withCredentials: true }); + } - refreshHandler = async () => { - Token.remove(); - const res = await api.post('authenticate/refresh-token'); - console.log(res); - if (res.status !== 200) { - return false; - } + refreshHandler = async () => { + Token.remove(); + const res = await api.post('authenticate/refresh-token'); + console.log(res); + if (res.status !== 200) { + return false; + } - Token.set(res.data.token); + Token.set(res.data.token); - return true; - }; + return true; + }; } diff --git a/src/web/src/services/config/axios.config.js b/src/web/src/services/config/axios.config.js index a2ca7a5..461e674 100644 --- a/src/web/src/services/config/axios.config.js +++ b/src/web/src/services/config/axios.config.js @@ -4,11 +4,11 @@ import { Token } from '../TokenService'; export const USER_NOT_FOUND = 'User not found'; const axiosInstance = axios.create({ - baseURL: `${process.env.REACT_APP_API_URL}`, - withCredentials: true, - headers: { - Authorization: `Bearer ${Token.get() || ''}`, - }, + baseURL: `${process.env.REACT_APP_API_URL}`, + withCredentials: true, + headers: { + Authorization: `Bearer ${Token.get() || ''}`, + }, }); export default axiosInstance; diff --git a/src/web/src/types/alertTypes.js b/src/web/src/types/alertTypes.js index 4c31e73..f46b183 100644 --- a/src/web/src/types/alertTypes.js +++ b/src/web/src/types/alertTypes.js @@ -1,4 +1,4 @@ export const AlertType = { - ERROR: "error", - SUCCESS: "success" -} \ No newline at end of file + ERROR: 'error', + SUCCESS: 'success', +}; diff --git a/src/web/src/types/discountType.js b/src/web/src/types/discountType.js index 56c86ee..cdfc1fa 100644 --- a/src/web/src/types/discountType.js +++ b/src/web/src/types/discountType.js @@ -1,7 +1,7 @@ export const DiscountType = { - AvailableForAll: 0, - AvailableForMemberOfProf: 1, - OneTimeForAll: 2, - OneTimeForMemberOfProf: 3, - OneTimeForFirstCourse: 4, + AvailableForAll: 0, + AvailableForMemberOfProf: 1, + OneTimeForAll: 2, + OneTimeForMemberOfProf: 3, + OneTimeForFirstCourse: 4, }; diff --git a/src/web/src/types/memberStatus.js b/src/web/src/types/memberStatus.js index 0378d80..6452468 100644 --- a/src/web/src/types/memberStatus.js +++ b/src/web/src/types/memberStatus.js @@ -1,8 +1,8 @@ export const MemberStatus = { - NotVerified: 0, - Student: 1, - MemberProfspilka: 2, - Moderator: 3, - HeadOfUnit: 4, - Admin: 5, -} \ No newline at end of file + NotVerified: 0, + Student: 1, + MemberProfspilka: 2, + Moderator: 3, + HeadOfUnit: 4, + Admin: 5, +}; diff --git a/src/web/src/ui/Buttons/Button.jsx b/src/web/src/ui/Buttons/Button.jsx index 147f17e..5dd3329 100644 --- a/src/web/src/ui/Buttons/Button.jsx +++ b/src/web/src/ui/Buttons/Button.jsx @@ -1,14 +1,14 @@ import React from 'react'; const Button = ({ children, className = '', ...custom }) => { - return ( - - ); + return ( + + ); }; export default Button; diff --git a/src/web/src/ui/Buttons/GoogleButton.jsx b/src/web/src/ui/Buttons/GoogleButton.jsx index 6582073..9b51256 100644 --- a/src/web/src/ui/Buttons/GoogleButton.jsx +++ b/src/web/src/ui/Buttons/GoogleButton.jsx @@ -1,9 +1,9 @@ -import React from 'react' -import { useDispatch } from 'react-redux' -import Svg from '../../components/Svg' +import React from 'react'; +import { useDispatch } from 'react-redux'; +import Svg from '../../components/Svg'; // import Button from './Button' -import { useGoogleLogin } from '@react-oauth/google' -import { googleAuthenticateThunk } from '../../features/userSlice' +import { useGoogleLogin } from '@react-oauth/google'; +import { googleAuthenticateThunk } from '../../features/userSlice'; import PrimaryButton from './PrimaryButton'; const GoogleButton = ({ className = '' }) => { @@ -28,4 +28,4 @@ const GoogleButton = ({ className = '' }) => { ); }; -export default GoogleButton \ No newline at end of file +export default GoogleButton; diff --git a/src/web/src/ui/Buttons/PrimaryButton.jsx b/src/web/src/ui/Buttons/PrimaryButton.jsx index 02fb16b..171c68f 100644 --- a/src/web/src/ui/Buttons/PrimaryButton.jsx +++ b/src/web/src/ui/Buttons/PrimaryButton.jsx @@ -1,13 +1,14 @@ -import React from 'react' +import React from 'react'; const PrimaryButton = ({ children, className = '', ...custom }) => { - return ( - - ) -} + return ( + + ); +}; -export default PrimaryButton \ No newline at end of file +export default PrimaryButton; diff --git a/src/web/src/ui/Fields/TextField.jsx b/src/web/src/ui/Fields/TextField.jsx index 2409f2e..5e6a26c 100644 --- a/src/web/src/ui/Fields/TextField.jsx +++ b/src/web/src/ui/Fields/TextField.jsx @@ -1,17 +1,14 @@ -import React from 'react' +import React from 'react'; -const TextField = ({ - className = "", - placeholder, - ...custom -}) => { - return ( - - ) -} +const TextField = ({ className = '', placeholder, ...custom }) => { + return ( + + ); +}; -export default TextField \ No newline at end of file +export default TextField; diff --git a/src/web/src/utils/mocks.js b/src/web/src/utils/mocks.js index 16883b2..637abd0 100644 --- a/src/web/src/utils/mocks.js +++ b/src/web/src/utils/mocks.js @@ -1,127 +1,126 @@ - export const eventsMock = [ - { - title: "27 квітня відбудеться загальноуніверситетський захід «GO PLAY»", - date: "27.04.2023", - id: "34e79d2d-6fda-4063-a265-157c6fbef8bb" - }, - { - title: "Хочете знайти роботу до душі? УНІВЕРСИТЕТСЬКИЙ ЦЕНТР КАР‘ЄРИ", - date: "22.04.2023", - id: "42f563c8-8f4a-4cdb-8c41-ea7fad6dd0e2" - }, - { - title: "Запрошуємо вас на вечір настільних ігор, аби трішки відволіктись від навчання та повеселитися🕺", - date: "20.04.2023", - id: "391d78ec-eb77-478d-aea1-d94c1c91df20" - }, - { - title: "Новий голова Інформаційної комісії", - date: "02.03.2023", - id: "e53c997a-1537-4da0-89ab-42a9c55255a5" - }, -] + { + title: '27 квітня відбудеться загальноуніверситетський захід «GO PLAY»', + date: '27.04.2023', + id: '34e79d2d-6fda-4063-a265-157c6fbef8bb', + }, + { + title: 'Хочете знайти роботу до душі? УНІВЕРСИТЕТСЬКИЙ ЦЕНТР КАР‘ЄРИ', + date: '22.04.2023', + id: '42f563c8-8f4a-4cdb-8c41-ea7fad6dd0e2', + }, + { + title: 'Запрошуємо вас на вечір настільних ігор, аби трішки відволіктись від навчання та повеселитися🕺', + date: '20.04.2023', + id: '391d78ec-eb77-478d-aea1-d94c1c91df20', + }, + { + title: 'Новий голова Інформаційної комісії', + date: '02.03.2023', + id: 'e53c997a-1537-4da0-89ab-42a9c55255a5', + }, +]; export const advantagesMock = [ - { - tag: "Бали", - text: "додаткові бали до рейтингу" - }, - { - tag: "Економія", - text: "власних коштів за допомогою «Профспілкової id картки студента ЧНУ»" - }, - { - tag: "Відпочинок", - text: "дешевий літній відпочинок на морі та в горах" - }, - { - tag: "Студентське життя", - text: "цікаве та незабутнє студентське життя (Посвяти,конкурси, вечірки та ін.)" - }, - { - tag: "Нагороди", - text: "преміювання у випадку активної громадської діяльності." - }, - { - tag: "Робота", - text: "пошук роботи за допомогою послуг «Університетського центру кар’єри»" - }, - { - tag: "Допомога", - text: "захист прав студентів та гарантії допомоги" - }, - { - tag: "Реалізація", - text: "самореалізація у комісіях та підрозділах профспілки університету" - }, -] + { + tag: 'Бали', + text: 'додаткові бали до рейтингу', + }, + { + tag: 'Економія', + text: 'власних коштів за допомогою «Профспілкової id картки студента ЧНУ»', + }, + { + tag: 'Відпочинок', + text: 'дешевий літній відпочинок на морі та в горах', + }, + { + tag: 'Студентське життя', + text: 'цікаве та незабутнє студентське життя (Посвяти,конкурси, вечірки та ін.)', + }, + { + tag: 'Нагороди', + text: 'преміювання у випадку активної громадської діяльності.', + }, + { + tag: 'Робота', + text: 'пошук роботи за допомогою послуг «Університетського центру кар’єри»', + }, + { + tag: 'Допомога', + text: 'захист прав студентів та гарантії допомоги', + }, + { + tag: 'Реалізація', + text: 'самореалізація у комісіях та підрозділах профспілки університету', + }, +]; export const partnersMock = [ - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, - { - title: "@stip_mayami", - text: "Стриптиз клуб “Маямі", - link: "#", - image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" - }, -] + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, + { + title: '@stip_mayami', + text: 'Стриптиз клуб “Маямі', + link: '#', + image: 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', + }, +]; export const discountsMock = [ - { - name: "Знижка 15% у Стриптиз клубі “Маямі”", - code: "ada", - isBlocked: false, - }, - { - name: "Знижка 15% у Стриптиз клубі “Маямі”", - code: "ada", - isBlocked: true, - }, - { - name: "Знижка 15% у Стриптиз клубі “Маямі”", - code: "ada", - isBlocked: true, - }, -] \ No newline at end of file + { + name: 'Знижка 15% у Стриптиз клубі “Маямі”', + code: 'ada', + isBlocked: false, + }, + { + name: 'Знижка 15% у Стриптиз клубі “Маямі”', + code: 'ada', + isBlocked: true, + }, + { + name: 'Знижка 15% у Стриптиз клубі “Маямі”', + code: 'ada', + isBlocked: true, + }, +];