Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
a3f9cc19
Commit
a3f9cc19
authored
Oct 14, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add name field to profile page and write some tests
parent
11467f36
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
1 deletion
+62
-1
MyProfileEmail.tsx
ui/myProfile/MyProfileEmail.tsx
+3
-0
MyProfileFieldsEmail.tsx
ui/myProfile/fields/MyProfileFieldsEmail.tsx
+0
-1
MyProfileFieldsName.tsx
ui/myProfile/fields/MyProfileFieldsName.tsx
+32
-0
types.tsx
ui/myProfile/types.tsx
+1
-0
MyProfile.pw.tsx
ui/pages/MyProfile.pw.tsx
+26
-0
MyProfile.pw.tsx_default_without-address-1.png
...eenshots__/MyProfile.pw.tsx_default_without-address-1.png
+0
-0
MyProfile.pw.tsx_default_without-email-1.png
...creenshots__/MyProfile.pw.tsx_default_without-email-1.png
+0
-0
No files found.
ui/myProfile/MyProfileEmail.tsx
View file @
a3f9cc19
...
@@ -18,6 +18,7 @@ import FormFieldReCaptcha from 'ui/shared/forms/fields/FormFieldReCaptcha';
...
@@ -18,6 +18,7 @@ import FormFieldReCaptcha from 'ui/shared/forms/fields/FormFieldReCaptcha';
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
import
MyProfileFieldsEmail
from
'
./fields/MyProfileFieldsEmail
'
;
import
MyProfileFieldsEmail
from
'
./fields/MyProfileFieldsEmail
'
;
import
MyProfileFieldsName
from
'
./fields/MyProfileFieldsName
'
;
const
MIXPANEL_CONFIG
=
{
const
MIXPANEL_CONFIG
=
{
account_link_info
:
{
account_link_info
:
{
...
@@ -38,6 +39,7 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
...
@@ -38,6 +39,7 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
mode
:
'
onBlur
'
,
mode
:
'
onBlur
'
,
defaultValues
:
{
defaultValues
:
{
email
:
profileQuery
.
data
?.
email
||
''
,
email
:
profileQuery
.
data
?.
email
||
''
,
name
:
profileQuery
.
data
?.
name
||
profileQuery
.
data
?.
nickname
||
''
,
},
},
});
});
...
@@ -78,6 +80,7 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
...
@@ -78,6 +80,7 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
noValidate
noValidate
onSubmit=
{
formApi
.
handleSubmit
(
onFormSubmit
)
}
onSubmit=
{
formApi
.
handleSubmit
(
onFormSubmit
)
}
>
>
<
MyProfileFieldsName
/>
<
MyProfileFieldsEmail
isReadOnly=
{
!
config
.
services
.
reCaptchaV3
.
siteKey
}
/>
<
MyProfileFieldsEmail
isReadOnly=
{
!
config
.
services
.
reCaptchaV3
.
siteKey
}
/>
{
config
.
services
.
reCaptchaV3
.
siteKey
&&
(
{
config
.
services
.
reCaptchaV3
.
siteKey
&&
(
<
GoogleReCaptchaProvider
reCaptchaKey=
{
config
.
services
.
reCaptchaV3
.
siteKey
}
>
<
GoogleReCaptchaProvider
reCaptchaKey=
{
config
.
services
.
reCaptchaV3
.
siteKey
}
>
...
...
ui/myProfile/fields/MyProfileFieldsEmail.tsx
View file @
a3f9cc19
...
@@ -32,7 +32,6 @@ const MyProfileFieldsEmail = ({ isReadOnly }: Props) => {
...
@@ -32,7 +32,6 @@ const MyProfileFieldsEmail = ({ isReadOnly }: Props) => {
isDisabled=
{
isDisabled
}
isDisabled=
{
isDisabled
}
isReadOnly=
{
isReadOnly
}
isReadOnly=
{
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
bgColor=
"dialog_bg"
/>
/>
<
InputPlaceholder
text=
"Email"
error=
{
fieldState
.
error
}
/>
<
InputPlaceholder
text=
"Email"
error=
{
fieldState
.
error
}
/>
{
!
formState
.
dirtyFields
.
email
&&
(
{
!
formState
.
dirtyFields
.
email
&&
(
...
...
ui/myProfile/fields/MyProfileFieldsName.tsx
0 → 100644
View file @
a3f9cc19
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
useController
,
useFormContext
}
from
'
react-hook-form
'
;
import
type
{
FormFields
}
from
'
../types
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
const
MyProfileFieldsName
=
()
=>
{
const
{
control
}
=
useFormContext
<
FormFields
>
();
const
{
field
,
fieldState
,
formState
}
=
useController
<
FormFields
,
'
name
'
>
({
control
,
name
:
'
name
'
,
});
const
isDisabled
=
formState
.
isSubmitting
;
return
(
<
FormControl
variant=
"floating"
isDisabled=
{
isDisabled
}
size=
"md"
cursor=
"not-allowed"
mb=
{
3
}
>
<
Input
{
...
field
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
isDisabled
}
isReadOnly=
{
true
}
autoComplete=
"off"
/>
<
InputPlaceholder
text=
"Name"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
);
};
export
default
React
.
memo
(
MyProfileFieldsName
);
ui/myProfile/types.tsx
View file @
a3f9cc19
export
interface
FormFields
{
export
interface
FormFields
{
email
:
string
;
email
:
string
;
name
:
string
;
reCaptcha
:
string
;
reCaptcha
:
string
;
}
}
ui/pages/MyProfile.pw.tsx
0 → 100644
View file @
a3f9cc19
import
type
{
BrowserContext
}
from
'
@playwright/test
'
;
import
React
from
'
react
'
;
import
*
as
profileMock
from
'
mocks/user/profile
'
;
import
{
contextWithAuth
}
from
'
playwright/fixtures/auth
'
;
import
{
test
as
base
,
expect
}
from
'
playwright/lib
'
;
import
MyProfile
from
'
./MyProfile
'
;
const
test
=
base
.
extend
<
{
context
:
BrowserContext
}
>
({
context
:
contextWithAuth
,
});
test
(
'
without address
'
,
async
({
render
,
mockApiResponse
})
=>
{
await
mockApiResponse
(
'
user_info
'
,
profileMock
.
base
);
const
component
=
await
render
(<
MyProfile
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
without email
'
,
async
({
render
,
mockApiResponse
})
=>
{
await
mockApiResponse
(
'
user_info
'
,
profileMock
.
withoutEmail
);
const
component
=
await
render
(<
MyProfile
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/pages/__screenshots__/MyProfile.pw.tsx_default_without-address-1.png
0 → 100644
View file @
a3f9cc19
21.6 KB
ui/pages/__screenshots__/MyProfile.pw.tsx_default_without-email-1.png
0 → 100644
View file @
a3f9cc19
24.5 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment