diff --git a/frontend/src/components/ui/lab-staff/Dialog.jsx b/frontend/src/components/ui/lab-staff/Dialog.jsx index 994baf4..b1112be 100644 --- a/frontend/src/components/ui/lab-staff/Dialog.jsx +++ b/frontend/src/components/ui/lab-staff/Dialog.jsx @@ -1,24 +1,58 @@ -// Dialog.js import React, { useState } from 'react'; +import { useDarkMode } from "../../../helpers/DarkModeContext"; export const Dialog = ({ children }) =>
{children}
; export const DialogTrigger = ({ asChild, children }) => { const [isOpen, setIsOpen] = useState(false); - const child = React.cloneElement(children, { onClick: () => setIsOpen(!isOpen) }); + const child = React.cloneElement(children, { + onClick: () => setIsOpen(!isOpen), + }); return <>{child}; }; -export const DialogContent = ({ children }) => ( -
-
{children}
-
-); +export const DialogContent = ({ children }) => { + const { darkMode } = useDarkMode(); + + return ( +
+
+ {children} +
+
+ ); +}; -export const DialogHeader = ({ children }) => ( -
{children}
-); +export const DialogHeader = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( +
+ {children} +
+ ); +}; -export const DialogTitle = ({ children }) => ( -

{children}

-); +export const DialogTitle = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( +

+ {children} +

+ ); +}; diff --git a/frontend/src/components/ui/lab-staff/common/Sidebar.jsx b/frontend/src/components/ui/lab-staff/common/Sidebar.jsx index 998fdaa..eb16f64 100644 --- a/frontend/src/components/ui/lab-staff/common/Sidebar.jsx +++ b/frontend/src/components/ui/lab-staff/common/Sidebar.jsx @@ -1,62 +1,63 @@ import { Link, useLocation } from "react-router-dom"; -import { Home, User, CalendarDays, FileText, PieChart, Settings, Clipboard, TestTube } from "lucide-react"; // Icon importlarını unutmayın -import { useParams } from "react-router-dom"; +import { Home, User, CalendarDays, FileText, PieChart, Settings, TestTube } from "lucide-react"; import { useSelector } from "react-redux"; +import { useDarkMode } from "../../../../helpers/DarkModeContext"; import { useEffect, useState } from "react"; export default function Sidebar() { - const location = useLocation(); - - const isActive = (path) => location.pathname === path; + const location = useLocation(); + const { darkMode } = useDarkMode(); const { userId } = useSelector((state) => state.auth); - const [currentPath, setCurrentPath] = useState(location.pathname); // Sayfa değişim kontrolü - const links = [ { - to: `/labtechnician/${userId}/tests`, - label: "Tests", - icon: TestTube, + to: `/labtechnician/${userId}/tests`, + label: "Tests", + icon: TestTube, }, { - to: `/labtechnician/${userId}/settings`, - label: "Settings", - icon: Settings, + to: `/labtechnician/${userId}/settings`, + label: "Settings", + icon: Settings, }, - ]; + ]; - // Eğer pathname değişirse "soft refresh" yap - useEffect(() => { - if (location.pathname !== currentPath) { - setCurrentPath(location.pathname); // Path güncelleniyor - window.location.reload(); // Sayfa yenileniyor - } - }, [location.pathname]); - return ( - + ); } diff --git a/frontend/src/components/ui/lab-staff/tests/Button.jsx b/frontend/src/components/ui/lab-staff/tests/Button.jsx index 1f44f04..ecc76b0 100644 --- a/frontend/src/components/ui/lab-staff/tests/Button.jsx +++ b/frontend/src/components/ui/lab-staff/tests/Button.jsx @@ -1,13 +1,14 @@ -// Button.js import React from 'react'; +import { useDarkMode } from "../../../../helpers/DarkModeContext"; export const Button = ({ children, onClick, variant = 'default', size = 'md' }) => { - const baseStyle = 'inline-flex items-center justify-center rounded-md'; + const { darkMode } = useDarkMode(); + const baseStyle = 'inline-flex items-center justify-center rounded-md transition-all duration-300'; const sizeStyle = size === 'sm' ? 'px-2 py-1 text-sm' : 'px-4 py-2'; const variantStyle = variant === 'outline' - ? 'border border-gray-300 text-gray-700 hover:bg-gray-100' - : 'bg-gray-600 text-white hover:bg-gray-700'; + ? `${darkMode ? 'border border-gray-500 text-gray-300 hover:bg-gray-700' : 'border border-gray-300 text-gray-700 hover:bg-gray-100'}` + : `${darkMode ? 'bg-blue-700 text-white hover:bg-blue-800' : 'bg-blue-600 text-white hover:bg-blue-700'}`; return ( + ); }; -export const DialogContent = ({ isOpen, closeDialog, children }) => { - console.log("Dialog open status:", isOpen); // Debug log - if (!isOpen) return null; - +export const DialogTitle = ({ children }) => { + const { darkMode } = useDarkMode(); return ( -
-
- {children} - -
-
+

