From 333c400ff561229d2d18b9e2389824a5c02e83c2 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Mon, 19 Aug 2024 21:33:34 +0300 Subject: [PATCH 01/55] OV-11: * colors --- frontend/src/framework/theme/styles/colors.styles.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/framework/theme/styles/colors.styles.ts b/frontend/src/framework/theme/styles/colors.styles.ts index 75c91a9c5..c207ae8ac 100644 --- a/frontend/src/framework/theme/styles/colors.styles.ts +++ b/frontend/src/framework/theme/styles/colors.styles.ts @@ -3,6 +3,12 @@ const colors = { 900: '#1a365d', 200: '#b3e0ff', }, + background: { + 900: '#0a0049', + 600: '#35399a', + 300: '#3c9cf5', + 50: '#e2e1ec', + }, text: { default: '#36454f', accent: '#ff5733', From 4bcf5ab3ca0395ad3e34edc2082ad557d8046813 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Mon, 19 Aug 2024 21:34:23 +0300 Subject: [PATCH 02/55] OV-11: + header component --- .../common/components/header/header.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 frontend/src/bundles/common/components/header/header.tsx diff --git a/frontend/src/bundles/common/components/header/header.tsx b/frontend/src/bundles/common/components/header/header.tsx new file mode 100644 index 000000000..96dd5229a --- /dev/null +++ b/frontend/src/bundles/common/components/header/header.tsx @@ -0,0 +1,33 @@ +import { Flex, Text } from '@chakra-ui/react'; + +const Header = (): JSX.Element => { + return ( + + + + Logo + + + + ); +}; + +export { Header }; From af83d0eff837bbc937bc536177580a7757169414 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Mon, 19 Aug 2024 21:36:01 +0300 Subject: [PATCH 03/55] OV-11: + header into app --- frontend/src/app/app.tsx | 7 ++++++- frontend/src/bundles/common/components/components.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/app.tsx b/frontend/src/app/app.tsx index e1f671b35..f7420ca51 100644 --- a/frontend/src/app/app.tsx +++ b/frontend/src/app/app.tsx @@ -1,5 +1,9 @@ import reactLogo from '~/assets/img/react.svg'; -import { Link, RouterOutlet } from '~/bundles/common/components/components.js'; +import { + Header, + Link, + RouterOutlet, +} from '~/bundles/common/components/components.js'; import { AppRoute } from '~/bundles/common/enums/enums.js'; import { useAppDispatch, @@ -27,6 +31,7 @@ const App: React.FC = () => { return ( <> +
logo
    diff --git a/frontend/src/bundles/common/components/components.ts b/frontend/src/bundles/common/components/components.ts index ce95bfe64..9f899df94 100644 --- a/frontend/src/bundles/common/components/components.ts +++ b/frontend/src/bundles/common/components/components.ts @@ -1,4 +1,5 @@ export { Button } from './button/button.js'; +export { Header } from './header/header.js'; export { Input } from './input/input.js'; export { Link } from './link/link.js'; export { RouterProvider } from './router-provider/router-provider.js'; From 89bd1459e02966236595baa3da5e7a6b03eee7d8 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 10:41:25 +0300 Subject: [PATCH 04/55] OV-11: * header component --- frontend/src/bundles/common/components/header/header.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/bundles/common/components/header/header.tsx b/frontend/src/bundles/common/components/header/header.tsx index 96dd5229a..2a0322074 100644 --- a/frontend/src/bundles/common/components/header/header.tsx +++ b/frontend/src/bundles/common/components/header/header.tsx @@ -20,9 +20,9 @@ const Header = (): JSX.Element => { width="full" alignItems="center" maxWidth="1440px" - margin="0 auto" + justifyContent="space-between" > - + Logo From af7193f72d73fb3410eeeb27435cfae1dee1c266 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 11:52:05 +0300 Subject: [PATCH 05/55] OV-18: + Modal component --- .../bundles/common/components/components.ts | 1 + .../bundles/common/components/modal/modal.tsx | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 frontend/src/bundles/common/components/modal/modal.tsx diff --git a/frontend/src/bundles/common/components/components.ts b/frontend/src/bundles/common/components/components.ts index ce95bfe64..f25a0cb03 100644 --- a/frontend/src/bundles/common/components/components.ts +++ b/frontend/src/bundles/common/components/components.ts @@ -1,6 +1,7 @@ export { Button } from './button/button.js'; export { Input } from './input/input.js'; export { Link } from './link/link.js'; +export { Modal } from './modal/modal.js'; export { RouterProvider } from './router-provider/router-provider.js'; export { Box, diff --git a/frontend/src/bundles/common/components/modal/modal.tsx b/frontend/src/bundles/common/components/modal/modal.tsx new file mode 100644 index 000000000..e10682e5d --- /dev/null +++ b/frontend/src/bundles/common/components/modal/modal.tsx @@ -0,0 +1,36 @@ +import { + Modal as ChakraModal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalHeader, + ModalOverlay, +} from '@chakra-ui/react'; +import { type ReactNode } from 'react'; + +type Properties = { + isOpen: boolean; + closeModal: () => void; + title?: string; + children: ReactNode; +}; + +const Modal = ({ + isOpen, + closeModal, + title, + children, +}: Properties): JSX.Element => { + return ( + + + + {title} + + {children} + + + ); +}; + +export { Modal }; From 2faab74eadf7ae442224089171ea459a403a3c71 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 14:36:53 +0300 Subject: [PATCH 06/55] OV-18: + Tab component --- .../libs/components/tab/tab.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/tab/tab.tsx diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/tab/tab.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/tab/tab.tsx new file mode 100644 index 000000000..5853e7885 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/tab/tab.tsx @@ -0,0 +1,15 @@ +import { Tab as ChakraTab } from '@chakra-ui/react'; + +type Properties = { + label: string; +}; + +const Tab = ({ label }: Properties): JSX.Element => { + return ( + + {label} + + ); +}; + +export { Tab }; From d2340b62c4998546619fddcfdb42c6caeecd32c3 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 14:38:45 +0300 Subject: [PATCH 07/55] OV-18: + VideoModalSideBar component --- .../libs/components/components.ts | 1 + .../video-modal-side-bar.tsx | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts new file mode 100644 index 000000000..e5eeec838 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts @@ -0,0 +1 @@ +export { Tab } from './tab/tab.js'; diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx new file mode 100644 index 000000000..3948c46f6 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx @@ -0,0 +1,34 @@ +import { TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'; + +import { Tab } from './libs/components/components.js'; + +const VideoModalSideBar = (): JSX.Element => { + return ( + + + + + + + + +

    one!

    +
    + +

    two!

    +
    + +

    three!

    +
    +
    +
    + ); +}; + +export { VideoModalSideBar }; From fe050edba8c9f8c9d45b80eda562d10276f6113b Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 14:39:42 +0300 Subject: [PATCH 08/55] OV-18: + VideoModal component --- .../components/video-modal/libs/components/components.ts | 1 + .../bundles/common/components/video-modal/video-modal.tsx | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/components.ts create mode 100644 frontend/src/bundles/common/components/video-modal/video-modal.tsx diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/components.ts b/frontend/src/bundles/common/components/video-modal/libs/components/components.ts new file mode 100644 index 000000000..5f623fe39 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/components.ts @@ -0,0 +1 @@ +export { VideoModalSideBar } from './video-modal-side-bar/video-modal-side-bar.js'; diff --git a/frontend/src/bundles/common/components/video-modal/video-modal.tsx b/frontend/src/bundles/common/components/video-modal/video-modal.tsx new file mode 100644 index 000000000..77d5953e6 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/video-modal.tsx @@ -0,0 +1,7 @@ +import { VideoModalSideBar } from './libs/components/components.js'; + +const VideoModal = (): JSX.Element => { + return ; +}; + +export { VideoModal }; From 617444e3b92363e455781395e85c6288fa88a45b Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 14:46:08 +0300 Subject: [PATCH 09/55] OV-11: + conditional rendering --- frontend/src/app/app.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/app.tsx b/frontend/src/app/app.tsx index f7420ca51..309b4baca 100644 --- a/frontend/src/app/app.tsx +++ b/frontend/src/app/app.tsx @@ -31,7 +31,11 @@ const App: React.FC = () => { return ( <> -
    + {pathname === AppRoute.SIGN_UP || + pathname === AppRoute.SIGN_IN ? null : ( +
    + )} + logo
      From cc693ceb776f357053892755fe6400924071a441 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Tue, 20 Aug 2024 15:39:49 +0300 Subject: [PATCH 10/55] OV-11: - header from app --- frontend/src/app/app.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/frontend/src/app/app.tsx b/frontend/src/app/app.tsx index 309b4baca..e1f671b35 100644 --- a/frontend/src/app/app.tsx +++ b/frontend/src/app/app.tsx @@ -1,9 +1,5 @@ import reactLogo from '~/assets/img/react.svg'; -import { - Header, - Link, - RouterOutlet, -} from '~/bundles/common/components/components.js'; +import { Link, RouterOutlet } from '~/bundles/common/components/components.js'; import { AppRoute } from '~/bundles/common/enums/enums.js'; import { useAppDispatch, @@ -31,11 +27,6 @@ const App: React.FC = () => { return ( <> - {pathname === AppRoute.SIGN_UP || - pathname === AppRoute.SIGN_IN ? null : ( -
      - )} - logo
        From cd43f07e5e901df61aaf790e769e8ba3bc19e642 Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Sun, 18 Aug 2024 15:07:06 +0300 Subject: [PATCH 11/55] OV-1: + password input --- frontend/package.json | 1 + .../auth/components/common/components.ts | 1 + .../common/password-input/password-input.tsx | 40 +++++++++++++++++++ .../bundles/common/components/components.ts | 6 +++ .../theme/styles/components.styles.ts | 10 +++++ package-lock.json | 13 ++++++ 6 files changed, 71 insertions(+) create mode 100644 frontend/src/bundles/auth/components/common/components.ts create mode 100644 frontend/src/bundles/auth/components/common/password-input/password-input.tsx diff --git a/frontend/package.json b/frontend/package.json index 881769413..41ff12932 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,7 @@ "vite": "5.4.0" }, "dependencies": { + "@chakra-ui/icons": "2.1.1", "@chakra-ui/react": "2.8.2", "@emotion/react": "11.13.0", "@emotion/styled": "11.13.0", diff --git a/frontend/src/bundles/auth/components/common/components.ts b/frontend/src/bundles/auth/components/common/components.ts new file mode 100644 index 000000000..b5b4684f7 --- /dev/null +++ b/frontend/src/bundles/auth/components/common/components.ts @@ -0,0 +1 @@ +export { PasswordInput } from './password-input/password-input.js'; diff --git a/frontend/src/bundles/auth/components/common/password-input/password-input.tsx b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx new file mode 100644 index 000000000..a87a0e65b --- /dev/null +++ b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx @@ -0,0 +1,40 @@ +import { + IconButton, + Input, + InputGroup, + InputRightElement, + ViewIcon, + ViewOffIcon, +} from '~/bundles/common/components/components.js'; +import { useCallback, useState } from '~/bundles/common/hooks/hooks.js'; + +const PasswordInput: React.FC = () => { + const [showPassword, setShowPassword] = useState(false); + + const handlePasswordIconClick = useCallback((): void => { + setShowPassword((previousShowPassword) => !previousShowPassword); + }, []); + + return ( + + + + : } + onClick={handlePasswordIconClick} + variant="ghostIcon" + /> + + + ); +}; + +export { PasswordInput }; diff --git a/frontend/src/bundles/common/components/components.ts b/frontend/src/bundles/common/components/components.ts index 71c774689..9da09a971 100644 --- a/frontend/src/bundles/common/components/components.ts +++ b/frontend/src/bundles/common/components/components.ts @@ -4,12 +4,18 @@ export { Link } from './link/link.js'; export { Loader } from './loader/loader.js'; export { Overlay } from './overlay/overlay.js'; export { RouterProvider } from './router-provider/router-provider.js'; +export { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'; export { Box, + Center, Circle, ChakraProvider as ComponentsProvider, Flex, Heading, + IconButton, + InputGroup, + InputRightElement, + SimpleGrid, Text, VStack, } from '@chakra-ui/react'; diff --git a/frontend/src/framework/theme/styles/components.styles.ts b/frontend/src/framework/theme/styles/components.styles.ts index 417d40ef9..cb0d05804 100644 --- a/frontend/src/framework/theme/styles/components.styles.ts +++ b/frontend/src/framework/theme/styles/components.styles.ts @@ -78,6 +78,16 @@ const components = { }, }, }, + Button: { + variants: { + ghostIcon: { + color: 'white', + _hover: { + color: 'brand.secondary.300', + }, + }, + }, + }, }; export { components }; diff --git a/package-lock.json b/package-lock.json index 711edfde0..c679dfd41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,6 +71,7 @@ "frontend": { "version": "1.0.0", "dependencies": { + "@chakra-ui/icons": "2.1.1", "@chakra-ui/react": "2.8.2", "@emotion/react": "11.13.0", "@emotion/styled": "11.13.0", @@ -803,6 +804,18 @@ "react": ">=18" } }, + "node_modules/@chakra-ui/icons": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@chakra-ui/icons/-/icons-2.1.1.tgz", + "integrity": "sha512-3p30hdo4LlRZTT5CwoAJq3G9fHI0wDc0pBaMHj4SUn0yomO+RcDRlzhdXqdr5cVnzax44sqXJVnf3oQG0eI+4g==", + "dependencies": { + "@chakra-ui/icon": "3.2.0" + }, + "peerDependencies": { + "@chakra-ui/system": ">=2.0.0", + "react": ">=18" + } + }, "node_modules/@chakra-ui/image": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@chakra-ui/image/-/image-2.1.0.tgz", From aaa8b5d9cfc54bf8b13a847d8b0b736490c2571d Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Sun, 18 Aug 2024 15:24:26 +0300 Subject: [PATCH 12/55] OV-1: + signin validation schema --- .../sign-in-form/constants/constants.ts | 8 +++++ frontend/src/bundles/users/types/types.ts | 1 + frontend/src/bundles/users/users.ts | 6 +++- .../validation-schemas/validation-schemas.ts | 2 +- .../enums/user-validation-message.enum.ts | 3 ++ .../users/enums/user-validation-rule.enum.ts | 5 ++- shared/src/bundles/users/types/types.ts | 1 + .../types/user-sign-in-request-dto.type.ts | 6 ++++ shared/src/bundles/users/users.ts | 6 +++- .../user-sign-in.validation-schema.ts | 36 +++++++++++++++++++ .../validation-schemas/validation-schemas.ts | 1 + shared/src/index.ts | 2 ++ 12 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 frontend/src/bundles/auth/components/sign-in-form/constants/constants.ts create mode 100644 shared/src/bundles/users/types/user-sign-in-request-dto.type.ts create mode 100644 shared/src/bundles/users/validation-schemas/user-sign-in.validation-schema.ts diff --git a/frontend/src/bundles/auth/components/sign-in-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-in-form/constants/constants.ts new file mode 100644 index 000000000..3e3264e83 --- /dev/null +++ b/frontend/src/bundles/auth/components/sign-in-form/constants/constants.ts @@ -0,0 +1,8 @@ +import { type UserSignInRequestDto } from '~/bundles/users/users.js'; + +const DEFAULT_SIGN_IN_PAYLOAD: UserSignInRequestDto = { + email: '', + password: '', +}; + +export { DEFAULT_SIGN_IN_PAYLOAD }; diff --git a/frontend/src/bundles/users/types/types.ts b/frontend/src/bundles/users/types/types.ts index fb8e20c76..0a38e94bf 100644 --- a/frontend/src/bundles/users/types/types.ts +++ b/frontend/src/bundles/users/types/types.ts @@ -1,6 +1,7 @@ export { type UserGetAllItemResponseDto, type UserGetAllResponseDto, + type UserSignInRequestDto, type UserSignUpRequestDto, type UserSignUpResponseDto, } from 'shared'; diff --git a/frontend/src/bundles/users/users.ts b/frontend/src/bundles/users/users.ts index 443083e1c..59ffe28cb 100644 --- a/frontend/src/bundles/users/users.ts +++ b/frontend/src/bundles/users/users.ts @@ -14,7 +14,11 @@ export { userApi }; export { type UserGetAllItemResponseDto, type UserGetAllResponseDto, + type UserSignInRequestDto, type UserSignUpRequestDto, type UserSignUpResponseDto, } from './types/types.js'; -export { userSignUpValidationSchema } from './validation-schemas/validation-schemas.js'; +export { + userSignInValidationSchema, + userSignUpValidationSchema, +} from './validation-schemas/validation-schemas.js'; diff --git a/frontend/src/bundles/users/validation-schemas/validation-schemas.ts b/frontend/src/bundles/users/validation-schemas/validation-schemas.ts index 7bc9a09c5..5952fe0cf 100644 --- a/frontend/src/bundles/users/validation-schemas/validation-schemas.ts +++ b/frontend/src/bundles/users/validation-schemas/validation-schemas.ts @@ -1 +1 @@ -export { userSignUpValidationSchema } from 'shared'; +export { userSignInValidationSchema, userSignUpValidationSchema } from 'shared'; diff --git a/shared/src/bundles/users/enums/user-validation-message.enum.ts b/shared/src/bundles/users/enums/user-validation-message.enum.ts index b28063d96..f369a8c1a 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -1,6 +1,9 @@ const UserValidationMessage = { EMAIL_REQUIRE: 'Email is required', EMAIL_WRONG: 'Email is wrong', + FIELD_REQUIRE: 'Please fill out this field', + EMAIL_INVALID: 'Please enter a valid email', + PASSWORD_LENGTH: 'Password must have from 6 to 12 characters', } as const; export { UserValidationMessage }; diff --git a/shared/src/bundles/users/enums/user-validation-rule.enum.ts b/shared/src/bundles/users/enums/user-validation-rule.enum.ts index 36ca9c2e2..eb7d606aa 100644 --- a/shared/src/bundles/users/enums/user-validation-rule.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-rule.enum.ts @@ -1,5 +1,8 @@ const UserValidationRule = { - EMAIL_MINIMUM_LENGTH: 1, + EMAIL_MINIMUM_LENGTH: 6, + EMAIL_MAXIMUM_LENGTH: 320, + PASSWORD_MINIMUM_LENGTH: 6, + PASSWORD_MAXIMUM_LENGTH: 12, } as const; export { UserValidationRule }; diff --git a/shared/src/bundles/users/types/types.ts b/shared/src/bundles/users/types/types.ts index 7564f70b2..f6fd8caa2 100644 --- a/shared/src/bundles/users/types/types.ts +++ b/shared/src/bundles/users/types/types.ts @@ -1,4 +1,5 @@ export { type UserGetAllItemResponseDto } from './user-get-all-item-response-dto.type.js'; export { type UserGetAllResponseDto } from './user-get-all-response-dto.type.js'; +export { type UserSignInRequestDto } from './user-sign-in-request-dto.type.js'; export { type UserSignUpRequestDto } from './user-sign-up-request-dto.type.js'; export { type UserSignUpResponseDto } from './user-sign-up-response-dto.type.js'; diff --git a/shared/src/bundles/users/types/user-sign-in-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-in-request-dto.type.ts new file mode 100644 index 000000000..8098c64cf --- /dev/null +++ b/shared/src/bundles/users/types/user-sign-in-request-dto.type.ts @@ -0,0 +1,6 @@ +type UserSignInRequestDto = { + email: string; + password: string; +}; + +export { type UserSignInRequestDto }; diff --git a/shared/src/bundles/users/users.ts b/shared/src/bundles/users/users.ts index e65858985..162c57439 100644 --- a/shared/src/bundles/users/users.ts +++ b/shared/src/bundles/users/users.ts @@ -2,7 +2,11 @@ export { UsersApiPath, UserValidationMessage } from './enums/enums.js'; export { type UserGetAllItemResponseDto, type UserGetAllResponseDto, + type UserSignInRequestDto, type UserSignUpRequestDto, type UserSignUpResponseDto, } from './types/types.js'; -export { userSignUp as userSignUpValidationSchema } from './validation-schemas/validation-schemas.js'; +export { + userSignIn as userSignInValidationSchema, + userSignUp as userSignUpValidationSchema, +} from './validation-schemas/validation-schemas.js'; diff --git a/shared/src/bundles/users/validation-schemas/user-sign-in.validation-schema.ts b/shared/src/bundles/users/validation-schemas/user-sign-in.validation-schema.ts new file mode 100644 index 000000000..100cb3dad --- /dev/null +++ b/shared/src/bundles/users/validation-schemas/user-sign-in.validation-schema.ts @@ -0,0 +1,36 @@ +import { z } from 'zod'; + +import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; + +type UserSignInRequestValidationDto = { + email: z.ZodString; + password: z.ZodString; +}; + +const userSignIn = z + .object({ + email: z + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) + .trim() + .min(UserValidationRule.EMAIL_MINIMUM_LENGTH, { + message: UserValidationMessage.EMAIL_INVALID, + }) + .max(UserValidationRule.EMAIL_MAXIMUM_LENGTH, { + message: UserValidationMessage.EMAIL_INVALID, + }) + .email({ + message: UserValidationMessage.EMAIL_INVALID, + }), + password: z + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) + .trim() + .min(UserValidationRule.PASSWORD_MINIMUM_LENGTH, { + message: UserValidationMessage.PASSWORD_LENGTH, + }) + .max(UserValidationRule.PASSWORD_MAXIMUM_LENGTH, { + message: UserValidationMessage.PASSWORD_LENGTH, + }), + }) + .required(); + +export { userSignIn }; diff --git a/shared/src/bundles/users/validation-schemas/validation-schemas.ts b/shared/src/bundles/users/validation-schemas/validation-schemas.ts index cb1c2ad60..f6c85f13c 100644 --- a/shared/src/bundles/users/validation-schemas/validation-schemas.ts +++ b/shared/src/bundles/users/validation-schemas/validation-schemas.ts @@ -1 +1,2 @@ +export { userSignIn } from './user-sign-in.validation-schema.js'; export { userSignUp } from './user-sign-up.validation-schema.js'; diff --git a/shared/src/index.ts b/shared/src/index.ts index df887038b..a0f2d2c57 100644 --- a/shared/src/index.ts +++ b/shared/src/index.ts @@ -2,9 +2,11 @@ export { AuthApiPath } from './bundles/auth/auth.js'; export { type UserGetAllItemResponseDto, type UserGetAllResponseDto, + type UserSignInRequestDto, type UserSignUpRequestDto, type UserSignUpResponseDto, UsersApiPath, + userSignInValidationSchema, userSignUpValidationSchema, } from './bundles/users/users.js'; export { From 9ecc8efbd9c75db7ce9c59e4049b9e2e4c5a593f Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Sun, 18 Aug 2024 15:26:32 +0300 Subject: [PATCH 13/55] OV-1: + button customization --- .../src/framework/theme/styles/components.styles.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/framework/theme/styles/components.styles.ts b/frontend/src/framework/theme/styles/components.styles.ts index cb0d05804..a64bd5171 100644 --- a/frontend/src/framework/theme/styles/components.styles.ts +++ b/frontend/src/framework/theme/styles/components.styles.ts @@ -80,6 +80,16 @@ const components = { }, Button: { variants: { + solid: { + color: 'white', + bgColor: 'brand.secondary.300', + _hover: { + bg: 'brand.secondary.600', + _disabled: { + bg: 'brand.secondary.600', + }, + }, + }, ghostIcon: { color: 'white', _hover: { From e7e9112f88ae169148cb9272a21bcedb04f9c680 Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Sun, 18 Aug 2024 15:51:16 +0300 Subject: [PATCH 14/55] OV-1: * signin form --- .../common/password-input/password-input.tsx | 10 ++- .../components/sign-in-form/sign-in-form.tsx | 64 ++++++++++++++++--- .../common/components/button/button.tsx | 11 +++- 3 files changed, 70 insertions(+), 15 deletions(-) diff --git a/frontend/src/bundles/auth/components/common/password-input/password-input.tsx b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx index a87a0e65b..2a2252066 100644 --- a/frontend/src/bundles/auth/components/common/password-input/password-input.tsx +++ b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx @@ -8,7 +8,11 @@ import { } from '~/bundles/common/components/components.js'; import { useCallback, useState } from '~/bundles/common/hooks/hooks.js'; -const PasswordInput: React.FC = () => { +type Properties = { + hasError: boolean; +}; + +const PasswordInput: React.FC = ({ hasError }) => { const [showPassword, setShowPassword] = useState(false); const handlePasswordIconClick = useCallback((): void => { @@ -16,14 +20,14 @@ const PasswordInput: React.FC = () => { }, []); return ( - + - + void; + onSubmit: (payload: UserSignInRequestDto) => void; }; -const SignInForm: React.FC = () => ( - <> - Sign In +const SignInForm: React.FC = ({ onSubmit }) => { + const form = useAppForm({ + initialValues: DEFAULT_SIGN_IN_PAYLOAD, + validationSchema: userSignInValidationSchema, + onSubmit, + }); + + const { handleSubmit, errors } = form; -
        -
        + + + + ); +}; + +export { VideoPreview }; From 742e62ab7a0a112c72ff29a1422722d9fdd5f8a1 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 10:09:48 +0300 Subject: [PATCH 41/55] OV-18: + exports --- .../video-modal-content/libs/components/components.ts | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/components.ts diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/components.ts b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/components.ts new file mode 100644 index 000000000..d179bd19c --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/components.ts @@ -0,0 +1,2 @@ +export { Tab } from './tab/tab.js'; +export { VideoPreview } from './video-preview/video-preview.js'; From 0dbf2cedf56d39a9d2d44c6a0d05fadc91c4c590 Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 10:11:18 +0300 Subject: [PATCH 42/55] OV-18: - old files --- .../bundles/common/components/modal/modal.tsx | 36 ------------------- .../libs/components/components.ts | 1 - .../video-modal-side-bar.tsx | 34 ------------------ 3 files changed, 71 deletions(-) delete mode 100644 frontend/src/bundles/common/components/modal/modal.tsx delete mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts delete mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx diff --git a/frontend/src/bundles/common/components/modal/modal.tsx b/frontend/src/bundles/common/components/modal/modal.tsx deleted file mode 100644 index e10682e5d..000000000 --- a/frontend/src/bundles/common/components/modal/modal.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { - Modal as ChakraModal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalHeader, - ModalOverlay, -} from '@chakra-ui/react'; -import { type ReactNode } from 'react'; - -type Properties = { - isOpen: boolean; - closeModal: () => void; - title?: string; - children: ReactNode; -}; - -const Modal = ({ - isOpen, - closeModal, - title, - children, -}: Properties): JSX.Element => { - return ( - - - - {title} - - {children} - - - ); -}; - -export { Modal }; diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts deleted file mode 100644 index e5eeec838..000000000 --- a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/libs/components/components.ts +++ /dev/null @@ -1 +0,0 @@ -export { Tab } from './tab/tab.js'; diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx deleted file mode 100644 index 3948c46f6..000000000 --- a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-side-bar/video-modal-side-bar.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'; - -import { Tab } from './libs/components/components.js'; - -const VideoModalSideBar = (): JSX.Element => { - return ( - - - - - - - - -

        one!

        -
        - -

        two!

        -
        - -

        three!

        -
        -
        -
        - ); -}; - -export { VideoModalSideBar }; From 68796b7cfae4964828c834b6acf7bd79648b094c Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 10:12:34 +0300 Subject: [PATCH 43/55] OV-18: + VideoModalContent component --- .../video-modal/libs/components/components.ts | 2 +- .../video-modal-content.tsx | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/video-modal-content.tsx diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/components.ts b/frontend/src/bundles/common/components/video-modal/libs/components/components.ts index 5f623fe39..9ba9d1e9d 100644 --- a/frontend/src/bundles/common/components/video-modal/libs/components/components.ts +++ b/frontend/src/bundles/common/components/video-modal/libs/components/components.ts @@ -1 +1 @@ -export { VideoModalSideBar } from './video-modal-side-bar/video-modal-side-bar.js'; +export { VideoModalContent } from './video-modal-content/video-modal-content.js'; diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/video-modal-content.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/video-modal-content.tsx new file mode 100644 index 000000000..01524e5a7 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/video-modal-content.tsx @@ -0,0 +1,24 @@ +import { TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'; + +import { Tab, VideoPreview } from './libs/components/components.js'; + +const VideoModalContent = (): JSX.Element => { + return ( + + + + + + + + + + + ); +}; + +export { VideoModalContent }; From d2bec02e2ff5dbb6c612dd0478fea4204607485c Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 10:13:52 +0300 Subject: [PATCH 44/55] OV-18: + VideoModal component --- .../bundles/common/components/components.ts | 1 + .../components/video-modal/video-modal.tsx | 45 +++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/frontend/src/bundles/common/components/components.ts b/frontend/src/bundles/common/components/components.ts index c453d5f1a..82afbde76 100644 --- a/frontend/src/bundles/common/components/components.ts +++ b/frontend/src/bundles/common/components/components.ts @@ -4,6 +4,7 @@ export { Link } from './link/link.js'; export { Loader } from './loader/loader.js'; export { Overlay } from './overlay/overlay.js'; export { RouterProvider } from './router-provider/router-provider.js'; +export { VideoModal } from './video-modal/video-modal.js'; export { Box, ChakraProvider as ComponentsProvider, diff --git a/frontend/src/bundles/common/components/video-modal/video-modal.tsx b/frontend/src/bundles/common/components/video-modal/video-modal.tsx index 77d5953e6..934ca60c9 100644 --- a/frontend/src/bundles/common/components/video-modal/video-modal.tsx +++ b/frontend/src/bundles/common/components/video-modal/video-modal.tsx @@ -1,7 +1,46 @@ -import { VideoModalSideBar } from './libs/components/components.js'; +import { + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalHeader, + ModalOverlay, +} from '@chakra-ui/react'; -const VideoModal = (): JSX.Element => { - return ; +import { VideoModalContent } from './libs/components/components.js'; + +type Properties = { + isOpen: boolean; + closeModal: () => void; +}; + +const VideoModal = ({ isOpen, closeModal }: Properties): JSX.Element => { + return ( + + + + + Create video + + + + + + + + ); }; export { VideoModal }; From 2e8f11a0a3acede6c43683ea4aef8f15f242ddb2 Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Wed, 21 Aug 2024 10:52:23 +0300 Subject: [PATCH 45/55] OV-27: + chakra icons --- frontend/package.json | 1 + package-lock.json | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/frontend/package.json b/frontend/package.json index 881769413..41ff12932 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,7 @@ "vite": "5.4.0" }, "dependencies": { + "@chakra-ui/icons": "2.1.1", "@chakra-ui/react": "2.8.2", "@emotion/react": "11.13.0", "@emotion/styled": "11.13.0", diff --git a/package-lock.json b/package-lock.json index 711edfde0..c679dfd41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,6 +71,7 @@ "frontend": { "version": "1.0.0", "dependencies": { + "@chakra-ui/icons": "2.1.1", "@chakra-ui/react": "2.8.2", "@emotion/react": "11.13.0", "@emotion/styled": "11.13.0", @@ -803,6 +804,18 @@ "react": ">=18" } }, + "node_modules/@chakra-ui/icons": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@chakra-ui/icons/-/icons-2.1.1.tgz", + "integrity": "sha512-3p30hdo4LlRZTT5CwoAJq3G9fHI0wDc0pBaMHj4SUn0yomO+RcDRlzhdXqdr5cVnzax44sqXJVnf3oQG0eI+4g==", + "dependencies": { + "@chakra-ui/icon": "3.2.0" + }, + "peerDependencies": { + "@chakra-ui/system": ">=2.0.0", + "react": ">=18" + } + }, "node_modules/@chakra-ui/image": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@chakra-ui/image/-/image-2.1.0.tgz", From a6158d4f05a84e0d8a3d649abd8ea4d65c912c2a Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 11:29:38 +0300 Subject: [PATCH 46/55] OV-18: + enum --- .../libs/components/video-preview/libs/enums/enums.ts | 1 + .../components/video-preview/libs/enums/video-sizes.enum.ts | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/video-sizes.enum.ts diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/enums.ts b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/enums.ts index 42f29f46e..9a2f32d26 100644 --- a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/enums.ts +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/enums.ts @@ -1 +1,2 @@ export { VideoPreview } from './video-preview.enum.js'; +export { VideoSizeLabel } from './video-sizes.enum.js'; diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/video-sizes.enum.ts b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/video-sizes.enum.ts new file mode 100644 index 000000000..8be9ed814 --- /dev/null +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/libs/enums/video-sizes.enum.ts @@ -0,0 +1,6 @@ +const VideoSizeLabel = { + PORTRAIT: '1080 x 1920', + LANDSCAPE: '1920 x 1080', +} as const; + +export { VideoSizeLabel }; From 8270db92ea18df1027cd3ab9b59a037966facadf Mon Sep 17 00:00:00 2001 From: Sergiy Date: Wed, 21 Aug 2024 11:31:21 +0300 Subject: [PATCH 47/55] OV-18: + icon --- .../libs/components/tab/tab.tsx | 13 +++++-- .../video-preview/video-preview.tsx | 36 +++++++++++++------ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/tab/tab.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/tab/tab.tsx index 1459629a9..ea8761154 100644 --- a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/tab/tab.tsx +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/tab/tab.tsx @@ -1,10 +1,13 @@ -import { Tab as ChakraTab } from '@chakra-ui/react'; +import { Icon, Tab as ChakraTab } from '@chakra-ui/react'; +import { type IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; type Properties = { label: string; + icon: IconDefinition; }; -const Tab = ({ label }: Properties): JSX.Element => { +const Tab = ({ label, icon }: Properties): JSX.Element => { return ( { textAlign="left" _selected={{ backgroundColor: 'gray.300' }} > + {' '} {label} ); diff --git a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/video-preview.tsx b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/video-preview.tsx index a86514b0c..8586316f2 100644 --- a/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/video-preview.tsx +++ b/frontend/src/bundles/common/components/video-modal/libs/components/video-modal-content/libs/components/video-preview/video-preview.tsx @@ -1,7 +1,12 @@ -import { Box, Button, Flex, Text } from '@chakra-ui/react'; +import { Button, Flex, Icon, Text } from '@chakra-ui/react'; +import { faPlay } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { useCallback, useState } from 'react'; -import { VideoPreview as VideoPreviewValues } from './libs/enums/enums.js'; +import { + VideoPreview as VideoPreviewValues, + VideoSizeLabel, +} from './libs/enums/enums.js'; import { type VideoPreview as VideoPreviewType } from './libs/types/types.js'; const VideoPreview = (): JSX.Element => { @@ -19,23 +24,34 @@ const VideoPreview = (): JSX.Element => { return ( - - - {view === VideoPreviewValues.PORTRAIT - ? '1080 x 1920' - : '1920 x 1080'} - - + + + + {view === VideoPreviewValues.PORTRAIT + ? VideoSizeLabel.PORTRAIT + : VideoSizeLabel.LANDSCAPE} + + +