diff --git a/frontend/web/app/dashboard/services/page.tsx b/frontend/web/app/dashboard/services/page.tsx index 62454076..fcf4d255 100644 --- a/frontend/web/app/dashboard/services/page.tsx +++ b/frontend/web/app/dashboard/services/page.tsx @@ -1,5 +1,27 @@ +"use client"; + +import { useAtom } from "jotai"; +import { useEffect } from "react"; import DashboardPageWrapper from "@/layouts/dashboard/DashboardPageWrapper"; +import { servicesAtom } from "@/stores"; +import services from "@/services"; +import ServicesList from "@/components/editor/ServicesList"; + +const ServicesPage = () => { + const [cachedServices, setCachedServices] = useAtom(servicesAtom); + + useEffect(() => { + (async () => { + const fetchedServices = await services.services.getAll(); + setCachedServices(fetchedServices.data ?? []); + })(); + }, []); -const ServicesPage = () => ; + return ( + + + + ); +}; export default ServicesPage; diff --git a/frontend/web/components/dashboard/menu/DashboardMenu.tsx b/frontend/web/components/dashboard/menu/DashboardMenu.tsx index 55d3c253..273480db 100644 --- a/frontend/web/components/dashboard/menu/DashboardMenu.tsx +++ b/frontend/web/components/dashboard/menu/DashboardMenu.tsx @@ -11,7 +11,7 @@ const DashboardMenu = ({ isFull }: DashboardMenuProps) => ( - + ); diff --git a/frontend/web/components/editor/ServicesList.tsx b/frontend/web/components/editor/ServicesList.tsx index c963434e..1a6afa32 100644 --- a/frontend/web/components/editor/ServicesList.tsx +++ b/frontend/web/components/editor/ServicesList.tsx @@ -26,8 +26,8 @@ const ServiceElement = ({ type ServicesListProps = { services: Service[]; nbPerLine: number; - selectedServiceId: string | undefined; - setSelectedService: (serviceId: string) => void; + selectedServiceId?: string; + setSelectedService?: (serviceId: string) => void; }; const ServicesList = ({ services, nbPerLine, selectedServiceId, setSelectedService }: ServicesListProps) => { const servicesChunks = splitArrayInChunks(services, nbPerLine); @@ -39,7 +39,9 @@ const ServicesList = ({ services, nbPerLine, selectedServiceId, setSelectedServi {chunk.map((service) => ( setSelectedService(service.id)} + onClick={() => { + if (setSelectedService) setSelectedService(service.id); + }} key={service.id} selected={selectedServiceId === service.id} /> diff --git a/frontend/web/next.config.js b/frontend/web/next.config.js index 9acc4336..e9c6165e 100644 --- a/frontend/web/next.config.js +++ b/frontend/web/next.config.js @@ -5,9 +5,7 @@ const nextConfig = { remotePatterns: [ { protocol: "https", - hostname: "daisyui.com", - port: "", - pathname: "/**", + hostname: "**", }, ], },