+ {children} +

); }; - -export const DialogHeader = ({ children }) => ( -
{children}
-); - -export const DialogTitle = ({ children }) => ( -

{children}

-); diff --git a/frontend/src/components/ui/lab-staff/tests/Input.jsx b/frontend/src/components/ui/lab-staff/tests/Input.jsx index 77814b3..acae592 100644 --- a/frontend/src/components/ui/lab-staff/tests/Input.jsx +++ b/frontend/src/components/ui/lab-staff/tests/Input.jsx @@ -1,10 +1,16 @@ +import { useDarkMode } from "../../../../helpers/DarkModeContext"; + export function Input({ type = "text", className = "", ...props }) { - return ( - - ); - } - \ No newline at end of file + const { darkMode } = useDarkMode(); + return ( + + ); +} diff --git a/frontend/src/components/ui/lab-staff/tests/Label.jsx b/frontend/src/components/ui/lab-staff/tests/Label.jsx index 184a89f..5e38cf4 100644 --- a/frontend/src/components/ui/lab-staff/tests/Label.jsx +++ b/frontend/src/components/ui/lab-staff/tests/Label.jsx @@ -1,8 +1,15 @@ +import { useDarkMode } from "../../../../helpers/DarkModeContext"; + export function Label({ htmlFor, children, className = "" }) { - return ( - - ); - } - \ No newline at end of file + const { darkMode } = useDarkMode(); + return ( + + ); +} diff --git a/frontend/src/components/ui/lab-staff/tests/Select.jsx b/frontend/src/components/ui/lab-staff/tests/Select.jsx index cfb2f7d..425846e 100644 --- a/frontend/src/components/ui/lab-staff/tests/Select.jsx +++ b/frontend/src/components/ui/lab-staff/tests/Select.jsx @@ -1,41 +1,73 @@ import React from "react"; +import { useDarkMode } from "../../../../helpers/DarkModeContext"; export function Select({ children, disabled }) { + const { darkMode } = useDarkMode(); return ( -
+
{children}
); } -export function SelectTrigger({ children, id }) { +export function SelectTrigger({ children, value, onClick }) { + const { darkMode } = useDarkMode(); return ( ); } export function SelectValue({ placeholder }) { - return {placeholder}; + const { darkMode } = useDarkMode(); + return ( + + {placeholder} + + ); } -export function SelectContent({ children }) { +export function SelectContent({ children, isOpen }) { + const { darkMode } = useDarkMode(); + if (!isOpen) return null; + return ( -
+
{children}
); } -export function SelectItem({ value, children }) { +export function SelectItem({ value, children, onSelect }) { + const { darkMode } = useDarkMode(); return (
console.log(`Selected: ${value}`)} + className={`p-2 cursor-pointer transition-all duration-300 ${ + darkMode + ? "hover:bg-gray-900 text-white" + : "hover:bg-gray-100 text-black" + }`} + onClick={() => { + if (onSelect) onSelect(value); + }} > {children}
diff --git a/frontend/src/components/ui/lab-staff/tests/Table.jsx b/frontend/src/components/ui/lab-staff/tests/Table.jsx index 7bfdac9..0e18fba 100644 --- a/frontend/src/components/ui/lab-staff/tests/Table.jsx +++ b/frontend/src/components/ui/lab-staff/tests/Table.jsx @@ -1,23 +1,68 @@ -export const Table = ({ children }) => ( - {children}
-); +import { useDarkMode } from "../../../../helpers/DarkModeContext"; -export const TableHeader = ({ children }) => ( - {children} -); +export const Table = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( + + {children} +
+ ); +}; -export const TableRow = ({ children }) => ( - {children} -); +export const TableHeader = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( + + {children} + + ); +}; -export const TableHead = ({ children }) => ( - - {children} - -); +export const TableRow = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( + + {children} + + ); +}; + +export const TableHead = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( + + {children} + + ); +}; export const TableBody = ({ children }) => {children}; -export const TableCell = ({ children }) => ( - {children} -); +export const TableCell = ({ children }) => { + const { darkMode } = useDarkMode(); + return ( + + {children} + + ); +}; diff --git a/frontend/src/components/ui/lab-staff/tests/TextArea.jsx b/frontend/src/components/ui/lab-staff/tests/TextArea.jsx index ca2a654..d11c24c 100644 --- a/frontend/src/components/ui/lab-staff/tests/TextArea.jsx +++ b/frontend/src/components/ui/lab-staff/tests/TextArea.jsx @@ -1,6 +1,9 @@ import React from "react"; +import { useDarkMode } from "../../../../helpers/DarkModeContext"; export function Textarea({ id, value, readOnly, onChange, placeholder }) { + const { darkMode } = useDarkMode(); + return (