* refactor(profile): comment out change role feature * refactor(orders): update OrderServices and ServiceSelect components to utilize ServiceCard, and enhance service fields with duration in GraphQL types * refactor(schedule): implement forbidden order states to disable editing slots with active orders * fix(deploy): update SSH configuration to use dynamic port from secrets for improved flexibility * refactor(api/orders): simplify order creation logic by removing unnecessary validations and improving error handling * refactor(contact-row): replace role display logic with useIsMaster hook for improved clarity * refactor(profile/orders-list): update header text from "Общие записи" to "Недавние записи" for better clarity gql: GetOrders add sort slot.date:desc * refactor(profile/orders-list): enhance OrderCard component by adding avatarSource prop based on user role * feat(order-form): implement date selection with event highlighting and monthly view for available time slots * refactor(i18n/config): update timeZone from 'Europe/Amsterdam' to 'Europe/Moscow' * refactor(order-form/datetime-select): enhance date selection logic to include slot availability check * refactor(datetime-format): integrate dayjs timezone support with default Moscow timezone for date and time formatting * fix(contact-row): replace useIsMaster hook with isCustomerMaster utility for role display logic * refactor(service-card): replace formatTime with getMinutes for duration display * refactor(order-datetime): update date and time handling to use datetime_start and datetime_end for improved consistency * refactor(profile): streamline profile and slot pages by integrating session user retrieval and updating booking logic with BookButton component * fix(navigation): append query parameter to bottom-nav links and enhance back navigation logic in success page
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
'use client';
|
||
|
||
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, RefreshCw } from 'lucide-react';
|
||
import { useRouter, useSearchParams } from 'next/navigation';
|
||
|
||
export function ErrorPage() {
|
||
const setStep = useOrderStore((store) => store.setStep);
|
||
|
||
const handleRetry = () => {
|
||
setStep('datetime-select');
|
||
};
|
||
|
||
return (
|
||
<div className="flex min-h-screen items-center justify-center bg-background p-4">
|
||
<Card className="w-full max-w-sm border-none bg-card text-card-foreground shadow-none">
|
||
<CardContent className="flex flex-col items-center space-y-5 py-8">
|
||
<div className="rounded-full bg-red-100 p-3 dark:bg-red-900">
|
||
<AlertCircle className="size-12 text-red-600 dark:text-red-400" />
|
||
</div>
|
||
<div className="space-y-2 text-center">
|
||
<h1 className="text-2xl font-bold">Ошибка!</h1>
|
||
<p className="text-muted-foreground">Произошла ошибка при выполнении операции.</p>
|
||
</div>
|
||
<Button className="w-full" onClick={handleRetry} variant="destructive">
|
||
<RefreshCw className="mr-2 size-4" />
|
||
Повторить
|
||
</Button>
|
||
</CardContent>
|
||
</Card>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
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 (
|
||
<div className="flex min-h-screen items-center justify-center bg-background p-4">
|
||
<Card className="w-full max-w-sm border-none bg-card text-card-foreground shadow-none">
|
||
<CardContent className="flex flex-col items-center space-y-5 py-8">
|
||
<div className="rounded-full bg-green-100 p-3 dark:bg-green-900">
|
||
<CheckCircle2 className="size-12 text-green-600 dark:text-green-400" />
|
||
</div>
|
||
<div className="space-y-2 text-center">
|
||
<h1 className="text-2xl font-bold">Готово!</h1>
|
||
<p className="text-muted-foreground">Запись успешно создана</p>
|
||
</div>
|
||
<Button className="w-full" onClick={handleBack}>
|
||
ОК
|
||
</Button>
|
||
</CardContent>
|
||
</Card>
|
||
</div>
|
||
);
|
||
}
|