From 470788169c13f08dee29040f970293896cde66f7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:35:26 +0100 Subject: [PATCH] Make invitation code readonly (#89) # Make invitation code readonly ## :recycle: Current situation & Problem #88 ## :gear: Release Notes * Remove invitation code from PatientForm * Add invitation code to user information I moved the invitation code to the information panel on the left if it's meant to be read-only. ![image](https://github.com/user-attachments/assets/50251b77-239f-4c1d-85ca-ffcb810fba68) ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). --- routes/~_dashboard/~patients/PatientForm.tsx | 15 +-------------- routes/~_dashboard/~patients/utils.ts | 1 + .../~patients/~$id/UserActivity.tsx | 18 ++++++++---------- routes/~_dashboard/~patients/~$id/~index.tsx | 1 - 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/routes/~_dashboard/~patients/PatientForm.tsx b/routes/~_dashboard/~patients/PatientForm.tsx index 6e7f27e9..e4b3c330 100644 --- a/routes/~_dashboard/~patients/PatientForm.tsx +++ b/routes/~_dashboard/~patients/PatientForm.tsx @@ -27,7 +27,6 @@ import { type User } from '@/modules/firebase/models' export const patientFormSchema = z.object({ email: z.string().email().min(1, 'Email is required'), displayName: z.string(), - invitationCode: z.string(), clinician: z.string().min(1, 'Clinician is required'), dateOfBirth: z.date().optional(), }) @@ -41,10 +40,7 @@ interface PatientFormProps { email: string | null }> userInfo?: Pick - user?: Pick< - User, - 'organization' | 'invitationCode' | 'clinician' | 'dateOfBirth' - > + user?: Pick onSubmit: (data: PatientFormSchema) => Promise clinicianPreselectId?: string } @@ -62,7 +58,6 @@ export const PatientForm = ({ defaultValues: { email: userInfo?.email ?? '', displayName: userInfo?.displayName ?? '', - invitationCode: user?.invitationCode ?? '', clinician: user?.clinician ?? clinicianPreselectId ?? '', dateOfBirth: user?.dateOfBirth ? new Date(user.dateOfBirth) : undefined, }, @@ -100,14 +95,6 @@ export const PatientForm = ({ /> )} /> - {isEdit && ( - } - /> - )} ( - - User activity - -
+
    + } + label="Invitation code" + value={activity.invitationCode} + /> {activity.isInvitation && ( } diff --git a/routes/~_dashboard/~patients/~$id/~index.tsx b/routes/~_dashboard/~patients/~$id/~index.tsx index 099f38da..20db3953 100644 --- a/routes/~_dashboard/~patients/~$id/~index.tsx +++ b/routes/~_dashboard/~patients/~$id/~index.tsx @@ -107,7 +107,6 @@ const PatientPage = () => { email: form.email, } const userData = { - invitationCode: form.invitationCode, clinician: form.clinician, organization: clinician.organization, dateOfBirth: form.dateOfBirth?.toISOString() ?? null,