coronasafe/care_fe

View on GitHub

Showing 1,644 of 1,645 total issues

Function LandingPage has 223 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function LandingPage() {
const { t } = useTranslation();
const [searchQuery, setSearchQuery] = useState("");
const [isOpen, setIsOpen] = useState(false);
const [selectedOrganization, setSelectedOrganization] =
Severity: Major
Found in src/pages/Landing/LandingPage.tsx - About 1 day to fix

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

<TableHeader>
<TableRow className="rounded-md overflow-hidden bg-gray-100">
<TableHead className="first:rounded-l-md h-auto py-1 px-2 text-gray-600">
{t("symptom")}
</TableHead>
Severity: Major
Found in src/components/Patient/symptoms/SymptomTable.tsx and 1 other location - About 1 day to fix
src/components/Patient/MedicationStatementList.tsx on lines 163..187

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

<TableHeader>
<TableRow className="rounded-md overflow-hidden bg-gray-100">
<TableHead className="first:rounded-l-md h-auto py-1 px-2 text-gray-600">
{t("medication")}
</TableHead>
Severity: Major
Found in src/components/Patient/MedicationStatementList.tsx and 1 other location - About 1 day to fix
src/components/Patient/symptoms/SymptomTable.tsx on lines 37..61

File ResourceForm.tsx has 534 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQuery } from "@tanstack/react-query";
import { Link, navigate, useQueryParams } from "raviger";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
Severity: Major
Found in src/components/Resource/ResourceForm.tsx - About 1 day to fix

File UserAvailabilityTab.tsx has 533 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useQuery } from "@tanstack/react-query";
import dayjs from "dayjs";
import { Link, usePathParams, useQueryParams } from "raviger";
import { useCallback, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
Severity: Major
Found in src/components/Users/UserAvailabilityTab.tsx - About 1 day to fix

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

const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newMonth = e.target.value;
setMonth(newMonth);
 
// Check if change is from spinner (stepUp/stepDown) vs keyboard input
Severity: Major
Found in src/components/ui/date-field.tsx and 1 other location - About 1 day to fix
src/components/ui/date-field.tsx on lines 44..68

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

const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
setDay(newDay);
 
// Check if change is from spinner (stepUp/stepDown) vs keyboard input
Severity: Major
Found in src/components/ui/date-field.tsx and 1 other location - About 1 day to fix
src/components/ui/date-field.tsx on lines 70..96

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

<div className="space-y-1">
<p className="text-sm font-medium">{t("phone")}</p>
{patient.phone_number ? (
<div className="flex items-center gap-2">
<a
Severity: Major
Found in src/components/Resource/ResourceDetails.tsx and 1 other location - About 1 day to fix
src/components/Resource/ResourceDetails.tsx on lines 186..208

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

<div className="space-y-1">
<p className="text-sm font-medium">{t("contact_number")}</p>
{data.referring_facility_contact_number ? (
<div className="flex items-center gap-2">
<a
Severity: Major
Found in src/components/Resource/ResourceDetails.tsx and 1 other location - About 1 day to fix
src/components/Resource/ResourceDetails.tsx on lines 43..65

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

{favourites?.map((option) => (
<Item
key={option.code}
option={option}
onSelect={() => {
Severity: Major
Found in src/components/Questionnaire/ValueSetSelect.tsx and 1 other location - About 1 day to fix
src/components/Questionnaire/ValueSetSelect.tsx on lines 240..266

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

{resultsWithRecents.map((option) => (
<Item
key={option.code}
option={option}
onSelect={() => {
Severity: Major
Found in src/components/Questionnaire/ValueSetSelect.tsx and 1 other location - About 1 day to fix
src/components/Questionnaire/ValueSetSelect.tsx on lines 305..331

File FilePreviewDialog.tsx has 522 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
Dispatch,
ReactNode,
SetStateAction,
Suspense,
Severity: Major
Found in src/components/Common/FilePreviewDialog.tsx - About 1 day to fix

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

<TableCell className="py-1">
<Select
value={diagnosis.clinical_status}
onValueChange={(value) =>
onUpdate?.({
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx on lines 789..817

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

{item.questionnaire && (
<div className="mt-4 space-y-4">
{item.questionnaire?.questions.map((question: Question) => {
if (question.type === "structured") return null;
 
 
src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx on lines 317..345

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

<TableCell className="py-1">
<Select
value={diagnosis.verification_status}
onValueChange={(value) =>
onUpdate?.({
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx on lines 761..788

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

{item.questionnaire && (
<div className="mt-4 space-y-4">
{item.questionnaire?.questions.map((question: Question) => {
if (question.type === "structured") return null;
if (question.type === "group") {
src/components/Facility/ConsultationDetails/PrintQuestionnaireQuestionnaireResponses.tsx on lines 361..390

Function QuestionnaireEditor has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

export default function QuestionnaireEditor({ id }: QuestionnaireEditorProps) {
const navigate = useNavigate();
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState<"edit" | "preview">("edit");
const [expandedQuestions, setExpandedQuestions] = useState<Set<string>>(
Severity: Minor
Found in src/components/Questionnaire/QuestionnaireEditor.tsx - About 1 day to fix

File useFileManager.tsx has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { toast } from "sonner";
 
 
Severity: Major
Found in src/hooks/useFileManager.tsx - About 1 day to fix

File PatientInfoCard.tsx has 511 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
BedSingle,
Building,
ChevronDown,
CircleCheck,
Severity: Major
Found in src/components/Patient/PatientInfoCard.tsx - About 1 day to fix

File TreatmentSummary.tsx has 511 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import careConfig from "@careConfig";
import { useQuery } from "@tanstack/react-query";
import { format } from "date-fns";
import { Loader } from "lucide-react";
import { useEffect } from "react";
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx - About 1 day to fix
Severity
Category
Status
Source
Language