Skip to content

Commit

Permalink
feat: add (disabled) username field
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Aug 13, 2024
1 parent 989bf5a commit 0ef54b6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/themes/src/common/commonStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export const commonStyles = {
outline: 'none',
boxShadow: 'none',
},
'&:disabled': {
color: 'lightgrey',
cursor: 'not-allowed',
},
},
colors: {
white: 'white',
Expand Down
1 change: 1 addition & 0 deletions src/pages/UserSettings/SettingsPageUserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 16 additions & 1 deletion src/pages/UserSettings/content/sections/UserInfos.section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 }}>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/UserSettings/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 0ef54b6

Please sign in to comment.