coronasafe/care_fe

View on GitHub
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx

Summary

Maintainability
D
2 days
Test Coverage

Showing 10 of 10 total issues

File CreateScheduleExceptionSheet.tsx has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { isAfter, isBefore, parse } from "date-fns";
import { useQueryParams } from "raviger";
import { useEffect } from "react";
Severity: Minor
Found in src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx - About 3 hrs to fix

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

<FormField
control={form.control}
name="valid_from"
render={({ field }) => (
<FormItem>
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 233..246

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

<FormField
control={form.control}
name="valid_to"
render={({ field }) => (
<FormItem>
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 218..231

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

<FormField
control={form.control}
name="end_time"
render={({ field }) => (
<FormItem>
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 268..284

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

<FormField
control={form.control}
name="start_time"
render={({ field }) => (
<FormItem>
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 286..302

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

<SheetHeader>
<SheetTitle>{t("add_schedule_exceptions")}</SheetTitle>
<SheetDescription>
{t("add_schedule_exceptions_description")}
</SheetDescription>
src/components/Common/Drawings/ExcalidrawEditor.tsx on lines 133..138
src/components/Encounter/EncounterActions.tsx on lines 116..121
src/components/Encounter/EncounterActions.tsx on lines 183..188
src/components/Location/LocationSheet.tsx on lines 823..828
src/components/Location/LocationSheet.tsx on lines 850..855
src/components/Patient/PatientIndex.tsx on lines 250..255
src/components/Questionnaire/CloneQuestionnaireSheet.tsx on lines 117..122
src/pages/Encounters/AssociateDeviceSheet.tsx on lines 63..68
src/pages/Facility/settings/devices/components/ManageLocationSheet.tsx on lines 93..98
src/pages/Facility/settings/organizations/components/EditFacilityUserRoleSheet.tsx on lines 138..143
src/pages/Facility/settings/organizations/components/LinkFacilityUserSheet.tsx on lines 126..131
src/pages/Organization/components/EditUserRoleSheet.tsx on lines 142..147
src/pages/Organization/components/LinkUserSheet.tsx on lines 125..130

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

useEffect(() => {
if (qParams.valid_to) {
form.setValue("valid_to", new Date(qParams.valid_to));
}
}, [qParams.valid_to, form]);
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 110..114

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

useEffect(() => {
if (qParams.valid_from) {
form.setValue("valid_from", new Date(qParams.valid_from));
}
}, [qParams.valid_from, form]);
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 116..120

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

end_time: z
.string()
.min(1, t("field_required")) as unknown as z.ZodType<Time>,
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 69..71
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 103..105
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 106..108
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 125..127
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 128..130
src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx on lines 574..576
src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx on lines 577..579

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

start_time: z
.string()
.min(1, t("field_required")) as unknown as z.ZodType<Time>,
src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx on lines 72..74
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 103..105
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 106..108
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 125..127
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx on lines 128..130
src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx on lines 574..576
src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx on lines 577..579
Category
Status