"use client"; import Image from "next/image"; import { motion } from "framer-motion"; import { useTranslations } from "next-intl"; import { SystemFeature, } from "@/lib/api/demoapi/operationalSystems"; import { Breadcrumb } from "@/components/breadCrumb"; import { useServiceDetail } from "@/store/useService"; import { useQuery } from "@tanstack/react-query"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; import { cardVariants, containerVariants } from "@/lib/animations"; export default function OperationalSystemsPage() { const t = useTranslations("operationalSystems"); const serviceId = useServiceDetail((state) => state.serviceId); const { data, isLoading: loading, isError: error, } = useQuery({ queryKey: ["firesafety", serviceId], queryFn: () => httpClient(endPoints.services.detail(serviceId || 0)), select: (data) => data?.data?.data, }); // Demo data - fallback ma'lumotlar const demoData: SystemFeature[] = [ { id: "1", title: t("systems.sprinkler.title"), shortDesc: t("systems.sprinkler.short-desc"), description: t("systems.sprinkler.description"), features: [ t("systems.sprinkler.features.0"), t("systems.sprinkler.features.1"), t("systems.sprinkler.features.2"), t("systems.sprinkler.features.3"), ], image: "/images/services/sprinkler.jpg", }, ]; // Loading state if (loading) { return (

{t("loading")}

); } // Error state with retry if (error && !data) { return (
⚠️

{t("error")}

); } return (
{/* Main Content */} {!data || data.legth === 0 ? (

{t("noData")}

) : ( {/* Image Section */} {data.title}
{/* Content Section */}
{data.title} {data.subtitle} {data?.description}
)}
); }