From c3cac74228b59dad99a8a7cb87b9d1902ab5bd55 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 18 Jul 2025 16:33:24 +0300 Subject: [PATCH] fix(navigation): append query parameter to bottom-nav links and enhance back navigation logic in success page --- .../navigation/bottom-nav/nav-button.tsx | 2 +- .../components/orders/order-form/result.tsx | 24 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/apps/web/components/navigation/bottom-nav/nav-button.tsx b/apps/web/components/navigation/bottom-nav/nav-button.tsx index 73ed3d8..e8dbd99 100644 --- a/apps/web/components/navigation/bottom-nav/nav-button.tsx +++ b/apps/web/components/navigation/bottom-nav/nav-button.tsx @@ -27,7 +27,7 @@ export function NavButton({ disabled, href, icon, label }: NavButtonProps) { {label} ) : ( - + {icon} {label} diff --git a/apps/web/components/orders/order-form/result.tsx b/apps/web/components/orders/order-form/result.tsx index 9f09837..feb5051 100644 --- a/apps/web/components/orders/order-form/result.tsx +++ b/apps/web/components/orders/order-form/result.tsx @@ -3,8 +3,8 @@ import { useOrderStore } from '@/stores/order'; import { Button } from '@repo/ui/components/ui/button'; import { Card, CardContent } from '@repo/ui/components/ui/card'; -import { AlertCircle, CheckCircle2, Home, RefreshCw } from 'lucide-react'; -import Link from 'next/link'; +import { AlertCircle, CheckCircle2, RefreshCw } from 'lucide-react'; +import { useRouter, useSearchParams } from 'next/navigation'; export function ErrorPage() { const setStep = useOrderStore((store) => store.setStep); @@ -35,6 +35,19 @@ export function ErrorPage() { } export function SuccessPage() { + const router = useRouter(); + const from = useSearchParams().get('from'); + + const handleBack = () => { + if (from === 'bottom-nav') { + router.push('/'); + } else if (window.history.length > 1) { + router.back(); + } else { + router.push('/'); + } + }; + return (
@@ -46,11 +59,8 @@ export function SuccessPage() {

Готово!

Запись успешно создана

-