diff --git a/lib/components/examples/TableExample.tsx b/lib/components/examples/TableExample.tsx index fca21e88..114bbeab 100644 --- a/lib/components/examples/TableExample.tsx +++ b/lib/components/examples/TableExample.tsx @@ -92,14 +92,14 @@ const TableExample = ({ data: initialData }: Pick, 'data'>) ]} header={[ { setSorting(['id', newTableSorting]) setData(data.sort(sortingFunctions.id[newTableSorting])) }} > - ID + Id , ) => { const translation = useTranslation(language, defaultAddPatientModalTranslation) - const [dropdownID, setDropdownID] = useState({}) + const [dropdownId, setDropdownId] = useState({}) const [patientName, setPatientName] = useState('') const [touched, setTouched] = useState(false) const assignBedMutation = useAssignBedMutation() const createPatientMutation = usePatientCreateMutation(patient => { - if (dropdownID.bedID) { - assignBedMutation.mutate({ id: dropdownID.bedID, patientID: patient.id }) + if (dropdownId.bedId) { + assignBedMutation.mutate({ id: dropdownId.bedId, patientId: patient.id }) } }) const minimumNameLength = 4 const trimmedPatientName = patientName.trim() const validPatientName = trimmedPatientName.length >= minimumNameLength - const validRoomAndBed = dropdownID.roomID && dropdownID.bedID + const validRoomAndBed = dropdownId.roomId && dropdownId.bedId const isShowingError = touched && !validPatientName return ( @@ -88,9 +88,9 @@ export const AddPatientModal = ({ {isShowingError && {translation.minimumLength(minimumNameLength)}} setDropdownID(roomBedDropDownIDs)} + initialRoomAndBed={dropdownId} + wardId={wardId} + onChange={roomBedDropDownIds => setDropdownId(roomBedDropDownIds)} isClearable={true} /> {translation.noBedSelected} diff --git a/tasks/components/BreadCrumb.tsx b/tasks/components/BreadCrumb.tsx index 6d8cb29b..02618f82 100644 --- a/tasks/components/BreadCrumb.tsx +++ b/tasks/components/BreadCrumb.tsx @@ -14,7 +14,7 @@ type BreadCrumbProps = { /** * A component for showing a hierarchical link structure with an independent link on each element * - * e.g. Organizations/Ward/uuid + * e.g. Organizations/Ward/ */ export const BreadCrumb = ({ crumbs }: BreadCrumbProps) => { return ( diff --git a/tasks/components/KanbanColumn.tsx b/tasks/components/KanbanColumn.tsx index 49d9657b..faa48b09 100644 --- a/tasks/components/KanbanColumn.tsx +++ b/tasks/components/KanbanColumn.tsx @@ -32,7 +32,7 @@ type KanbanColumnProps = { tasks: TaskDTO[], type: TaskStatus, isDraggedOver: boolean, - draggedTileID?: string, + draggedTileId?: string, onEditTask: (task: TaskDTO) => void } @@ -44,7 +44,7 @@ export const KanbanColumn = ({ tasks, type, isDraggedOver, - draggedTileID, + draggedTileId, onEditTask }: PropsWithLanguage) => { const translation = useTranslation(language, defaultKanbanColumnsTranslations) @@ -69,7 +69,7 @@ export const KanbanColumn = ({ onEditTask(task)} /> diff --git a/tasks/components/MangeBedsModal.tsx b/tasks/components/MangeBedsModal.tsx index 98504258..45341a31 100644 --- a/tasks/components/MangeBedsModal.tsx +++ b/tasks/components/MangeBedsModal.tsx @@ -57,8 +57,8 @@ const defaultManageBedsModalTranslation: Record & { - wardID: string, // TODO remove later - roomID: string, + wardId: string, // TODO remove later + roomId: string, onClose?: () => void } @@ -67,19 +67,19 @@ export type ManageBedsModalProps = Omit & { */ export const ManageBedsModal = ({ language, - wardID, - roomID, + wardId, + roomId, onClose = noop, modalClassName, ...ModalProps }: PropsWithLanguage) => { const translation = useTranslation(language, defaultManageBedsModalTranslation) - const { data, isLoading, isError } = useRoomOverviewsQuery(wardID) // Todo use more optimized query later + const { data, isLoading, isError } = useRoomOverviewsQuery(wardId) // Todo use more optimized query later const [tableState, setTableState] = useState({ pagination: defaultTableStatePagination }) const [beds, setBeds] = useState([]) - const room = data?.find(value => value.id === roomID) + const room = data?.find(value => value.id === roomId) useEffect(() => { if (data) { @@ -114,7 +114,7 @@ export const ManageBedsModal = ({
{`${translation.beds} (${beds.length})`} - +
{ setBeds(beds.map(value => value.id === bed.id ? { ...value, name: text } : value)) }} - onEditCompleted={text => updateBedMutation.mutate({ id: bed.id, name: text, roomID: room.id })} + onEditCompleted={text => updateBedMutation.mutate({ id: bed.id, name: text, roomId: room.id })} /> ,
diff --git a/tasks/components/OrganisationInvitationList.tsx b/tasks/components/OrganisationInvitationList.tsx index 1afb4cbd..a4560131 100644 --- a/tasks/components/OrganisationInvitationList.tsx +++ b/tasks/components/OrganisationInvitationList.tsx @@ -51,26 +51,26 @@ export type OrganisationInvitation = { } export type OrganisationInvitationListProps = { - organizationID: string, + organizationId: string, invitations?: OrganisationInvitation[], onChange: (invites: OrganisationInvitation[]) => void } /** - * Description + * A List showing all members invited to an organisation */ export const OrganisationInvitationList = ({ language, - organizationID, + organizationId, invitations, onChange }: PropsWithLanguage) => { const translation = useTranslation(language, defaultOrganisationInvitationListTranslation) const context = useContext(OrganizationContext) - const usedOrganizationID = organizationID ?? context.state.organizationID - const isCreatingOrganization = usedOrganizationID === '' - const { data, isLoading, isError } = useInvitationsByOrganisationQuery(context.state.organizationID) + const usedOrganizationId = organizationId ?? context.state.organizationId + const isCreatingOrganization = usedOrganizationId === '' + const { data, isLoading, isError } = useInvitationsByOrganisationQuery(context.state.organizationId) const [tableState, setTableState] = useState({ pagination: { ...defaultTableStatePagination, @@ -81,7 +81,7 @@ export const OrganisationInvitationList = ({ // Maybe move this filter to the endpoint or the query const usedInvitations: OrganisationInvitation[] = invitations ?? (data ?? []).filter(value => value.state === InvitationState.INVITATION_STATE_PENDING) - const inviteMemberMutation = useInviteMemberMutation(usedOrganizationID) + const inviteMemberMutation = useInviteMemberMutation(usedOrganizationId) const revokeInviteMutation = useInviteRevokeMutation() const idMapping = (invite: OrganisationInvitation) => invite.email const isValidEmail = !!inviteMemberModalEmail && validateEmail(inviteMemberModalEmail) @@ -89,8 +89,8 @@ export const OrganisationInvitationList = ({ return ( diff --git a/tasks/components/OrganizationMemberList.tsx b/tasks/components/OrganizationMemberList.tsx index d50d2703..af853d60 100644 --- a/tasks/components/OrganizationMemberList.tsx +++ b/tasks/components/OrganizationMemberList.tsx @@ -70,7 +70,7 @@ type DeleteDialogState = {isShowing: boolean, member?: OrgMember} const defaultDeleteDialogState: DeleteDialogState = { isShowing: false } export type OrganizationMemberListProps = { - organizationID?: string, + organizationId?: string, members?: OrgMember[] } @@ -79,19 +79,19 @@ export type OrganizationMemberListProps = { */ export const OrganizationMemberList = ({ language, - organizationID, + organizationId, members }: PropsWithLanguage) => { const translation = useTranslation(language, defaultOrganizationMemberListTranslations) const [tableState, setTableState] = useState({ pagination: defaultTableStatePagination, selection: defaultTableStateSelection }) const context = useContext(OrganizationContext) - organizationID ??= context.state.organizationID - // const { data, isLoading, isError } = useMembersByOrganizationQuery(organizationID) TODO use later + organizationId ??= context.state.organizationId + // const { data, isLoading, isError } = useMembersByOrganizationQuery(organizationId) TODO use later const { data, isError, isLoading } = useOrganizationsByUserQuery() - const membersByOrganization = data?.find(value => value.id === organizationID)?.members ?? [] + const membersByOrganization = data?.find(value => value.id === organizationId)?.members ?? [] const usedMembers: OrgMember[] = members ?? membersByOrganization ?? [] - const removeMemberMutation = useRemoveMemberMutation(organizationID) + const removeMemberMutation = useRemoveMemberMutation(organizationId) const [deleteDialogState, setDeleteDialogState] = useState(defaultDeleteDialogState) @@ -100,8 +100,8 @@ export const OrganizationMemberList = ({ // TODO move this filtering to the Table component const admins = usedMembers.filter(value => value.role === Role.admin).map(idMapping) - if (tableState.selection?.currentSelection.find(value => admins.find(adminID => adminID === value))) { - const newSelection = tableState.selection.currentSelection.filter(value => !admins.find(adminID => adminID === value)) + if (tableState.selection?.currentSelection.find(value => admins.find(adminId => adminId === value))) { + const newSelection = tableState.selection.currentSelection.filter(value => !admins.find(adminId => adminId === value)) setTableState({ ...tableState, selection: { diff --git a/tasks/components/RoomBedDropDown.tsx b/tasks/components/RoomBedDropDown.tsx index bbc92765..326f4ca1 100644 --- a/tasks/components/RoomBedDropDown.tsx +++ b/tasks/components/RoomBedDropDown.tsx @@ -46,21 +46,21 @@ const defaultRoomBedDropDownTranslation: Record void, + onChange?: (roomBedDropDownIds:RoomBedDropDownIds) => void, isSubmitting?: boolean, isClearable?: boolean } @@ -71,35 +71,35 @@ export type RoomBedDropDownProps = { export const RoomBedDropDown = ({ language, initialRoomAndBed, - wardID, + wardId, isSubmitting = false, isClearable = false, onChange = noop }: PropsWithLanguage) => { const translation = useTranslation(language, defaultRoomBedDropDownTranslation) - const { data, isError, isLoading } = usePatientAssignmentByWardQuery(wardID) - const [currentSelection, setCurrentSelection] = useState({ ...initialRoomAndBed }) + const { data, isError, isLoading } = usePatientAssignmentByWardQuery(wardId) + const [currentSelection, setCurrentSelection] = useState({ ...initialRoomAndBed }) const ref = useRef(null) - const currentRoom = data?.find(value => value.id === currentSelection.roomID) + const currentRoom = data?.find(value => value.id === currentSelection.roomId) const [touched, setTouched] = useState(false) - const isCreating = !initialRoomAndBed.roomID + const isCreating = !initialRoomAndBed.roomId useEffect(() => { setCurrentSelection(initialRoomAndBed) }, [initialRoomAndBed]) - const hasChanges = initialRoomAndBed.bedID !== currentSelection.bedID || initialRoomAndBed.roomID !== currentSelection.roomID + const hasChanges = initialRoomAndBed.bedId !== currentSelection.bedId || initialRoomAndBed.roomId !== currentSelection.roomId const roomSelect = (data && ( ({ value: value.id, label: value.name, disabled: !!value.patient }))} onChange={value => { const newSelection = { ...currentSelection, - bedID: value + bedId: value } setCurrentSelection(newSelection) setTouched(true) @@ -149,8 +149,8 @@ export const RoomBedDropDown = ({ @@ -75,7 +75,7 @@ export const TaskTemplateWardPreview = ({ name={taskTemplate.name} subtaskCount={taskTemplate.subtasks.length} onTileClick={() => { - router.push(`/ward/${wardID}/templates?templateID=${taskTemplate.id}`).then() + router.push(`/ward/${wardId}/templates?templateId=${taskTemplate.id}`).then() }} /> ))} diff --git a/tasks/components/layout/OrganizationDetails.tsx b/tasks/components/layout/OrganizationDetails.tsx index 82ff8246..77e67b1e 100644 --- a/tasks/components/layout/OrganizationDetails.tsx +++ b/tasks/components/layout/OrganizationDetails.tsx @@ -67,8 +67,8 @@ export const OrganizationDetail = ({ updateContext } = useContext(OrganizationContext) - const isCreatingNewOrganization = contextState.organizationID === '' - const { data } = useOrganizationQuery(contextState.organizationID) + const isCreatingNewOrganization = contextState.organizationId === '' + const { data } = useOrganizationQuery(contextState.organizationId) const [isShowingConfirmDialog, setIsShowingConfirmDialog] = useState(false) const [organizationForm, setOrganizationForm] = useState(emptyOrganizationForm) const [organizationInvites, setOrganizationInvites] = useState([]) @@ -83,14 +83,14 @@ export const OrganizationDetail = ({ } }, [data, isCreatingNewOrganization]) - const inviteMemberMutation = useInviteMemberMutation(contextState.organizationID) + const inviteMemberMutation = useInviteMemberMutation(contextState.organizationId) const createMutation = useOrganizationCreateMutation(organization => { organizationInvites.forEach(invite => inviteMemberMutation.mutate({ email: invite.email, - organizationID: organization.id + organizationId: organization.id })) - updateContext({ organizationID: organization.id }) + updateContext({ organizationId: organization.id }) }) const updateMutation = useOrganizationUpdateMutation(organization => { @@ -104,12 +104,12 @@ export const OrganizationDetail = ({ }) const deleteMutation = useOrganizationDeleteMutation(() => updateContext({ - organizationID: '' + organizationId: '' })) return (
setIsShowingConfirmDialog(false)} onConfirm={() => { setIsShowingConfirmDialog(false) - deleteMutation.mutate(contextState.organizationID) + deleteMutation.mutate(contextState.organizationId) }} confirmType="negative" /> @@ -142,7 +142,7 @@ export const OrganizationDetail = ({