From 9a92b51cc4c72833b592ac03844a52eacf4cf955 Mon Sep 17 00:00:00 2001 From: cpprian Date: Thu, 29 Aug 2024 19:57:17 +0200 Subject: [PATCH 1/4] add link to documentation --- web/src/i18n/en/index.ts | 3 ++- web/src/i18n/i18n-types.ts | 4 ++-- .../AddUserModal/components/AddUserForm/AddUserForm.tsx | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index d48ff11979..2473ab2ed3 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -375,7 +375,8 @@ const en: BaseTranslation = { label: 'Phone', }, enableEnrollment: { - label: 'Use enrollment process', + label: + 'Use user self-enrollment process more information here', }, }, }, diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 341cc8dd0d..73a7ed7d0d 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -879,7 +879,7 @@ type RootTranslation = { } enableEnrollment: { /** - * U​s​e​ ​e​n​r​o​l​l​m​e​n​t​ ​p​r​o​c​e​s​s + * U​s​e​ ​u​s​e​r​ ​s​e​l​f​-​e​n​r​o​l​l​m​e​n​t​ ​p​r​o​c​e​s​s​ ​<​a​ ​h​r​e​f​=​"​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​"​>​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​<​/​a​> */ label: string } @@ -5056,7 +5056,7 @@ export type TranslationFunctions = { } enableEnrollment: { /** - * Use enrollment process + * Use user self-enrollment process more information here */ label: () => LocalizedString } diff --git a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx index c35eee2ecf..134fb775e7 100644 --- a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx +++ b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx @@ -2,6 +2,7 @@ import './style.scss'; import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import parser from 'html-react-parser'; import { omit } from 'lodash-es'; import { useMemo, useRef, useState } from 'react'; import { SubmitHandler, useController, useForm } from 'react-hook-form'; @@ -190,7 +191,7 @@ export const AddUserForm = () => { >
From f395ad961bc7c676c7ce6a0a4aab0ffa365c132d Mon Sep 17 00:00:00 2001 From: cpprian Date: Thu, 29 Aug 2024 20:16:21 +0200 Subject: [PATCH 2/4] separate label and link --- web/src/i18n/en/index.ts | 4 ++-- web/src/i18n/i18n-types.ts | 12 ++++++++++-- web/src/i18n/pl/index.ts | 1 + .../components/AddUserForm/AddUserForm.tsx | 17 +++++++++++------ .../components/AddUserForm/style.scss | 9 ++++++++- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index 2473ab2ed3..eea0f96b9f 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -375,8 +375,8 @@ const en: BaseTranslation = { label: 'Phone', }, enableEnrollment: { - label: - 'Use user self-enrollment process more information here', + label: 'Use user self-enrollment process', + link: '[more information here](https://defguard.gitbook.io/defguard/help/enrollment)', }, }, }, diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 73a7ed7d0d..9e2b916eec 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -879,9 +879,13 @@ type RootTranslation = { } enableEnrollment: { /** - * U​s​e​ ​u​s​e​r​ ​s​e​l​f​-​e​n​r​o​l​l​m​e​n​t​ ​p​r​o​c​e​s​s​ ​<​a​ ​h​r​e​f​=​"​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​"​>​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​<​/​a​> + * U​s​e​ ​u​s​e​r​ ​s​e​l​f​-​e​n​r​o​l​l​m​e​n​t​ ​p​r​o​c​e​s​s */ label: string + /** + * [​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​]​(​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​) + */ + link: string } } } @@ -5056,9 +5060,13 @@ export type TranslationFunctions = { } enableEnrollment: { /** - * Use user self-enrollment process more information here + * Use user self-enrollment process */ label: () => LocalizedString + /** + * [more information here](https://defguard.gitbook.io/defguard/help/enrollment) + */ + link: () => LocalizedString } } } diff --git a/web/src/i18n/pl/index.ts b/web/src/i18n/pl/index.ts index b1898aeb81..59ca5502d4 100644 --- a/web/src/i18n/pl/index.ts +++ b/web/src/i18n/pl/index.ts @@ -378,6 +378,7 @@ const pl: Translation = { }, enableEnrollment: { label: 'Użyj zdalnej rejestracji', + link: '[więcej informacji tutaj](https://defguard.gitbook.io/defguard/help/enrollment)', }, }, }, diff --git a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx index 134fb775e7..37e36c47b7 100644 --- a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx +++ b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx @@ -2,10 +2,10 @@ import './style.scss'; import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import parser from 'html-react-parser'; import { omit } from 'lodash-es'; import { useMemo, useRef, useState } from 'react'; import { SubmitHandler, useController, useForm } from 'react-hook-form'; +import ReactMarkdown from 'react-markdown'; import { z } from 'zod'; import { shallow } from 'zustand/shallow'; @@ -189,11 +189,16 @@ export const AddUserForm = () => { data-testid="add-user-form" onSubmit={handleSubmit(onSubmit)} > - +
+ + + {LL.modals.addUser.form.fields.enableEnrollment.link()} + +
.form-checkbox { + .checkbox-space { + display: flex; margin-bottom: 25px; + gap: 5px; + + a { + @include typography(input-label); + } } + & > .row { display: flex; flex-flow: column; From 8d482fa817eb529d10512f81c1440ac3b3f7be88 Mon Sep 17 00:00:00 2001 From: cpprian Date: Fri, 30 Aug 2024 13:46:04 +0200 Subject: [PATCH 3/4] clicking link opens a new page --- web/src/i18n/en/index.ts | 2 +- web/src/i18n/i18n-types.ts | 4 ++-- web/src/i18n/pl/index.ts | 2 +- .../AddUserModal/components/AddUserForm/AddUserForm.tsx | 6 ++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index eea0f96b9f..8c5dce5212 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -376,7 +376,7 @@ const en: BaseTranslation = { }, enableEnrollment: { label: 'Use user self-enrollment process', - link: '[more information here](https://defguard.gitbook.io/defguard/help/enrollment)', + link: 'more information here', }, }, }, diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 9e2b916eec..469c2befb5 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -883,7 +883,7 @@ type RootTranslation = { */ label: string /** - * [​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​]​(​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​) + * <​a​ ​h​r​e​f​=​"​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​"​ ​t​a​r​g​e​t​=​"​_​b​l​a​n​k​"​>​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​<​/​a​> */ link: string } @@ -5064,7 +5064,7 @@ export type TranslationFunctions = { */ label: () => LocalizedString /** - * [more information here](https://defguard.gitbook.io/defguard/help/enrollment) + * more information here */ link: () => LocalizedString } diff --git a/web/src/i18n/pl/index.ts b/web/src/i18n/pl/index.ts index 59ca5502d4..f893af5e5a 100644 --- a/web/src/i18n/pl/index.ts +++ b/web/src/i18n/pl/index.ts @@ -378,7 +378,7 @@ const pl: Translation = { }, enableEnrollment: { label: 'Użyj zdalnej rejestracji', - link: '[więcej informacji tutaj](https://defguard.gitbook.io/defguard/help/enrollment)', + link: 'więcej informacji tutaj', }, }, }, diff --git a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx index 37e36c47b7..666439948a 100644 --- a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx +++ b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx @@ -2,10 +2,10 @@ import './style.scss'; import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import parse from 'html-react-parser'; import { omit } from 'lodash-es'; import { useMemo, useRef, useState } from 'react'; import { SubmitHandler, useController, useForm } from 'react-hook-form'; -import ReactMarkdown from 'react-markdown'; import { z } from 'zod'; import { shallow } from 'zustand/shallow'; @@ -195,9 +195,7 @@ export const AddUserForm = () => { label={LL.modals.addUser.form.fields.enableEnrollment.label()} controller={{ control, name: 'enable_enrollment' }} /> - - {LL.modals.addUser.form.fields.enableEnrollment.link()} - + <>{parse(LL.modals.addUser.form.fields.enableEnrollment.link())}
From 5ad93c6ca47cb064fd5150ca4b357e07576359ff Mon Sep 17 00:00:00 2001 From: cpprian Date: Fri, 30 Aug 2024 15:07:22 +0200 Subject: [PATCH 4/4] fix lint errors --- web/src/i18n/i18n-types.ts | 1 + .../modals/AddUserModal/components/AddUserForm/AddUserForm.tsx | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 0ac5de5563..469c2befb5 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -884,6 +884,7 @@ type RootTranslation = { label: string /** * <​a​ ​h​r​e​f​=​"​h​t​t​p​s​:​/​/​d​e​f​g​u​a​r​d​.​g​i​t​b​o​o​k​.​i​o​/​d​e​f​g​u​a​r​d​/​h​e​l​p​/​e​n​r​o​l​l​m​e​n​t​"​ ​t​a​r​g​e​t​=​"​_​b​l​a​n​k​"​>​m​o​r​e​ ​i​n​f​o​r​m​a​t​i​o​n​ ​h​e​r​e​<​/​a​> + */ link: string } } diff --git a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx index 4839abb0e8..666439948a 100644 --- a/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx +++ b/web/src/pages/users/UsersOverview/modals/AddUserModal/components/AddUserForm/AddUserForm.tsx @@ -6,7 +6,6 @@ import parse from 'html-react-parser'; import { omit } from 'lodash-es'; import { useMemo, useRef, useState } from 'react'; import { SubmitHandler, useController, useForm } from 'react-hook-form'; -import ReactMarkdown from 'react-markdown'; import { z } from 'zod'; import { shallow } from 'zustand/shallow';