coronasafe/care_fe

View on GitHub
src/pages/PublicAppointments/PatientRegistration.tsx

Summary

Maintainability
F
1 wk
Test Coverage

Showing 15 of 15 total issues

Function PatientRegistration has 382 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function PatientRegistration(props: PatientRegistrationProps) {
const { staffId } = props;
const selectedSlot = JSON.parse(
localStorage.getItem("selectedSlot") ?? "",
) as TokenSlot;
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx - About 1 day to fix

File PatientRegistration.tsx has 425 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { navigate, useNavigationPrompt } from "raviger";
import { useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
Severity: Minor
Found in src/pages/PublicAppointments/PatientRegistration.tsx - About 6 hrs to fix

Function PatientRegistration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function PatientRegistration(props: PatientRegistrationProps) {
const { staffId } = props;
const selectedSlot = JSON.parse(
localStorage.getItem("selectedSlot") ?? "",
) as TokenSlot;
Severity: Minor
Found in src/pages/PublicAppointments/PatientRegistration.tsx - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<FormField
control={form.control}
name="gender"
render={({ field }) => (
<FormItem className="space-y-3">
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 1 day to fix
src/components/Patient/PatientRegistration.tsx on lines 464..495

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{form.getValues("age") && (
<div className="text-sm font-bold">
{Number(form.getValues("age")) <= 0 ? (
<span className="text-red-600">
{t("invalid_age")}
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 5 hrs to fix
src/components/Patient/PatientRegistration.tsx on lines 602..616

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<FormField
control={form.control}
name="pincode"
render={({ field }) => (
<FormItem className="flex flex-col">
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 3 hrs to fix
src/pages/PublicAppointments/PatientRegistration.tsx on lines 378..390

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<FormField
control={form.control}
name="address"
render={({ field }) => (
<FormItem className="flex flex-col">
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 3 hrs to fix
src/pages/PublicAppointments/PatientRegistration.tsx on lines 392..404

Identical blocks of code found in 2 locations. Consider refactoring.
Open

<FormControl>
<DateField
date={
field.value ? new Date(field.value) : undefined
}
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 1 hr to fix
src/components/Patient/PatientRegistration.tsx on lines 553..563

Similar blocks of code found in 2 locations. Consider refactoring.
Open

mutationFn: (body: AppointmentCreateRequest) =>
mutate(PublicAppointmentApi.createAppointment, {
pathParams: { id: selectedSlot?.id },
body,
headers: {
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 1 hr to fix
src/pages/PublicAppointments/PatientSelect.tsx on lines 152..159

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<div className="flex items-center gap-2 px-4 py-2">
<RadioGroupItem
id="dob-option"
value="date_of_birth"
/>
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 2 other locations - About 1 hr to fix
src/components/Resource/ResourceDetails.tsx on lines 29..34
src/components/Users/UserForm.tsx on lines 212..220

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<div className="flex items-center gap-2 px-4 py-2">
<RadioGroupItem id="age-option" value="age" />
<Label htmlFor="age-option">{t("age")}</Label>
</div>
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 2 other locations - About 1 hr to fix
src/components/Common/Drawings/DrawingTab.tsx on lines 106..109
src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx on lines 721..724

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Button
variant="outline"
className="border border-secondary-400"
type="button"
onClick={() =>
Severity: Minor
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 50 mins to fix
src/pages/PublicAppointments/PatientRegistration.tsx on lines 429..441

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<Button
variant="white"
className="sm:w-1/5"
type="button"
onClick={() =>
Severity: Minor
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 1 other location - About 50 mins to fix
src/pages/PublicAppointments/PatientRegistration.tsx on lines 205..216

Similar blocks of code found in 4 locations. Consider refactoring.
Open

<Button
variant="primary_gradient"
className="sm:w-1/5"
type="submit"
>
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 3 other locations - About 40 mins to fix
src/components/Facility/FacilityHome.tsx on lines 275..282
src/components/Facility/FacilityHome.tsx on lines 402..409
src/components/Questionnaire/QuestionnaireList.tsx on lines 210..217

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if (
field === "age" &&
data.age &&
!isNaN(Number(data.age)) &&
Number(data.age) < 0
Severity: Minor
Found in src/pages/PublicAppointments/PatientRegistration.tsx and 2 other locations - About 30 mins to fix
src/components/Consent/LinkConsentDialog.tsx on lines 72..78
src/components/Consent/LinkConsentDialog.tsx on lines 80..86

There are no issues that match your filters.

Category
Status