From daf679b31fc793c2457681db96a1104772eeba0d Mon Sep 17 00:00:00 2001 From: seriouselly Date: Sun, 14 Jun 2026 20:57:48 +0700 Subject: [PATCH] chore(components): refine inline comments in diagnosis result view - Update and clarify inline code comments in the diagnosis result view component. - Improve code readability and maintainability without altering any underlying logic or UI behavior. --- .../src/components/diagnose-result-view.tsx | 131 ++++++++++++------ 1 file changed, 89 insertions(+), 42 deletions(-) diff --git a/apps/web/src/components/diagnose-result-view.tsx b/apps/web/src/components/diagnose-result-view.tsx index 091e8ab..4f6a6ba 100644 --- a/apps/web/src/components/diagnose-result-view.tsx +++ b/apps/web/src/components/diagnose-result-view.tsx @@ -1,7 +1,14 @@ import { useState } from "react"; -import { ChevronDown, ChevronUp, AlertTriangle, BookOpen, ShieldCheck, Pill, RefreshCcw } from "lucide-react"; +import { + ChevronDown, + ChevronUp, + AlertTriangle, + BookOpen, + ShieldCheck, + Pill, + RefreshCcw, +} from "lucide-react"; -// Spesifikasi data yang dibutuhkan oleh cetakan ini type Props = { imageUrl: string; confidence: number; // contoh: 0.95 @@ -12,7 +19,7 @@ type Props = { symptoms: string[]; preventions: string[]; medicines: string[]; - onRescan?: () => void; // Tombol opsional untuk Scan Ulang + onRescan?: () => void; }; export function DiagnosisResultView({ @@ -27,7 +34,6 @@ export function DiagnosisResultView({ medicines, onRescan, }: Props) { - // Ingatan untuk laci (accordion) sebelah kanan const [openSection, setOpenSection] = useState("detail"); const toggleSection = (section: string) => { @@ -38,51 +44,56 @@ export function DiagnosisResultView({ return (
- - {/* KIRI: Area Gambar & Hasil Deteksi ML */} + {/* Image Area & Result */}
- {/* Gambar Daun */}
- Daun yang dianalisis
- 📷 + + 📷 + Gambar yang dianalisis
- {/* Kartu Hasil Deteksi ML */} + {/* Result Card */}
HASIL DETEKSI ML
- -

{diseaseName}

+ +

+ {diseaseName} +

{scientificName}

- {/* Bar Tingkat Keyakinan AI */} + {/* Confidence Bar */}
Tingkat Keyakinan AI {confidencePercent}%
-

- Di atas ambang batas minimum (75%) + Di atas ambang batas minimum + (75%)

- Tingkat Keparahan: + + Tingkat Keparahan: + {riskLevel.toUpperCase()} @@ -90,13 +101,12 @@ export function DiagnosisResultView({
- {/* KANAN: Area Edukasi (Accordion) & Referensi */} + {/* Education & References */}
- - {/* Tombol Header (Jika ada fungsi onRescan) */} + {/* Rescan Button */} {onRescan && (
-
)} - {/* Laci 1: Detail Penyakit */} + {/* Detail Section */}
-
toggleSection("detail")} className="flex items-center justify-between p-4 cursor-pointer hover:bg-slate-50" > @@ -117,22 +127,28 @@ export function DiagnosisResultView({
Detail Penyakit
- {openSection === "detail" ? : } + {openSection === "detail" ? ( + + ) : ( + + )}
{openSection === "detail" && (

{description}

Gejala Umum:
    - {symptoms.map((sym, i) =>
  • {sym}
  • )} + {symptoms.map((sym, i) => ( +
  • {sym}
  • + ))}
)}
- {/* Laci 2: Panduan Pencegahan */} + {/* Prevention Section */}
-
toggleSection("cegah")} className="flex items-center justify-between p-4 cursor-pointer hover:bg-slate-50" > @@ -142,14 +158,19 @@ export function DiagnosisResultView({
Panduan Pencegahan
- {openSection === "cegah" ? : } + {openSection === "cegah" ? ( + + ) : ( + + )}
{openSection === "cegah" && (
    {preventions.map((prev, i) => (
  • - {prev} + {" "} + {prev}
  • ))}
@@ -157,9 +178,9 @@ export function DiagnosisResultView({ )}
- {/* Laci 3: Rekomendasi Obat */} + {/* Medicine Section */}
-
toggleSection("obat")} className="flex items-center justify-between p-4 cursor-pointer hover:bg-slate-50" > @@ -169,14 +190,19 @@ export function DiagnosisResultView({
Rekomendasi Obat
- {openSection === "obat" ? : } + {openSection === "obat" ? ( + + ) : ( + + )} {openSection === "obat" && (
-
    +
      {medicines.map((med, i) => (
    • - ⚕️ {med} + ⚕️{" "} + {med}
    • ))}
    @@ -184,22 +210,43 @@ export function DiagnosisResultView({ )}
- {/* Kotak Disclaimer Penting */} + {/* Disclaimer */}
Disclaimer Penting

- ZeaVis Edu adalah alat bantu edukasi awal, bukan pengganti diagnosis profesional. Hasil ini tidak dapat dijadikan dasar keputusan agronomis tanpa konfirmasi dari ahli pertanian atau Petugas Pengamat Organisme Pengganggu Tanaman (POPT) yang berwenang. + ZeaVis Edu adalah alat bantu edukasi awal, bukan + pengganti diagnosis profesional. Hasil ini tidak dapat dijadikan + dasar keputusan agronomis tanpa konfirmasi dari{" "} + + ahli pertanian atau Petugas Pengamat Organisme Pengganggu Tanaman + (POPT) + {" "} + yang berwenang.

- ); } -// Ikon bantuan untuk persentase function CheckCircle2(props: any) { - return -} \ No newline at end of file + return ( + + + + + ); +}