diff --git a/webapp/src/service/apiSchema.generated.ts b/webapp/src/service/apiSchema.generated.ts index cd63011a2f..46b942e5c1 100644 --- a/webapp/src/service/apiSchema.generated.ts +++ b/webapp/src/service/apiSchema.generated.ts @@ -1152,6 +1152,7 @@ export interface components { slug?: string; /** Format: int64 */ baseLanguageId?: number; + useNamespaces: boolean; /** Format: int64 */ defaultNamespaceId?: number; description?: string; @@ -1336,6 +1337,7 @@ export interface components { avatar?: components["schemas"]["Avatar"]; organizationOwner?: components["schemas"]["SimpleOrganizationModel"]; baseLanguage?: components["schemas"]["LanguageModel"]; + useNamespaces: boolean; defaultNamespace?: components["schemas"]["NamespaceModel"]; organizationRole?: "MEMBER" | "OWNER"; directPermission?: components["schemas"]["PermissionModel"]; diff --git a/webapp/src/views/projects/project/ProjectSettingsGeneral.tsx b/webapp/src/views/projects/project/ProjectSettingsGeneral.tsx index 408ec472b3..c4dd8d7349 100644 --- a/webapp/src/views/projects/project/ProjectSettingsGeneral.tsx +++ b/webapp/src/views/projects/project/ProjectSettingsGeneral.tsx @@ -15,11 +15,13 @@ import { Box, styled } from '@mui/material'; import { ProjectLanguagesProvider } from 'tg.hooks/ProjectLanguagesProvider'; import { useProjectNamespaces } from 'tg.hooks/useProjectNamespaces'; import { DefaultNamespaceSelect } from './components/DefaultNamespaceSelect'; +import { UseNamespacesCheckbox } from './components/UseNamespacesCheckbox'; type FormValues = { name: string; description: string | undefined; baseLanguageId: number | undefined; + useNamespaces: boolean | false; defaultNamespaceId: number | ''; }; @@ -49,6 +51,15 @@ const LanguageSelect = () => { ); }; +const NamespacesCheckbox = () => { + return ( + } + name="useNamespaces" + /> + ); +}; + const NamespaceSelect = () => { const { allNamespacesWithNone } = useProjectNamespaces(); return ( @@ -69,6 +80,7 @@ export const ProjectSettingsGeneral = () => { name: project.name, baseLanguageId: project.baseLanguage?.id, description: project.description ?? '', + useNamespaces: project.useNamespaces ?? false, defaultNamespaceId: defaultNamespace?.id ?? '', } satisfies FormValues; @@ -82,6 +94,7 @@ export const ProjectSettingsGeneral = () => { const data = { ...values, description: values.description || undefined, + useNamespaces: values.useNamespaces || false, defaultNamespaceId: values.defaultNamespaceId === 0 ? undefined : values.defaultNamespaceId, }; @@ -157,6 +170,7 @@ export const ProjectSettingsGeneral = () => { + diff --git a/webapp/src/views/projects/project/components/UseNamespacesCheckbox.tsx b/webapp/src/views/projects/project/components/UseNamespacesCheckbox.tsx new file mode 100644 index 0000000000..a10d9fa0ea --- /dev/null +++ b/webapp/src/views/projects/project/components/UseNamespacesCheckbox.tsx @@ -0,0 +1,24 @@ +import { FC, ReactNode } from 'react'; +import { Box, Checkbox, MenuItem } from '@mui/material'; + +import { Select } from 'tg.component/common/form/fields/Select'; +import { components } from 'tg.service/apiSchema.generated'; +import { FieldLabel } from 'tg.component/FormField'; +import { useTranslate } from '@tolgee/react'; + +export const UseNamespacesCheckbox: FC<{ + label?: ReactNode; + name: string; +}> = (props) => { + return ( + + {props.label} + + + ); +}; diff --git a/webapp/src/views/projects/translations/KeyCreateForm/FormBody.tsx b/webapp/src/views/projects/translations/KeyCreateForm/FormBody.tsx index 77a41bb8e9..111e20ef4d 100644 --- a/webapp/src/views/projects/translations/KeyCreateForm/FormBody.tsx +++ b/webapp/src/views/projects/translations/KeyCreateForm/FormBody.tsx @@ -126,7 +126,7 @@ export const FormBody: React.FC = ({ onCancel, autofocus }) => { {({ field, form }: FieldProps) => { return (
- + {/*TODO tady možná taky*/} diff --git a/webapp/src/views/projects/translations/KeyEdit/KeyGeneral.tsx b/webapp/src/views/projects/translations/KeyEdit/KeyGeneral.tsx index 9453d3e923..e00821cba2 100644 --- a/webapp/src/views/projects/translations/KeyEdit/KeyGeneral.tsx +++ b/webapp/src/views/projects/translations/KeyEdit/KeyGeneral.tsx @@ -67,10 +67,11 @@ export const KeyGeneral = () => { + {/**/} - {t('translations_key_edit_label_namespace')} + {t('translations_key_edit_label_namespace')} tady { /> + {/**/}