diff --git a/front/src/components/ParameterLayout/ParameterLayout.ts b/front/src/components/ParameterLayout/ParameterLayout.ts new file mode 100644 index 0000000..457a246 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayout.ts @@ -0,0 +1,22 @@ + +export { + ParameterLayoutContent as Content, + type ParameterLayoutContentProps as ContentProps +} from './ParameterLayoutContent'; +export { + ParameterLayoutFooter as Footer, + type ParameterLayoutFooterProps as FooterProps +} from './ParameterLayoutFooter'; +export { + ParameterLayoutHeader as Header, + type ParameterLayoutHeaderProps as HeaderProps +} from './ParameterLayoutHeader'; +export { + ParameterLayoutHeaderBase as HeaderBase, + type ParameterLayoutHeaderBaseProps as HeaderBaseProps +} from './ParameterLayoutHeaderBase'; +export { + 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 new file mode 100644 index 0000000..dbb01d8 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayoutContent.tsx @@ -0,0 +1,19 @@ +import { Flex } from "@chakra-ui/react"; +import { ReactNode } from "react"; + +export type ParameterLayoutContentProps = { + children?:ReactNode; +} + +export const ParameterLayoutContent = ({children}:ParameterLayoutContentProps) => { + return + {children} + +} diff --git a/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx b/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx new file mode 100644 index 0000000..fed27e2 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayoutFooter.tsx @@ -0,0 +1,16 @@ +import { Flex } from "@chakra-ui/react"; +import { ReactNode } from "react"; + +export type ParameterLayoutFooterProps = { + children?: ReactNode; +} + +export const ParameterLayoutFooter = ({children}:ParameterLayoutFooterProps) => { + return + {children} + +} diff --git a/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx b/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx new file mode 100644 index 0000000..47adf20 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayoutHeader.tsx @@ -0,0 +1,17 @@ +import { Flex } from "@chakra-ui/react"; +import { ReactNode } from "react"; + +export type ParameterLayoutHeaderProps = { + children?:ReactNode; +} + +export const ParameterLayoutHeader = ({children}:ParameterLayoutHeaderProps) => { + return + {children} + +} diff --git a/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx b/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx new file mode 100644 index 0000000..51ee1b9 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayoutHeaderBase.tsx @@ -0,0 +1,23 @@ +import { Flex, Text } from "@chakra-ui/react"; +import { ParameterLayoutHeader } from "./ParameterLayoutHeader"; + +export type ParameterLayoutHeaderBaseProps = { + title:string; + description?: string, +} + +export const ParameterLayoutHeaderBase = ({ + title, + description, +}:ParameterLayoutHeaderBaseProps) => { + return + + + {title} + + {description && {description}} + + +} diff --git a/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx b/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx new file mode 100644 index 0000000..9fa4ad8 --- /dev/null +++ b/front/src/components/ParameterLayout/ParameterLayoutRoot.tsx @@ -0,0 +1,16 @@ + +import { VStack } from '@chakra-ui/react'; + +export type ParameterLayoutRootProps = { + children?: ReactNode; +} + +export const ParameterLayoutRoot = ({children}:ParameterLayoutRootProps) => { + return + {children} + +} diff --git a/front/src/components/ParameterLayout/index.ts b/front/src/components/ParameterLayout/index.ts new file mode 100644 index 0000000..7ef9241 --- /dev/null +++ b/front/src/components/ParameterLayout/index.ts @@ -0,0 +1 @@ +export * as ParameterLayout from './ParameterLayout'; diff --git a/front/src/scene/account/ManageAccountPage.tsx b/front/src/scene/account/ManageAccountPage.tsx index c3e3534..38b20c5 100644 --- a/front/src/scene/account/ManageAccountPage.tsx +++ b/front/src/scene/account/ManageAccountPage.tsx @@ -1,12 +1,13 @@ -import { Box, Center, Flex, HStack, Table, Text, VStack } from '@chakra-ui/react'; -import { LuCrown } from 'react-icons/lu'; +import { Button, Table, Text } from '@chakra-ui/react'; import { PageLayout } from '@/components/Layout/PageLayout'; import { TopBar } from '@/components/TopBar/TopBar'; -import { useColorModeValue } from '@/components/ui/color-mode'; -import { Application } from '@/back-api'; -import { ApplicationService } from '@/service/application'; +import { UserCreateWrite } from '@/back-api'; +import { useFormidable } from '@/components/form/Formidable'; +import { FormInput } from '@/components/form/FormInput'; +import { FormPassword } from '@/components/form/FormPassword'; +import { ParameterLayout } from '@/components/ParameterLayout'; import { UserService } from '@/service/user.service'; const options: Intl.DateTimeFormatOptions = { @@ -24,34 +25,9 @@ export const ManageAccountPage = () => { <> - - - - - Users - - List of all users - - - + + + @@ -78,16 +54,65 @@ export const ManageAccountPage = () => { ))} - - - - + + + + ); }; +export const CreateUserComponent = () => { + +const form = useFormidable({ + initialValues: { + login: "", + email: "", + password: "", + }, + configuration: { + enableModifyNotification: false, + enableReset: false, + } +}); + +//const { connect, lastError, isConnectionLoading } = useLogin(); +const {userCreate, error, isCalling} = UserService.useCreate({}); +const onSubmit = () => { + userCreate(form.values); +}; + +return + + + {error && {error}} + + + + + + + + +} diff --git a/front/src/service/user.service.ts b/front/src/service/user.service.ts index 1dbc7fc..d484277 100644 --- a/front/src/service/user.service.ts +++ b/front/src/service/user.service.ts @@ -4,9 +4,9 @@ * @license PROPRIETARY (see license file) */ -import { UserResource } from "@/back-api"; +import { UserAuthGet, UserCreateWrite, UserResource } from "@/back-api"; +import { useQuery, useQueryCall, useQueryCallProps } from "@/utils/query"; import { useSessionService } from "./session"; -import { useQuery } from "@/utils/query"; export namespace UserService { export const useGets = () => { @@ -19,4 +19,18 @@ export namespace UserService { }, }); }; + export const useCreate = ({ config }: { config?: Omit, 'queryFunction'> }) => { + const { getRestConfig } = useSessionService(); + const { call, ...rest } = useQueryCall({ + queryFunction: (data) => { + return UserResource.create({ + restConfig: getRestConfig(), + data: { ...data }, + }); + }, + ...config + }); + return { userCreate: call, ...rest }; + }; } +