Spaces:
Running
Running
Update frontend/src/components/Sidebar.tsx
Browse files
frontend/src/components/Sidebar.tsx
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
interface SidebarProps {
|
| 4 |
selectedTest: string;
|
|
@@ -6,57 +14,81 @@ interface SidebarProps {
|
|
| 6 |
}
|
| 7 |
|
| 8 |
export function Sidebar({ selectedTest, onTestChange }: SidebarProps) {
|
|
|
|
|
|
|
| 9 |
const testTypes = [
|
| 10 |
-
{ value:
|
| 11 |
-
{ value:
|
| 12 |
-
{ value:
|
| 13 |
];
|
| 14 |
|
| 15 |
return (
|
| 16 |
-
<aside className="w-
|
| 17 |
-
<div className="space-y-
|
| 18 |
-
{/*
|
| 19 |
-
<
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
</div>
|
| 47 |
|
| 48 |
-
{/*
|
| 49 |
-
<
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
</div>
|
| 60 |
</aside>
|
| 61 |
);
|
| 62 |
-
}
|
|
|
|
| 1 |
+
import { useState } from "react";
|
| 2 |
+
import {
|
| 3 |
+
FileTextIcon,
|
| 4 |
+
HelpCircleIcon,
|
| 5 |
+
PlusCircle,
|
| 6 |
+
ChevronDown,
|
| 7 |
+
ChevronRight,
|
| 8 |
+
} from "lucide-react";
|
| 9 |
+
import { Microscope, Stethoscope, FlaskConical } from "lucide-react";
|
| 10 |
|
| 11 |
interface SidebarProps {
|
| 12 |
selectedTest: string;
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
export function Sidebar({ selectedTest, onTestChange }: SidebarProps) {
|
| 17 |
+
const [isTestOpen, setIsTestOpen] = useState(true);
|
| 18 |
+
|
| 19 |
const testTypes = [
|
| 20 |
+
{ value: "cytology", label: "Cytology Analysis", icon: Microscope },
|
| 21 |
+
{ value: "colposcopy", label: "Colposcopy Analysis", icon: Stethoscope },
|
| 22 |
+
{ value: "histopathology", label: "Histopathology Analysis", icon: FlaskConical },
|
| 23 |
];
|
| 24 |
|
| 25 |
return (
|
| 26 |
+
<aside className="w-72 h-screen bg-white border-r border-gray-200 p-4 flex flex-col justify-between">
|
| 27 |
+
<div className="space-y-2">
|
| 28 |
+
{/* --- Start New Test Dropdown --- */}
|
| 29 |
+
<div>
|
| 30 |
+
<button
|
| 31 |
+
onClick={() => setIsTestOpen(!isTestOpen)}
|
| 32 |
+
className="flex items-center justify-between w-full px-3 py-3 rounded-lg hover:bg-gray-50 transition-colors text-gray-800 font-semibold"
|
| 33 |
+
>
|
| 34 |
+
<div className="flex items-center gap-3">
|
| 35 |
+
<PlusCircle className="w-5 h-5 text-teal-600" />
|
| 36 |
+
<span>Start New Test</span>
|
| 37 |
+
</div>
|
| 38 |
+
{isTestOpen ? (
|
| 39 |
+
<ChevronDown className="w-5 h-5 text-gray-500" />
|
| 40 |
+
) : (
|
| 41 |
+
<ChevronRight className="w-5 h-5 text-gray-500" />
|
| 42 |
+
)}
|
| 43 |
+
</button>
|
| 44 |
+
|
| 45 |
+
{isTestOpen && (
|
| 46 |
+
<div className="mt-1 ml-6 space-y-1">
|
| 47 |
+
{testTypes.map(({ value, label, icon: Icon }) => (
|
| 48 |
+
<button
|
| 49 |
+
key={value}
|
| 50 |
+
onClick={() => onTestChange(value)}
|
| 51 |
+
className={`flex items-center w-full gap-3 px-3 py-2 rounded-md text-sm transition-all duration-200
|
| 52 |
+
${
|
| 53 |
+
selectedTest === value
|
| 54 |
+
? "bg-gradient-to-r from-teal-700 to-teal-600 text-white font-medium shadow-sm"
|
| 55 |
+
: "text-gray-700 hover:bg-gray-50"
|
| 56 |
+
}`}
|
| 57 |
+
>
|
| 58 |
+
<Icon
|
| 59 |
+
className={`w-4 h-4 ${
|
| 60 |
+
selectedTest === value ? "text-white" : "text-gray-500"
|
| 61 |
+
}`}
|
| 62 |
+
/>
|
| 63 |
+
<span
|
| 64 |
+
className={`${
|
| 65 |
+
selectedTest === value ? "text-white" : "text-gray-700"
|
| 66 |
+
}`}
|
| 67 |
+
>
|
| 68 |
+
{label}
|
| 69 |
+
</span>
|
| 70 |
+
</button>
|
| 71 |
+
))}
|
| 72 |
+
</div>
|
| 73 |
+
)}
|
| 74 |
</div>
|
| 75 |
|
| 76 |
+
{/* --- Divider --- */}
|
| 77 |
+
<hr className="border-gray-200 my-4" />
|
| 78 |
+
|
| 79 |
+
{/* --- Other Options --- */}
|
| 80 |
+
<div>
|
| 81 |
+
<button className="w-full flex items-center gap-3 px-3 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
|
| 82 |
+
<FileTextIcon className="w-5 h-5 text-gray-500" />
|
| 83 |
+
<span>History</span>
|
| 84 |
+
</button>
|
| 85 |
+
|
| 86 |
+
<button className="w-full flex items-center gap-3 px-3 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
|
| 87 |
+
<HelpCircleIcon className="w-5 h-5 text-gray-500" />
|
| 88 |
+
<span>Help</span>
|
| 89 |
+
</button>
|
| 90 |
+
</div>
|
| 91 |
</div>
|
| 92 |
</aside>
|
| 93 |
);
|
| 94 |
+
}
|