fix: move BackToTop to right side, wire global prescription modal trigger in header & mobile drawer
Deploy Canina / deploy (push) Successful in 2m15s
Deploy Canina / deploy (push) Successful in 2m15s
This commit is contained in:
1 parent
94867fbd5a
commit
b077423ab2
5 files changed
+33
-11
No files matched your search
@@ -38,7 +38,8 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
|
||||
const setLoginModalOpen = useUIStore((state) => state.setLoginModalOpen);
|
||||
const setB2BPortalOpen = useUIStore((state) => state.setB2BPortalOpen);
|
||||
const clearAdvisorData = useUIStore((state) => state.clearAdvisorData);
|
||||
const [isPrescriptionModalOpen, setIsPrescriptionModalOpen] = useState(false);
|
||||
const isPrescriptionModalOpen = useUIStore((state) => state.isPrescriptionModalOpen);
|
||||
const setPrescriptionModalOpen = useUIStore((state) => state.setPrescriptionModalOpen);
|
||||
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
@@ -230,15 +231,11 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
|
||||
/>}
|
||||
<PrescriptionUploadModal
|
||||
isOpen={isPrescriptionModalOpen}
|
||||
onClose={() => setIsPrescriptionModalOpen(false)}
|
||||
onClose={() => setPrescriptionModalOpen(false)}
|
||||
/>
|
||||
<MobileBottomNav
|
||||
onPrescriptionOpen={() => {
|
||||
if (!isLoggedIn) {
|
||||
setAuthModalOpen(true);
|
||||
} else {
|
||||
setIsPrescriptionModalOpen(true);
|
||||
}
|
||||
setPrescriptionModalOpen(true);
|
||||
}}
|
||||
/>
|
||||
<Toaster position="top-center" expand={true} richColors closeButton />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import Image from "next/image";
|
||||
import { Phone, Mail, MapPin, Instagram, ShieldCheck, Globe, ArrowUp, Download, ChevronDown, ChevronUp } from "lucide-react";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
@@ -8,7 +9,9 @@ import Link from "next/link";
|
||||
|
||||
import { NavigationTarget } from "../lib/types";
|
||||
|
||||
export default function Footer({
|
||||
export default function Footer({
|
||||
// Footer hooks
|
||||
|
||||
onB2BOpen
|
||||
}: {
|
||||
onNavigate?: (v: NavigationTarget) => void;
|
||||
@@ -17,6 +20,8 @@ export default function Footer({
|
||||
}) {
|
||||
const getText = useSettingsStore(state => state.getText);
|
||||
const isB2BEnabled = useSettingsStore((s) => s.getBoolean('b2bRegistrationOpen', true) && s.getBoolean('b2b_enabled', true));
|
||||
const pathname = usePathname();
|
||||
const isPdpPage = pathname?.startsWith('/shop/') && pathname !== '/shop';
|
||||
const [showScroll, setShowScroll] = useState(false);
|
||||
const [footerCol1, setFooterCol1] = useState<Array<{ id?: string; label: string; href: string }>>([]);
|
||||
const [isDescExpanded, setIsDescExpanded] = useState(false);
|
||||
@@ -53,12 +58,13 @@ export default function Footer({
|
||||
|
||||
return (
|
||||
<footer className="bg-medical-gray-900 text-white pt-10 sm:pt-24 pb-28 sm:pb-12 font-shabnam relative" dir="rtl">
|
||||
{/* Floating Back-to-Top Button */}
|
||||
{/* Floating Back-to-Top Button (Docked cleanly on the RIGHT side to avoid overlapping SupportChat on the LEFT) */}
|
||||
{showScroll && (
|
||||
<button
|
||||
onClick={scrollToTop}
|
||||
className="fixed bottom-36 left-4 sm:bottom-8 sm:left-8 z-40 bg-canina-blue text-white p-2.5 sm:p-3 rounded-full shadow-2xl hover:bg-canina-dark hover:scale-110 transition-all border border-white/20 group flex items-center gap-2 font-vazir text-xs font-black"
|
||||
className={`fixed ${isPdpPage ? "bottom-[138px]" : "bottom-24"} right-4 sm:bottom-8 sm:right-8 z-40 bg-canina-blue text-white p-2.5 sm:p-3 rounded-full shadow-2xl hover:bg-canina-dark hover:scale-110 transition-all border border-white/20 group flex items-center gap-2 font-vazir text-xs font-black cursor-pointer`}
|
||||
title="بازگشت به بالای صفحه"
|
||||
aria-label="بازگشت به بالای صفحه"
|
||||
>
|
||||
<ArrowUp className="w-4 h-4 sm:w-5 sm:h-5 group-hover:-translate-y-1 transition-transform" />
|
||||
<span className="hidden sm:inline">بازگشت به بالا</span>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Search, ChevronDown, Menu, X, Pill, ShieldCheck, HeartPulse, Sparkles,
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import Link from "next/link";
|
||||
import { useCartStore } from "../lib/store/cartStore";
|
||||
import { useUIStore } from "../lib/store/uiStore";
|
||||
import { usePetStore } from "../lib/store/usePetStore";
|
||||
import { useUserStore } from "../lib/store/userStore";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
@@ -254,7 +255,7 @@ export default function Header({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setIsPrescriptionModalOpen(true);
|
||||
useUIStore.getState().setPrescriptionModalOpen(true);
|
||||
}}
|
||||
className="flex items-center gap-1.5 px-2.5 sm:px-3 py-2 bg-emerald-50 text-emerald-700 border border-emerald-200 hover:bg-emerald-100 rounded-xl text-[11px] sm:text-xs font-black transition-all shadow-xs cursor-pointer"
|
||||
title="ثبت نسخه دامپزشک"
|
||||
|
||||
@@ -479,6 +479,20 @@ export default function MobileBottomNav({
|
||||
<span>خرید عمده (B2B)</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{isPrescriptionEnabled && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
closeSheet();
|
||||
useUIStore.getState().setPrescriptionModalOpen(true);
|
||||
}}
|
||||
className="flex items-center gap-2.5 p-3.5 bg-emerald-50 border border-emerald-200 rounded-2xl text-xs font-black text-emerald-800 hover:border-emerald-500 text-right shadow-xs"
|
||||
>
|
||||
<FileHeart className="w-4 h-4 text-emerald-600 shrink-0" />
|
||||
<span>ثبت نسخه آنلاین</span>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Contact & Support */}
|
||||
|
||||
@@ -4,10 +4,12 @@ interface UIState {
|
||||
isCartOpen: boolean;
|
||||
isLoginModalOpen: boolean;
|
||||
isB2BPortalOpen: boolean;
|
||||
isPrescriptionModalOpen: boolean;
|
||||
advisorData: Record<string, unknown> | null;
|
||||
setCartOpen: (open: boolean) => void;
|
||||
setLoginModalOpen: (open: boolean, advisorData?: Record<string, unknown> | null) => void;
|
||||
setB2BPortalOpen: (open: boolean) => void;
|
||||
setPrescriptionModalOpen: (open: boolean) => void;
|
||||
clearAdvisorData: () => void;
|
||||
}
|
||||
|
||||
@@ -15,6 +17,7 @@ export const useUIStore = create<UIState>((set) => ({
|
||||
isCartOpen: false,
|
||||
isLoginModalOpen: false,
|
||||
isB2BPortalOpen: false,
|
||||
isPrescriptionModalOpen: false,
|
||||
advisorData: null,
|
||||
setCartOpen: (open) => set({ isCartOpen: open }),
|
||||
setLoginModalOpen: (open, data) => set((state) => ({
|
||||
@@ -22,5 +25,6 @@ export const useUIStore = create<UIState>((set) => ({
|
||||
advisorData: data !== undefined ? data : state.advisorData
|
||||
})),
|
||||
setB2BPortalOpen: (open) => set({ isB2BPortalOpen: open }),
|
||||
setPrescriptionModalOpen: (open) => set({ isPrescriptionModalOpen: open }),
|
||||
clearAdvisorData: () => set({ advisorData: null }),
|
||||
}));
|
||||
Reference in new issue
Block a user