Skip to content

Commit

Permalink
deal with merge conflict (#11489)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbalfour authored Oct 28, 2024
1 parent 5a4f051 commit 8b6885b
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-19706e7e35-10.zip
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-6b67494872-10.zip
Binary file not shown.
1 change: 1 addition & 0 deletions packages/rc-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"commit": "yarn test --coverage --no-cache --silent --forceExit --detectOpenHandles --runInBand --watch=false && jest-coverage-badges --input src/tests/coverage/coverage-summary.json --output src/tests/badges && yarn lint --fix && yarn check"
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@linaria/core": "^5.0.2",
"@linaria/react": "^5.0.3",
"@reapit/connect-session": "^6.1.3",
Expand Down
79 changes: 79 additions & 0 deletions packages/rc-service/src/components/users/update-user-name.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, { FC } from 'react'
import { Button, FormLayout, InputGroup, InputWrapFull, Modal, Title, useModal } from '@reapit/elements'
import { UpdateActionNames, updateActions, useReapitUpdate } from '@reapit/use-reapit-data'
import { reapitConnectBrowserSession } from '../../core/connect-session'
import { UserModel } from '@reapit/foundations-ts-definitions'
import { useForm } from 'react-hook-form'
import { yupResolver } from '@hookform/resolvers/yup'
import { object, string } from 'yup'

const validationSchema = object().shape({
name: string().trim().required('Required').max(150, 'Limit of 150 characters'),
})

export const UpdateUserName: FC<{ user: UserModel }> = ({ user }) => {
const { modalIsOpen, openModal, closeModal } = useModal()

const [isLoading, , updateUser] = useReapitUpdate<UserModel, UserModel>({
uriParams: {
userId: user.id,
},
action: updateActions[UpdateActionNames.updateUser],
reapitConnectBrowserSession,
method: 'PATCH',
})

const {
register,
handleSubmit,
formState: { errors: formErrors },
} = useForm<{ name?: string }>({
resolver: yupResolver(validationSchema) as any,
defaultValues: {
name: user.name,
},
})

return (
<>
<Button intent="primary" onClick={() => openModal()}>
Update User&apos;s Name
</Button>
<Modal
isOpen={modalIsOpen}
onModalClose={() => {
closeModal()
}}
>
<form
onSubmit={handleSubmit(({ name }) => {
console.log('update name', name)

updateUser({
name,
})
})}
>
<FormLayout>
<InputWrapFull>
<Title>Update Name</Title>
</InputWrapFull>
<InputWrapFull>
<InputGroup
label="Name"
{...register('name')}
errorMessage={formErrors?.name?.message}
icon={formErrors?.name?.message ? 'asterisk' : null}
/>
</InputWrapFull>
<InputWrapFull>
<Button loading={isLoading} disabled={isLoading} intent="primary">
Update
</Button>
</InputWrapFull>
</FormLayout>
</form>
</Modal>
</>
)
}

Check warning on line 79 in packages/rc-service/src/components/users/update-user-name.tsx

View workflow job for this annotation

GitHub Actions / Release

Insert `⏎`
5 changes: 5 additions & 0 deletions packages/rc-service/src/components/users/user-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { useReapitConnect } from '@reapit/connect-session'
import { getIsAdmin } from '../../utils/is-admin'
import { ActiveAuthenticator } from './active-authenticator'
import { EditUserGroups } from './edit-user-groups'
import { UpdateUserName } from './update-user-name'

export interface UserContentProps {
user: UserModel
Expand Down Expand Up @@ -295,6 +296,10 @@ export const UserContent: FC<UserContentProps> = ({ user, refreshUsers, userGrou
</Button>
</ButtonGroup>
</Col>
<Col>
<Subtitle>Update Name</Subtitle>
<UpdateUserName user={user} />
</Col>
</Grid>
{isLoading && <Loader />}
{activeAuthenticator && isSupport && shouldFetch.authenticators ? (
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4979,6 +4979,15 @@ __metadata:
languageName: node
linkType: hard

"@hookform/resolvers@npm:^3.9.0":
version: 3.9.0
resolution: "@hookform/resolvers@npm:3.9.0"
peerDependencies:
react-hook-form: ^7.0.0
checksum: b878e92cebc703106a70987437ab4add0e71a327a0bb9864f82ab480b5d9a38b0d639f6154b138c3c4828af0db00c1b413279c102715146b19edc76b9786f1c3
languageName: node
linkType: hard

"@humanwhocodes/config-array@npm:^0.13.0":
version: 0.13.0
resolution: "@humanwhocodes/config-array@npm:0.13.0"
Expand Down Expand Up @@ -23120,6 +23129,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "rc-service@workspace:packages/rc-service"
dependencies:
"@hookform/resolvers": "npm:^3.9.0"
"@linaria/core": "npm:^5.0.2"
"@linaria/react": "npm:^5.0.3"
"@linaria/shaker": "npm:^5.0.3"
Expand Down

0 comments on commit 8b6885b

Please sign in to comment.