feat: add (disabled) username field

This commit is contained in:
Ben Furber
2024-08-08 16:37:51 +01:00
committed by benfurber
parent 989bf5a11b
commit 0ef54b6a7a
4 changed files with 26 additions and 1 deletions

View File

@@ -6,6 +6,10 @@ export const commonStyles = {
outline: 'none',
boxShadow: 'none',
},
'&:disabled': {
color: 'lightgrey',
cursor: 'not-allowed',
},
},
colors: {
white: 'white',

View File

@@ -100,6 +100,7 @@ export const SettingsPageUserProfile = () => {
const initialValues = {
profileType: user?.profileType || ProfileType.MEMBER,
displayName: user?.displayName || null,
userName: user?.userName,
links,
location: user?.location || null,
about: user?.about || null,

View File

@@ -25,7 +25,7 @@ interface IProps {
export const UserInfosSection = ({ formValues }: IProps) => {
const { profileType, links, location } = formValues
const isMemberProfile = profileType === ProfileType.MEMBER
const { about, country, displayName } = fields
const { about, country, displayName, userName } = fields
const noMapPin = !location?.latlng
@@ -36,6 +36,21 @@ export const UserInfosSection = ({ formValues }: IProps) => {
sx={{ flexDirection: 'column', gap: [3, 5] }}
>
<Heading as="h2">{headings.infos}</Heading>
<Flex sx={{ flexDirection: 'column', gap: 1 }}>
<Text>{`${userName.title} *`}</Text>
<Text variant="quiet" sx={{ fontSize: 2 }}>
{userName.description}
</Text>
<Field
data-cy="userName"
name="userName"
component={FieldInput}
validate={required}
validateFields={[]}
disabled
/>
</Flex>
<Flex sx={{ flexDirection: 'column', gap: 1 }}>
<Text>{`${displayName.title} *`}</Text>
<Text variant="quiet" sx={{ fontSize: 2 }}>

View File

@@ -126,6 +126,11 @@ export const fields: ILabels = {
repeatNewPassword: {
title: 'Repeat new password',
},
userName: {
title: 'Username',
description:
"You set this when you signed up and it can't be changed now. Sorry.",
},
workspaceType: {
description: 'What kind of Precious Plastic workspace do you run?',
error: 'Please select your workspace type',