coronasafe/care_fe

View on GitHub
src/pages/Encounters/tabs/EncounterNotesTab.tsx

Summary

Maintainability
D
2 days
Test Coverage

Showing 8 of 8 total issues

File EncounterNotesTab.tsx has 689 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
useInfiniteQuery,
useMutation,
useQuery,
useQueryClient,
Severity: Major
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx - About 1 day to fix

Function EncounterNotesTab has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export const EncounterNotesTab = ({ encounter }: EncounterTabProps) => {
const { t } = useTranslation();
const queryClient = useQueryClient();
const [selectedThread, setSelectedThread] = useState<string | null>(null);
const [isThreadsExpanded, setIsThreadsExpanded] = useState(false);
Severity: Minor
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx - About 4 hrs to fix

Function MessageItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function MessageItem({
message,
...props
}: React.ComponentProps<"div"> & { message: Message }) {
const authUser = useAuthUser();
Severity: Minor
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx - About 35 mins to fix

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

<div className="space-y-2">
<Input
placeholder={t("encounter_notes__enter_discussion_title")}
value={title}
onChange={(e) => setTitle(e.target.value)}
Severity: Major
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx and 1 other location - About 1 hr to fix
src/pages/Facility/locations/LocationContent.tsx on lines 263..270

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

{threadsData?.results.length === 0 ? (
<div className="text-center py-6">
<MessageSquarePlus className="size-8 text-primary mx-auto mb-3" />
<p className="text-sm text-gray-500">
{t("encounter_notes__no_discussions")}
Severity: Major
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx and 1 other location - About 1 hr to fix
src/pages/Encounters/tabs/EncounterNotesTab.tsx on lines 559..578

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

{threadsData?.results.length === 0 ? (
<div className="text-center py-6">
<MessageSquarePlus className="size-8 text-primary mx-auto mb-3" />
<p className="text-sm text-gray-500">
{t("encounter_notes__no_discussions")}
Severity: Major
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx and 1 other location - About 1 hr to fix
src/pages/Encounters/tabs/EncounterNotesTab.tsx on lines 505..521

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

{isFetchingNextPage ? (
<div className="py-2">
<div className="space-y-4">
<CardListSkeleton count={3} />
</div>
Severity: Minor
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx and 1 other location - About 50 mins to fix
src/pages/Encounters/tabs/EncounterNotesTab.tsx on lines 620..710

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

{messagesLoading ? (
<div className="flex-1 p-4">
<div className="space-y-4">
<CardListSkeleton count={4} />
</div>
Severity: Minor
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx and 1 other location - About 50 mins to fix
src/pages/Encounters/tabs/EncounterNotesTab.tsx on lines 658..666

There are no issues that match your filters.

Category
Status