detail page updated , product name zustand clear

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-01-09 11:53:10 +05:00
parent e53d40bd61
commit 733a1a5fc8
5 changed files with 72 additions and 12 deletions

View File

@@ -22,7 +22,7 @@
} }
body { body {
background: var(--background); background: white;
color: var(--foreground); color: var(--foreground);
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }

View File

@@ -1,17 +1,60 @@
import type { Metadata } from "next";
import Image from "next/image";
import { ReactNode } from "react"; import { ReactNode } from "react";
import "../i18n/request"; // i18n config faylini import qilamiz
import { LanguageProvider } from "@/context/language-context"; import "../i18n/request";
import "./globals.css"; import "./globals.css";
import { LanguageProvider } from "@/context/language-context";
import { Navbar } from "@/components/Navbar"; import { Navbar } from "@/components/Navbar";
import { Footer } from "@/components/Footer"; import { Footer } from "@/components/Footer";
export const metadata: Metadata = {
title: {
default: "Texnik Uskunalar | Nasoslar va Datchiklar",
template: "%s | Texnik Uskunalar",
},
description:
"Sanoat uchun moljallangan nasoslar, datchiklar va texnik qurilmalar. Zamonaviy 3D korinishda mahsulotlar katalogi.",
keywords: [
"nasos",
"datchik",
"texnik uskuna",
"industrial equipment",
"sensor",
"pump",
],
authors: [{ name: "Max Di Group" }],
metadataBase: new URL("https://promtechno.uz/"),
openGraph: {
title: "Texnik Uskunalar",
description:
"Nasoslar va datchiklarni 3D korinishda koring va solishtiring",
url: "https://promtechno.uz/",
siteName: "Texnik Uskunalar",
images: [
{
url: "/logo.jpg",
width: 800,
height: 600,
alt: "Texnik Uskunalar logotipi",
},
],
locale: "uz_UZ",
type: "website",
},
icons: {
icon: "/logo.jpg",
},
};
export default function RootLayout({ children }: { children: ReactNode }) { export default function RootLayout({ children }: { children: ReactNode }) {
return ( return (
<html lang="uz"> <html lang="uz" dir="ltr">
<body> <body className="flex min-h-screen flex-col">
<LanguageProvider> <LanguageProvider>
<Navbar /> <Navbar />
{children} <main className="flex-1">{children}</main>
<Footer /> <Footer />
</LanguageProvider> </LanguageProvider>
</body> </body>

View File

@@ -7,6 +7,7 @@ import { motion } from "framer-motion";
import LanguageSwitcher from "./languageSwitcher"; import LanguageSwitcher from "./languageSwitcher";
import { useLanguage } from "@/context/language-context"; import { useLanguage } from "@/context/language-context";
import Image from "next/image"; import Image from "next/image";
import { useProductStore } from "@/lib/productZustand";
interface NavLink { interface NavLink {
id: string; id: string;
@@ -21,6 +22,7 @@ interface NavbarProps {
export function Navbar({ logoText = "FIRMA" }: NavbarProps) { export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const { t } = useLanguage(); const { t } = useLanguage();
const resetProductName = useProductStore((state) => state.resetProductName);
const navLinks: NavLink[] = [ const navLinks: NavLink[] = [
{ id: "about", labelKey: t.nav.about, href: "#about" }, { id: "about", labelKey: t.nav.about, href: "#about" },
@@ -47,9 +49,16 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
<motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}> <motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}>
<Link <Link
href={`/`} href={`/`}
onClick={() => resetProductName()}
className=" relative overflow-hidden" className=" relative overflow-hidden"
> >
<Image src='/logo.jpg' alt="image" width={80} height={50} className="rounded-xl object-cover" /> <Image
src="/logo.jpg"
alt="image"
width={80}
height={50}
className="rounded-xl object-cover"
/>
</Link> </Link>
</motion.div> </motion.div>

View File

@@ -1,8 +1,6 @@
"use client"; "use client";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { X } from "lucide-react";
import type { Product } from "@/lib/products";
import { useLanguage } from "@/context/language-context"; import { useLanguage } from "@/context/language-context";
import Link from "next/link"; import Link from "next/link";
import { useProduct, useProductStore } from "@/lib/productZustand"; import { useProduct, useProductStore } from "@/lib/productZustand";
@@ -14,6 +12,13 @@ export default function DetailInfo() {
const product = useProduct((state) => state.product); const product = useProduct((state) => state.product);
if (product === null) return null; if (product === null) return null;
const handleScroll = (href: string) => {
const element = document.querySelector(href);
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
};
return ( return (
<div className="bg-white"> <div className="bg-white">
<div className="max-w-[1200px] mx-auto"> <div className="max-w-[1200px] mx-auto">
@@ -46,7 +51,10 @@ export default function DetailInfo() {
</div> </div>
{/* CTA Buttons */} {/* CTA Buttons */}
<div className="space-y-3"> <div className="space-y-3">
<Link href={"#contact"}> <Link
href={"#contact"}
onClick={() => handleScroll("#contact")}
>
<motion.button <motion.button
whileHover={{ scale: 1.05 }} whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }} whileTap={{ scale: 0.95 }}

View File

@@ -20,7 +20,7 @@ export default function LanguageSwitcher() {
<div> <div>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<button className="flex items-center gap-1 p-1 border-white border text-black hover:text-primary transition-colors"> <button className="flex items-center gap-1 p-1 border-white border text-primary hover:cursor-pointer transition-colors">
<Globe size={16} /> <Globe size={16} />
{language.toUpperCase()} {language.toUpperCase()}
</button> </button>