cab84e15cb
- Updated the Dashboard component to simplify layout and styling. - Enhanced IconCircle component with improved CSS for better alignment and display. - Refactored global styles for consistency and clarity. - Improved LandingBody component to utilize Link for navigation. - Revamped Header component to manage navigation state more effectively. - Implemented a new LoginPage component for user authentication. - Introduced useSession hook for managing user session state. - Updated CargaArchivo component to use a consistent Button component. - Enhanced Consulta component for better error handling and display. - Cleaned up Footer component styling and structure.
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import "./landing/globals.css";
|
|
|
|
import Header from "./landing/new_header";
|
|
import Footer from "@/components/layout/footer";
|
|
import LandingBody from "./landing/landing_body";
|
|
import { useState } from "react";
|
|
import Dashboard from "./carga/page";
|
|
import Consulta from "./visualizacion/page";
|
|
import LoginPage from "@/containers/LoginPage";
|
|
import { useSession } from "@/hooks/use-session";
|
|
|
|
export type PageKey = "landing" | "login" | "carga" | "consulta" | "publico";
|
|
|
|
export interface HeaderItem {
|
|
label: string;
|
|
page?: PageKey;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
const Home = () => {
|
|
const [page, setPage] = useState<PageKey>("landing");
|
|
const { loading, error, data } = useSession();
|
|
|
|
const handleLogout = () => {
|
|
localStorage.removeItem("token");
|
|
location.reload();
|
|
};
|
|
|
|
const items: HeaderItem[] = data?.id
|
|
? [
|
|
{ label: "Inicio", page: "landing" },
|
|
{ label: "Consulta", page: "consulta" },
|
|
{ label: "Carga", page: "carga" },
|
|
{ label: "Público", page: "publico" },
|
|
{ label: "Cerrar sesión", onClick: handleLogout },
|
|
]
|
|
: [
|
|
{ label: "Consulta", page: "consulta" },
|
|
{ label: "Inicio", page: "landing" },
|
|
{ label: "Login", page: "login" },
|
|
];
|
|
|
|
console.log("items", items);
|
|
return (
|
|
<>
|
|
<Header items={items} onClickItem={setPage} />
|
|
|
|
<div className="flex-grow-1 d-flex flex-column align-items-center justify-content-center text-center">
|
|
{page === "landing" && <LandingBody />}
|
|
{page === "login" && <LoginPage />}
|
|
{page === "consulta" && <Consulta />}
|
|
{page === "carga" && <Dashboard />}
|
|
</div>
|
|
|
|
<Footer />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Home;
|