forked from RiseUP/riseup-squad21
adicionando cookies
This commit is contained in:
parent
a82193af27
commit
009df09665
@ -1,10 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useRouter, usePathname } from "next/navigation";
|
import { useRouter, usePathname } from "next/navigation";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import Cookies from "js-cookie"; // <-- 1. IMPORTAÇÃO ADICIONADA
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -24,25 +25,45 @@ interface DoctorData {
|
|||||||
permissions: object;
|
permissions: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DoctorLayoutProps {
|
interface PatientLayoutProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
export default function DoctorLayout({ children }: PatientLayoutProps) {
|
||||||
const [doctorData, setDoctorData] = useState<DoctorData | null>(null);
|
const [doctorData, setDoctorData] = useState<DoctorData | null>(null);
|
||||||
const [sidebarCollapsed, setSidebarCollapsed] = useState(false);
|
const [sidebarCollapsed, setSidebarCollapsed] = useState(false);
|
||||||
const [showLogoutDialog, setShowLogoutDialog] = useState(false);
|
const [showLogoutDialog, setShowLogoutDialog] = useState(false);
|
||||||
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); // Novo estado para menu mobile
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
||||||
const [windowWidth, setWindowWidth] = useState(0);
|
const [windowWidth, setWindowWidth] = useState(0);
|
||||||
const isMobile = windowWidth < 1024; // breakpoint lg
|
const isMobile = windowWidth < 1024;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// ==================================================================
|
||||||
|
// 2. BLOCO DE SEGURANÇA CORRIGIDO
|
||||||
|
// ==================================================================
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const data = localStorage.getItem("doctorData");
|
const userInfoString = localStorage.getItem("user_info");
|
||||||
if (data) {
|
const token = Cookies.get("access_token");
|
||||||
setDoctorData(JSON.parse(data));
|
|
||||||
|
if (userInfoString && token) {
|
||||||
|
const userInfo = JSON.parse(userInfoString);
|
||||||
|
|
||||||
|
// 3. "TRADUZIMOS" os dados da API para o formato que o layout espera
|
||||||
|
setDoctorData({
|
||||||
|
id: userInfo.id || "",
|
||||||
|
name: userInfo.user_metadata?.full_name || "Doutor(a)",
|
||||||
|
email: userInfo.email || "",
|
||||||
|
specialty: userInfo.user_metadata?.specialty || "Especialidade",
|
||||||
|
// Campos que não vêm do login, definidos como vazios para não quebrar
|
||||||
|
phone: userInfo.phone || "",
|
||||||
|
cpf: "",
|
||||||
|
crm: "",
|
||||||
|
department: "",
|
||||||
|
permissions: {},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// Se faltar o token ou os dados, volta para o login
|
||||||
router.push("/doctor/login");
|
router.push("/doctor/login");
|
||||||
}
|
}
|
||||||
}, [router]);
|
}, [router]);
|
||||||
@ -82,7 +103,7 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{
|
{
|
||||||
href: "/doctor/dashboard",
|
href: "#",
|
||||||
icon: Home,
|
icon: Home,
|
||||||
label: "Dashboard",
|
label: "Dashboard",
|
||||||
// Botão para o dashboard do médico
|
// Botão para o dashboard do médico
|
||||||
@ -112,17 +133,17 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background flex">
|
<div className="min-h-screen bg-gray-50 flex">
|
||||||
{/* Sidebar para desktop */}
|
{/* Sidebar para desktop */}
|
||||||
<div className={`bg-card border-r border-border transition-all duration-300 ${sidebarCollapsed ? "w-16" : "w-64"} fixed left-0 top-0 h-screen flex flex-col z-50`}>
|
<div className={`bg-white border-r border-gray-200 transition-all duration-300 ${sidebarCollapsed ? "w-16" : "w-64"} fixed left-0 top-0 h-screen flex flex-col z-50`}>
|
||||||
<div className="p-4 border-b border-border">
|
<div className="p-4 border-b border-gray-200">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
||||||
<div className="w-4 h-4 bg-primary-foreground rounded-sm"></div>
|
<div className="w-4 h-4 bg-white rounded-sm"></div>
|
||||||
</div>
|
</div>
|
||||||
<span className="font-semibold text-foreground">MidConnecta</span>
|
<span className="font-semibold text-gray-900">MidConnecta</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Button variant="ghost" size="sm" onClick={() => setSidebarCollapsed(!sidebarCollapsed)} className="p-1">
|
<Button variant="ghost" size="sm" onClick={() => setSidebarCollapsed(!sidebarCollapsed)} className="p-1">
|
||||||
@ -138,7 +159,7 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Link key={item.href} href={item.href}>
|
<Link key={item.href} href={item.href}>
|
||||||
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`}>
|
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-blue-50 text-blue-600 border-r-2 border-blue-600" : "text-gray-600 hover:bg-gray-50"}`}>
|
||||||
<Icon className="w-5 h-5 flex-shrink-0" />
|
<Icon className="w-5 h-5 flex-shrink-0" />
|
||||||
{!sidebarCollapsed && <span className="font-medium">{item.label}</span>}
|
{!sidebarCollapsed && <span className="font-medium">{item.label}</span>}
|
||||||
</div>
|
</div>
|
||||||
@ -150,15 +171,15 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
// ... (seu código anterior)
|
// ... (seu código anterior)
|
||||||
|
|
||||||
{/* Sidebar para desktop */}
|
{/* Sidebar para desktop */}
|
||||||
<div className={`bg-card border-r border-border transition-all duration-300 ${sidebarCollapsed ? "w-16" : "w-64"} fixed left-0 top-0 h-screen flex flex-col z-50`}>
|
<div className={`bg-white border-r border-gray-200 transition-all duration-300 ${sidebarCollapsed ? "w-16" : "w-64"} fixed left-0 top-0 h-screen flex flex-col z-50`}>
|
||||||
<div className="p-4 border-b border-border">
|
<div className="p-4 border-b border-gray-200">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
||||||
<div className="w-4 h-4 bg-primary-foreground rounded-sm"></div>
|
<div className="w-4 h-4 bg-white rounded-sm"></div>
|
||||||
</div>
|
</div>
|
||||||
<span className="font-semibold text-foreground">MedConnect</span>
|
<span className="font-semibold text-gray-900">MedConnect</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Button variant="ghost" size="sm" onClick={() => setSidebarCollapsed(!sidebarCollapsed)} className="p-1">
|
<Button variant="ghost" size="sm" onClick={() => setSidebarCollapsed(!sidebarCollapsed)} className="p-1">
|
||||||
@ -174,7 +195,7 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Link key={item.href} href={item.href}>
|
<Link key={item.href} href={item.href}>
|
||||||
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`}>
|
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-blue-50 text-blue-600 border-r-2 border-blue-600" : "text-gray-600 hover:bg-gray-50"}`}>
|
||||||
<Icon className="w-5 h-5 flex-shrink-0" />
|
<Icon className="w-5 h-5 flex-shrink-0" />
|
||||||
{!sidebarCollapsed && <span className="font-medium">{item.label}</span>}
|
{!sidebarCollapsed && <span className="font-medium">{item.label}</span>}
|
||||||
</div>
|
</div>
|
||||||
@ -198,8 +219,8 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
</AvatarFallback>
|
</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm font-medium text-foreground truncate">{doctorData.name}</p>
|
<p className="text-sm font-medium text-gray-900 truncate">{doctorData.name}</p>
|
||||||
<p className="text-xs text-muted-foreground truncate">{doctorData.specialty}</p>
|
<p className="text-xs text-gray-500 truncate">{doctorData.specialty}</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -218,7 +239,7 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
{/* Novo botão de sair, usando a mesma estrutura dos itens de menu */}
|
{/* Novo botão de sair, usando a mesma estrutura dos itens de menu */}
|
||||||
<div
|
<div
|
||||||
className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors text-muted-foreground hover:bg-accent hover:text-accent-foreground cursor-pointer ${sidebarCollapsed ? "justify-center" : ""}`}
|
className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors text-gray-600 hover:bg-gray-50 cursor-pointer ${sidebarCollapsed ? "justify-center" : ""}`}
|
||||||
onClick={handleLogout}
|
onClick={handleLogout}
|
||||||
>
|
>
|
||||||
<LogOut className="w-5 h-5 flex-shrink-0" />
|
<LogOut className="w-5 h-5 flex-shrink-0" />
|
||||||
@ -231,15 +252,15 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
{/* Sidebar para mobile (apresentado como um menu overlay) */}
|
{/* Sidebar para mobile (apresentado como um menu overlay) */}
|
||||||
{isMobileMenuOpen && (
|
{isMobileMenuOpen && (
|
||||||
<div className="fixed inset-0 bg-background/50 z-40 md:hidden" onClick={toggleMobileMenu}></div>
|
<div className="fixed inset-0 bg-black bg-opacity-50 z-40 md:hidden" onClick={toggleMobileMenu}></div>
|
||||||
)}
|
)}
|
||||||
<div className={`bg-card border-r border-border fixed left-0 top-0 h-screen flex flex-col z-50 transition-transform duration-300 md:hidden ${isMobileMenuOpen ? "translate-x-0 w-64" : "-translate-x-full w-64"}`}>
|
<div className={`bg-white border-r border-gray-200 fixed left-0 top-0 h-screen flex flex-col z-50 transition-transform duration-300 md:hidden ${isMobileMenuOpen ? "translate-x-0 w-64" : "-translate-x-full w-64"}`}>
|
||||||
<div className="p-4 border-b border-border flex items-center justify-between">
|
<div className="p-4 border-b border-gray-200 flex items-center justify-between">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
||||||
<div className="w-4 h-4 bg-primary-foreground rounded-sm"></div>
|
<div className="w-4 h-4 bg-white rounded-sm"></div>
|
||||||
</div>
|
</div>
|
||||||
<span className="font-semibold text-foreground">Hospital System</span>
|
<span className="font-semibold text-gray-900">Hospital System</span>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="ghost" size="sm" onClick={toggleMobileMenu} className="p-1">
|
<Button variant="ghost" size="sm" onClick={toggleMobileMenu} className="p-1">
|
||||||
<X className="w-4 h-4" />
|
<X className="w-4 h-4" />
|
||||||
@ -253,7 +274,7 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Link key={item.href} href={item.href} onClick={toggleMobileMenu}> {/* Fechar menu ao clicar */}
|
<Link key={item.href} href={item.href} onClick={toggleMobileMenu}> {/* Fechar menu ao clicar */}
|
||||||
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`}>
|
<div className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive ? "bg-blue-50 text-blue-600 border-r-2 border-blue-600" : "text-gray-600 hover:bg-gray-50"}`}>
|
||||||
<Icon className="w-5 h-5 flex-shrink-0" />
|
<Icon className="w-5 h-5 flex-shrink-0" />
|
||||||
<span className="font-medium">{item.label}</span>
|
<span className="font-medium">{item.label}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -274,8 +295,8 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
</AvatarFallback>
|
</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm font-medium text-foreground truncate">{doctorData.name}</p>
|
<p className="text-sm font-medium text-gray-900 truncate">{doctorData.name}</p>
|
||||||
<p className="text-xs text-muted-foreground truncate">{doctorData.specialty}</p>
|
<p className="text-xs text-gray-500 truncate">{doctorData.specialty}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="outline" size="sm" className="w-full bg-transparent" onClick={() => { handleLogout(); toggleMobileMenu(); }}> {/* Fechar menu ao deslogar */}
|
<Button variant="outline" size="sm" className="w-full bg-transparent" onClick={() => { handleLogout(); toggleMobileMenu(); }}> {/* Fechar menu ao deslogar */}
|
||||||
@ -289,19 +310,19 @@ export default function DoctorLayout({ children }: DoctorLayoutProps) {
|
|||||||
{/* Main Content */}
|
{/* Main Content */}
|
||||||
<div className={`flex-1 flex flex-col transition-all duration-300 ${sidebarCollapsed ? "ml-16" : "ml-64"}`}>
|
<div className={`flex-1 flex flex-col transition-all duration-300 ${sidebarCollapsed ? "ml-16" : "ml-64"}`}>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="bg-card border-b border-border px-6 py-4">
|
<header className="bg-white border-b border-gray-200 px-6 py-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-4 flex-1">
|
<div className="flex items-center gap-4 flex-1">
|
||||||
<div className="relative flex-1 max-w-md">
|
<div className="relative flex-1 max-w-md">
|
||||||
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||||
<Input placeholder="Buscar paciente" className="pl-10 bg-background border-border" />
|
<Input placeholder="Buscar paciente" className="pl-10 bg-gray-50 border-gray-200" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<Button variant="ghost" size="sm" className="relative">
|
<Button variant="ghost" size="sm" className="relative">
|
||||||
<Bell className="w-5 h-5" />
|
<Bell className="w-5 h-5" />
|
||||||
<Badge className="absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center bg-destructive text-destructive-foreground text-xs">1</Badge>
|
<Badge className="absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center bg-red-500 text-white text-xs">1</Badge>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import Cookies from "js-cookie";
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useRouter, usePathname } from "next/navigation";
|
import { useRouter, usePathname } from "next/navigation";
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import type React from "react";
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useRouter, usePathname } from "next/navigation";
|
import { useRouter, usePathname } from "next/navigation";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import Cookies from "js-cookie"; // <-- 1. IMPORTAÇÃO ADICIONADA
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -37,7 +39,7 @@ interface ManagerData {
|
|||||||
permissions: object;
|
permissions: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ManagerLayoutProps {
|
interface ManagerLayoutProps { // Corrigi o nome da prop aqui
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,15 +50,34 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// ==================================================================
|
||||||
|
// 2. BLOCO DE SEGURANÇA CORRIGIDO
|
||||||
|
// ==================================================================
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const data = localStorage.getItem("managerData");
|
const userInfoString = localStorage.getItem("user_info");
|
||||||
if (data) {
|
const token = Cookies.get("access_token");
|
||||||
setManagerData(JSON.parse(data));
|
|
||||||
|
if (userInfoString && token) {
|
||||||
|
const userInfo = JSON.parse(userInfoString);
|
||||||
|
|
||||||
|
// 3. "TRADUZIMOS" os dados da API para o formato que o layout espera
|
||||||
|
setManagerData({
|
||||||
|
id: userInfo.id || "",
|
||||||
|
name: userInfo.user_metadata?.full_name || "Gestor(a)",
|
||||||
|
email: userInfo.email || "",
|
||||||
|
department: userInfo.user_metadata?.role || "Gestão",
|
||||||
|
// Campos que não vêm do login, definidos como vazios para não quebrar
|
||||||
|
phone: userInfo.phone || "",
|
||||||
|
cpf: "",
|
||||||
|
permissions: {},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// Se faltar o token ou os dados, volta para o login
|
||||||
router.push("/manager/login");
|
router.push("/manager/login");
|
||||||
}
|
}
|
||||||
}, [router]);
|
}, [router]);
|
||||||
|
|
||||||
|
|
||||||
// 🔥 Responsividade automática da sidebar
|
// 🔥 Responsividade automática da sidebar
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleResize = () => {
|
const handleResize = () => {
|
||||||
@ -84,10 +105,10 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
const cancelLogout = () => setShowLogoutDialog(false);
|
const cancelLogout = () => setShowLogoutDialog(false);
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{ href: "/manager/dashboard", icon: Home, label: "Dashboard" },
|
{ href: "#", icon: Home, label: "Dashboard" },
|
||||||
{ href: "#", icon: Calendar, label: "Relatórios gerenciais" },
|
{ href: "#", icon: Calendar, label: "Relatórios gerenciais" },
|
||||||
{ href: "/manager/usuario", icon: User, label: "Gestão de Usuários" },
|
{ href: "#", icon: User, label: "Gestão de Usuários" },
|
||||||
{ href: "/manager/home", icon: User, label: "Gestão de Médicos" },
|
{ href: "#", icon: User, label: "Gestão de Médicos" },
|
||||||
{ href: "#", icon: Calendar, label: "Configurações" },
|
{ href: "#", icon: Calendar, label: "Configurações" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -96,20 +117,20 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background flex">
|
<div className="min-h-screen bg-gray-50 flex">
|
||||||
{/* Sidebar */}
|
{/* Sidebar */}
|
||||||
<div
|
<div
|
||||||
className={`bg-card border-r border-border transition-all duration-300 fixed top-0 h-screen flex flex-col z-30
|
className={`bg-white border-r border-gray-200 transition-all duration-300 fixed top-0 h-screen flex flex-col z-30
|
||||||
${sidebarCollapsed ? "w-16" : "w-64"}`}
|
${sidebarCollapsed ? "w-16" : "w-64"}`}
|
||||||
>
|
>
|
||||||
{/* Logo + collapse button */}
|
{/* Logo + collapse button */}
|
||||||
<div className="p-4 border-b border-border flex items-center justify-between">
|
<div className="p-4 border-b border-gray-200 flex items-center justify-between">
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
||||||
<div className="w-4 h-4 bg-primary-foreground rounded-sm"></div>
|
<div className="w-4 h-4 bg-white rounded-sm"></div>
|
||||||
</div>
|
</div>
|
||||||
<span className="font-semibold text-foreground">
|
<span className="font-semibold text-gray-900">
|
||||||
MidConnecta
|
MidConnecta
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -139,9 +160,10 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
return (
|
return (
|
||||||
<Link key={item.href} href={item.href}>
|
<Link key={item.href} href={item.href}>
|
||||||
<div
|
<div
|
||||||
className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${isActive
|
className={`flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors ${
|
||||||
? "bg-accent text-accent-foreground"
|
isActive
|
||||||
: "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
? "bg-blue-50 text-blue-600 border-r-2 border-blue-600"
|
||||||
|
: "text-gray-600 hover:bg-gray-50"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Icon className="w-5 h-5 flex-shrink-0" />
|
<Icon className="w-5 h-5 flex-shrink-0" />
|
||||||
@ -168,10 +190,10 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
</Avatar>
|
</Avatar>
|
||||||
{!sidebarCollapsed && (
|
{!sidebarCollapsed && (
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm font-medium text-foreground truncate">
|
<p className="text-sm font-medium text-gray-900 truncate">
|
||||||
{managerData.name}
|
{managerData.name}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-muted-foreground truncate">
|
<p className="text-xs text-gray-500 truncate">
|
||||||
{managerData.department}
|
{managerData.department}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -204,14 +226,14 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
${sidebarCollapsed ? "ml-16" : "ml-64"}`}
|
${sidebarCollapsed ? "ml-16" : "ml-64"}`}
|
||||||
>
|
>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="bg-card border-b border-border px-4 md:px-6 py-4 flex items-center justify-between">
|
<header className="bg-white border-b border-gray-200 px-4 md:px-6 py-4 flex items-center justify-between">
|
||||||
{/* Search */}
|
{/* Search */}
|
||||||
<div className="flex items-center gap-4 flex-1 max-w-md">
|
<div className="flex items-center gap-4 flex-1 max-w-md">
|
||||||
<div className="relative flex-1">
|
<div className="relative flex-1">
|
||||||
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||||
<Input
|
<Input
|
||||||
placeholder="Buscar paciente"
|
placeholder="Buscar paciente"
|
||||||
className="pl-10 bg-background border-border"
|
className="pl-10 bg-gray-50 border-gray-200"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -220,7 +242,7 @@ export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
|||||||
<div className="flex items-center gap-4 ml-auto">
|
<div className="flex items-center gap-4 ml-auto">
|
||||||
<Button variant="ghost" size="sm" className="relative">
|
<Button variant="ghost" size="sm" className="relative">
|
||||||
<Bell className="w-5 h-5" />
|
<Bell className="w-5 h-5" />
|
||||||
<Badge className="absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center bg-destructive text-destructive-foreground text-xs">
|
<Badge className="absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center bg-red-500 text-white text-xs">
|
||||||
1
|
1
|
||||||
</Badge>
|
</Badge>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
|
||||||
|
import Cookies from "js-cookie";
|
||||||
import type React from "react"
|
import type React from "react"
|
||||||
import { useState, useEffect } from "react"
|
import { useState, useEffect } from "react"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { useRouter, usePathname } from "next/navigation"
|
import { useRouter, usePathname } from "next/navigation"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import Cookies from "js-cookie"
|
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import type React from "react"
|
|||||||
import { useState, useEffect } from "react"
|
import { useState, useEffect } from "react"
|
||||||
import { useRouter, usePathname } from "next/navigation"
|
import { useRouter, usePathname } from "next/navigation"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
|
import Cookies from "js-cookie";
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user