diff --git a/front/app-build.json b/front/app-build.json deleted file mode 100644 index a40b0e3..0000000 --- a/front/app-build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "display": "2025-02-09", - "version": "0.0.1-dev\n - 2025-02-09T21:15:14+01:00", - "commit": "0.0.1-dev\n", - "date": "2025-02-09T21:15:14+01:00" -} \ No newline at end of file diff --git a/front/build.js b/front/build.js index 9d5de91..e69de29 100644 --- a/front/build.js +++ b/front/build.js @@ -1,25 +0,0 @@ -const dayjs = require('dayjs'); - -const fs = require('fs'); - -const generateAppBuild = () => { - const getVersion = () => fs.readFileSync('version.txt', 'utf8'); - - const commit = process.env.VERCEL_GIT_COMMIT_SHA - ? process.env.VERCEL_GIT_COMMIT_SHA - : getVersion(); - - const appBuildContent = { - display: `${dayjs().format('YYYY-MM-DD')}`, - version: `${commit} - ${dayjs().format()}`, - commit, - date: dayjs().format(), - }; - - fs.writeFileSync( - './app-build.json', - JSON.stringify(appBuildContent, null, 2) - ); -}; - -generateAppBuild(); diff --git a/front/knip.ts b/front/knip.ts index daacfa2..48f7f68 100644 --- a/front/knip.ts +++ b/front/knip.ts @@ -7,11 +7,6 @@ const config: KnipConfig = { // Related to tests 'tests/**', '**.conf.js', - 'steps.d.ts', - 'steps_file.js', - 'env_ci/codecept.conf.js', - // Generic components are useful. - 'src/components/**', ], }; diff --git a/front/package.json b/front/package.json index 2bf25e6..36c4731 100644 --- a/front/package.json +++ b/front/package.json @@ -18,7 +18,7 @@ "test": "vitest run", "test:watch": "vitest watch", "build": "tsc && vite build", - "static:build": "node build.js && pnpm build", + "static:build": "pnpm build", "dev": "vite", "pretty": "prettier -w .", "lint": "pnpm tsc --noEmit", diff --git a/front/src/App.tsx b/front/src/App.tsx index 7af6ff7..2b0f719 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -1,9 +1,9 @@ -import { EnvDevelopment } from './components/EnvDevelopment/EnvDevelopment'; - import { ErrorBoundary } from '@/errors/ErrorBoundary'; import { AppRoutes } from '@/scene/AppRoutes'; import { ServiceContextProvider } from '@/service/ServiceContext'; +import { EnvDevelopment } from './components/EnvDevelopment/EnvDevelopment'; + export const App = () => { return ( diff --git a/front/src/components/Cover.tsx b/front/src/components/Cover.tsx index 12e8ffe..5bff6da 100644 --- a/front/src/components/Cover.tsx +++ b/front/src/components/Cover.tsx @@ -3,13 +3,14 @@ import { ReactElement, useEffect, useState } from 'react'; import { Box, BoxProps, Flex, FlexProps } from '@chakra-ui/react'; import { Image } from '@chakra-ui/react'; -import { DataUrlAccess } from '@/utils/data-url-access'; -import { Icon } from './Icon'; import { ObjectId } from '@/back-api'; +import { DataUrlAccess } from '@/utils/data-url-access'; -export type CoversProps = Omit & { +import { Icon } from './Icon'; + +export type CoversProps = Omit & { data?: ObjectId[]; - size?: BoxProps["width"]; + size?: BoxProps['width']; iconEmpty?: ReactElement; slideshow?: boolean; }; @@ -33,7 +34,9 @@ export const Covers = ({ setPreviousImageIndex(currentImageIndex); setTopOpacity(0.0); setTimeout(() => { - setCurrentImageIndex((prevIndex) => (prevIndex + 1) % (data?.length ?? 1)); + setCurrentImageIndex( + (prevIndex) => (prevIndex + 1) % (data?.length ?? 1) + ); setTopOpacity(1.0); }, 1500); }, 3000); @@ -60,40 +63,50 @@ export const Covers = ({ } if (slideshow === false || data.length === 1) { const url = DataUrlAccess.getThumbnailUrl(data[0]); - return ; + return ( + + ); } const urlCurrent = DataUrlAccess.getThumbnailUrl(data[currentImageIndex]); const urlPrevious = DataUrlAccess.getThumbnailUrl(data[previousImageIndex]); - return - - - + return ( + + + + + ); }; diff --git a/front/src/components/EmptyEnd.tsx b/front/src/components/EmptyEnd.tsx index e054f6c..b49ff24 100644 --- a/front/src/components/EmptyEnd.tsx +++ b/front/src/components/EmptyEnd.tsx @@ -6,8 +6,8 @@ export const EmptyEnd = () => { width="full" height="25%" minHeight="250px" - // borderWidth="1px" - // borderColor="red" + // borderWidth="1px" + // borderColor="red" > ); }; diff --git a/front/src/components/EnvDevelopment/EnvDevelopment.tsx b/front/src/components/EnvDevelopment/EnvDevelopment.tsx index a6f57de..6f5f5be 100644 --- a/front/src/components/EnvDevelopment/EnvDevelopment.tsx +++ b/front/src/components/EnvDevelopment/EnvDevelopment.tsx @@ -1,40 +1,39 @@ - import { Box, Button, - createListCollection, Dialog, Select, Span, Stack, Text, + createListCollection, useDisclosure, } from '@chakra-ui/react'; -import { useSessionService } from '@/service/session'; import { useLogin } from '@/scene/connection/useLogin'; +import { useSessionService } from '@/service/session'; export const USERS_COLLECTION = createListCollection({ items: [ - { label: "karadmin", value: "adminA@666" }, - { label: "karuser", value: "userA@666" }, - { label: "NO_USER", value: "" }, + { label: 'karadmin', value: 'adminA@666' }, + { label: 'karuser', value: 'userA@666' }, + { label: 'NO_USER', value: '' }, ], -}) +}); export const EnvDevelopment = () => { const dialog = useDisclosure(); - const {clearToken} = useSessionService(); - const {connect, lastError} = useLogin(); - + const { clearToken } = useSessionService(); + const { connect, lastError } = useLogin(); + const buildEnv = process.env.NODE_ENV === 'development' ? 'Development' : import.meta.env.VITE_DEV_ENV_NAME; - const envName: Array = []; + const envName: Array = []; !!buildEnv && envName.push(buildEnv); - + if (!envName.length) { return null; } @@ -77,23 +76,32 @@ export const EnvDevelopment = () => { > {envName.join(' : ')} - + - + Development tools - User {lastError} + + User{' '} + + {lastError} + + {USERS_COLLECTION.items.map((value) => ( - handleChange(value.label, value.value)} > + handleChange(value.label, value.value)} + > {value.label} ))} @@ -110,4 +118,3 @@ export const EnvDevelopment = () => { ); }; - diff --git a/front/src/components/Icon.tsx b/front/src/components/Icon.tsx index 1e8d8d5..b5c5ed8 100644 --- a/front/src/components/Icon.tsx +++ b/front/src/components/Icon.tsx @@ -1,41 +1,40 @@ -import { - Box, - Flex, - FlexProps, -} from '@chakra-ui/react'; -import { forwardRef, ReactNode } from 'react'; +import { ReactNode, forwardRef } from 'react'; + +import { Box, Flex, FlexProps } from '@chakra-ui/react'; export type IconProps = FlexProps & { - children: ReactNode; - color?: string; - sizeIcon?: FlexProps['width']; + children: ReactNode; + color?: string; + sizeIcon?: FlexProps['width']; }; export const Icon = forwardRef( - ({ children, color, sizeIcon = '1em', ...rest }, ref) => { - return ( - - - {children} - - - ); - } + ({ children, color, sizeIcon = '1em', ...rest }, ref) => { + return ( + + + {children} + + + ); + } ); Icon.displayName = 'Icon'; diff --git a/front/src/components/Layout/PageLayoutInfoCenter.tsx b/front/src/components/Layout/PageLayoutInfoCenter.tsx index e0f518e..cf040a2 100644 --- a/front/src/components/Layout/PageLayoutInfoCenter.tsx +++ b/front/src/components/Layout/PageLayoutInfoCenter.tsx @@ -4,8 +4,8 @@ import { Flex, FlexProps } from '@chakra-ui/react'; import { useLocation } from 'react-router-dom'; import { PageLayout } from '@/components/Layout/PageLayout'; -import { colors } from '@/theme/colors'; import { useColorModeValue } from '@/components/ui/color-mode'; +import { colors } from '@/theme/colors'; export type LayoutProps = FlexProps & { children: ReactNode; diff --git a/front/src/components/ParameterLayout/ParameterLayout.ts b/front/src/components/ParameterLayout/ParameterLayout.ts index 457a246..14e80e2 100644 --- a/front/src/components/ParameterLayout/ParameterLayout.ts +++ b/front/src/components/ParameterLayout/ParameterLayout.ts @@ -1,22 +1,20 @@ - export { - ParameterLayoutContent as Content, - type ParameterLayoutContentProps as ContentProps + ParameterLayoutContent as Content, + type ParameterLayoutContentProps as ContentProps, } from './ParameterLayoutContent'; export { - ParameterLayoutFooter as Footer, - type ParameterLayoutFooterProps as FooterProps + ParameterLayoutFooter as Footer, + type ParameterLayoutFooterProps as FooterProps, } from './ParameterLayoutFooter'; export { - ParameterLayoutHeader as Header, - type ParameterLayoutHeaderProps as HeaderProps + ParameterLayoutHeader as Header, + type ParameterLayoutHeaderProps as HeaderProps, } from './ParameterLayoutHeader'; export { - ParameterLayoutHeaderBase as HeaderBase, - type ParameterLayoutHeaderBaseProps as HeaderBaseProps + ParameterLayoutHeaderBase as HeaderBase, + type ParameterLayoutHeaderBaseProps as HeaderBaseProps, } from './ParameterLayoutHeaderBase'; export { - ParameterLayoutRoot as Root, - type ParameterLayoutRootProps as RootProps + ParameterLayoutRoot as Root, + type ParameterLayoutRootProps as RootProps, } from './ParameterLayoutRoot'; - diff --git a/front/src/components/ParameterLayout/ParameterLayoutContent.tsx b/front/src/components/ParameterLayout/ParameterLayoutContent.tsx index dbb01d8..32c538d 100644 --- a/front/src/components/ParameterLayout/ParameterLayoutContent.tsx +++ b/front/src/components/ParameterLayout/ParameterLayoutContent.tsx @@ -1,19 +1,25 @@ -import { Flex } from "@chakra-ui/react"; -import { ReactNode } from "react"; +import { ReactNode } from 'react'; + +import { Flex } from '@chakra-ui/react'; export type ParameterLayoutContentProps = { - children?:ReactNode; -} + children?: ReactNode; +}; -export const ParameterLayoutContent = ({children}:ParameterLayoutContentProps) => { - return { + return ( + - {children} + background="gray.700" + > + {children} -} + ); +}; diff --git a/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx b/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx index fed27e2..24945f8 100644 --- a/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx +++ b/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx @@ -1,16 +1,17 @@ -import { Flex } from "@chakra-ui/react"; -import { ReactNode } from "react"; +import { ReactNode } from 'react'; + +import { Flex } from '@chakra-ui/react'; export type ParameterLayoutFooterProps = { - children?: ReactNode; -} + children?: ReactNode; +}; -export const ParameterLayoutFooter = ({children}:ParameterLayoutFooterProps) => { - return - {children} +export const ParameterLayoutFooter = ({ + children, +}: ParameterLayoutFooterProps) => { + return ( + + {children} -} + ); +}; diff --git a/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx b/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx index 47adf20..c9f7e6e 100644 --- a/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx +++ b/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx @@ -1,17 +1,17 @@ -import { Flex } from "@chakra-ui/react"; -import { ReactNode } from "react"; +import { ReactNode } from 'react'; + +import { Flex } from '@chakra-ui/react'; export type ParameterLayoutHeaderProps = { - children?:ReactNode; -} + children?: ReactNode; +}; -export const ParameterLayoutHeader = ({children}:ParameterLayoutHeaderProps) => { - return - {children} +export const ParameterLayoutHeader = ({ + children, +}: ParameterLayoutHeaderProps) => { + return ( + + {children} -} + ); +}; diff --git a/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx b/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx index 51ee1b9..4cfda4a 100644 --- a/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx +++ b/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx @@ -1,23 +1,24 @@ -import { Flex, Text } from "@chakra-ui/react"; -import { ParameterLayoutHeader } from "./ParameterLayoutHeader"; +import { Flex, Text } from '@chakra-ui/react'; + +import { ParameterLayoutHeader } from './ParameterLayoutHeader'; export type ParameterLayoutHeaderBaseProps = { - title:string; - description?: string, -} + title: string; + description?: string; +}; export const ParameterLayoutHeaderBase = ({ - title, - description, -}:ParameterLayoutHeaderBaseProps) => { - return - - - {title} + title, + description, +}: ParameterLayoutHeaderBaseProps) => { + return ( + + + + {title} {description && {description}} - + -} + ); +}; diff --git a/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx b/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx index 989a58f..93b7952 100644 --- a/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx +++ b/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx @@ -1,17 +1,24 @@ - -import { VStack } from '@chakra-ui/react'; import { ReactNode } from 'react'; -export type ParameterLayoutRootProps = { - children?: ReactNode; -} +import { VStack } from '@chakra-ui/react'; -export const ParameterLayoutRoot = ({children}:ParameterLayoutRootProps) => { - return - {children} +export type ParameterLayoutRootProps = { + children?: ReactNode; +}; + +export const ParameterLayoutRoot = ({ children }: ParameterLayoutRootProps) => { + return ( + + {children} -} + ); +}; diff --git a/front/src/components/SearchInput.tsx b/front/src/components/SearchInput.tsx index 046c516..c528629 100644 --- a/front/src/components/SearchInput.tsx +++ b/front/src/components/SearchInput.tsx @@ -1,9 +1,6 @@ import { useState } from 'react'; -import { - Group, - Input, -} from '@chakra-ui/react'; +import { Group, Input } from '@chakra-ui/react'; import { MdSearch } from 'react-icons/md'; export type SearchInputProps = { diff --git a/front/src/components/TopBar/TopBar.tsx b/front/src/components/TopBar/TopBar.tsx index 80a068f..49cfb85 100644 --- a/front/src/components/TopBar/TopBar.tsx +++ b/front/src/components/TopBar/TopBar.tsx @@ -2,15 +2,15 @@ import { ReactNode } from 'react'; import { Box, + Button, + ConditionalValue, Flex, HStack, IconButton, - Text, - useDisclosure, - Button, - ConditionalValue, Span, + Text, chakra, + useDisclosure, } from '@chakra-ui/react'; import { LuAlignJustify, @@ -22,13 +22,18 @@ import { LuSettings, LuSun, } from 'react-icons/lu'; +import { + MdHelp, + MdHome, + MdKey, + MdMore, + MdOutlineDashboardCustomize, + MdOutlineGroup, + MdSettings, + MdSupervisedUserCircle, +} from 'react-icons/md'; import { useNavigate } from 'react-router-dom'; -import { useServiceContext } from '@/service/ServiceContext'; -import { colors } from '@/theme/colors'; -import { useSessionService } from '@/service/session'; -import { MdHelp, MdHome, MdKey, MdMore, MdOutlineDashboardCustomize, MdOutlineGroup, MdSettings, MdSupervisedUserCircle } from 'react-icons/md'; -import { MenuContent, MenuItem, MenuRoot, MenuTrigger } from '@/components/ui/menu'; import { useColorMode, useColorModeValue } from '@/components/ui/color-mode'; import { DrawerBody, @@ -36,47 +41,68 @@ import { DrawerHeader, DrawerRoot, } from '@/components/ui/drawer'; +import { + MenuContent, + MenuItem, + MenuRoot, + MenuTrigger, +} from '@/components/ui/menu'; +import { useServiceContext } from '@/service/ServiceContext'; +import { useSessionService } from '@/service/session'; +import { colors } from '@/theme/colors'; export const TOP_BAR_HEIGHT = '50px'; export const BUTTON_TOP_BAR_PROPERTY = { - variant: "ghost" as ConditionalValue<"ghost" | "outline" | "solid" | "subtle" | "surface" | "plain" | undefined>, + variant: 'ghost' as ConditionalValue< + 'ghost' | 'outline' | 'solid' | 'subtle' | 'surface' | 'plain' | undefined + >, //colorPalette: "brand", fontSize: '20px', textTransform: 'uppercase', height: TOP_BAR_HEIGHT, }; - + export type TopBarProps = { children?: ReactNode; title?: string; }; - -const ButtonMenuLeft = ({ dest, title, icon, - onClickEnd = () => { }, }: { - dest: string, title: string, icon: ReactNode - onClickEnd?: () => void; - }) => { + +const ButtonMenuLeft = ({ + dest, + title, + icon, + onClickEnd = () => {}, +}: { + dest: string; + title: string; + icon: ReactNode; + onClickEnd?: () => void; +}) => { const navigate = useNavigate(); - return <> - - - -} + return ( + <> + + + + ); +}; export const TopBar = ({ title, children }: TopBarProps) => { const { colorMode, toggleColorMode } = useColorMode(); @@ -138,7 +164,10 @@ export const TopBar = ({ title, children }: TopBarProps) => { {!session?.token && ( <> - - + {elements?.map((data) => ( - + {data.icon} {data.name} ))} - + ); }; diff --git a/front/src/components/form/FormInput.tsx b/front/src/components/form/FormInput.tsx index f119f95..fe0bead 100644 --- a/front/src/components/form/FormInput.tsx +++ b/front/src/components/form/FormInput.tsx @@ -3,6 +3,7 @@ import { RefObject } from 'react'; import { Input } from '@chakra-ui/react'; import { FormGroup, FormGroupProps } from '@/components/form/FormGroup'; + import { useFormidableContextElement } from '../formidable'; export type FormInputProps = { @@ -19,12 +20,9 @@ export const FormInput = ({ placeholder, ...rest }: FormInputProps) => { - const {value, onChange} = useFormidableContextElement(name); + const { value, onChange } = useFormidableContextElement(name); return ( - + + /> ); diff --git a/front/src/components/form/FormSelectMultiple.stories.tsx b/front/src/components/form/FormSelectMultiple.stories.tsx index 57ad1d3..f122721 100644 --- a/front/src/components/form/FormSelectMultiple.stories.tsx +++ b/front/src/components/form/FormSelectMultiple.stories.tsx @@ -4,6 +4,7 @@ import { Box } from '@chakra-ui/react'; import { FormSelectMultiple } from '@/components/form/FormSelectMultiple'; import { useFormidable } from '@/components/formidable/FormidableConfig'; + import { Formidable } from '../formidable'; export default { @@ -58,7 +59,7 @@ export const ChangeName = () => { { id: 222, name: 'Second Item' }, { id: 333, name: 'third item' }, ]} - /> + /> ); }; diff --git a/front/src/components/formidable/Fromidable.tsx b/front/src/components/formidable/Fromidable.tsx index 84f931e..0d6a793 100644 --- a/front/src/components/formidable/Fromidable.tsx +++ b/front/src/components/formidable/Fromidable.tsx @@ -1,6 +1,8 @@ -export {type FormidableConfig as config, -useFormidable +export { + type FormidableConfig as config, + useFormidable, } from './FormidableConfig'; -export {FormidableForm as From, - type FormidableFormProps as FormProps -} from './FormidableForm'; \ No newline at end of file +export { + FormidableForm as From, + type FormidableFormProps as FormProps, +} from './FormidableForm'; diff --git a/front/src/components/formidable/index.ts b/front/src/components/formidable/index.ts index 89b95a4..33962ae 100644 --- a/front/src/components/formidable/index.ts +++ b/front/src/components/formidable/index.ts @@ -1,11 +1,7 @@ export * as Formidable from './Fromidable'; export { - useFormidableContext, - useFormidableContextElement -} from './FormidableContext' -export { - useFormidable -} from './FormidableConfig'; -export { - zodResolver -} from './utils'; \ No newline at end of file + useFormidableContext, + useFormidableContextElement, +} from './FormidableContext'; +export { useFormidable } from './FormidableConfig'; +export { zodResolver } from './utils'; diff --git a/front/src/components/popup/ConfirmPopUp.tsx b/front/src/components/popup/ConfirmPopUp.tsx index 0540128..caf149c 100644 --- a/front/src/components/popup/ConfirmPopUp.tsx +++ b/front/src/components/popup/ConfirmPopUp.tsx @@ -1,11 +1,15 @@ import { useRef } from 'react'; -import { - Button, - UseDisclosureReturn, -} from '@chakra-ui/react'; +import { Button, UseDisclosureReturn } from '@chakra-ui/react'; + +import { + DialogBody, + DialogContent, + DialogFooter, + DialogHeader, + DialogRoot, +} from '@/components/ui/dialog'; -import { DialogBody, DialogContent, DialogFooter, DialogHeader, DialogRoot } from '@/components/ui/dialog'; export type ConfirmPopUpProps = { title: string; body: string; @@ -27,7 +31,8 @@ export const ConfirmPopUp = ({ }; const cancelRef = useRef(null); return ( - { - onCreate(data); - setCurrentSearch(undefined); - }; + onCreate(data); + setCurrentSearch(undefined); + }; return ( {selectedOptions && ( - + {selectedOptions.map((data) => ( {data[keyValue] ?? `id=${data[keyKey]}`} - selectValue(data)} /> + selectValue(data)} + /> ))} @@ -134,7 +143,13 @@ export const SelectMultiple = ({ //onSubmit={onSubmit} onFocus={() => setShowList(true)} onBlur={() => setTimeout(() => setShowList(false), 200)} - value={showList ? (currentSearch ?? '') : hasSuggestion ? `suggest: ${currentSearch}` : ''} + value={ + showList + ? (currentSearch ?? '') + : hasSuggestion + ? `suggest: ${currentSearch}` + : '' + } borderRadius="5px 0 0 5px" />