From 9244eaec267848da793f31cdb351fb572a99f52a Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Tue, 7 Oct 2025 11:24:00 +0300 Subject: [PATCH] --- .../app/(main)/profile/[telegramId]/page.tsx | 5 +- .../components/profile/profile-buttons.tsx | 94 +++++++++++++++++++ .../components/profile/quick-appointment.tsx | 92 ------------------ apps/web/components/shared/action-panel.tsx | 17 +++- 4 files changed, 113 insertions(+), 95 deletions(-) create mode 100644 apps/web/components/profile/profile-buttons.tsx delete mode 100644 apps/web/components/profile/quick-appointment.tsx diff --git a/apps/web/app/(main)/profile/[telegramId]/page.tsx b/apps/web/app/(main)/profile/[telegramId]/page.tsx index 8b013a7..95c2a58 100644 --- a/apps/web/app/(main)/profile/[telegramId]/page.tsx +++ b/apps/web/app/(main)/profile/[telegramId]/page.tsx @@ -1,7 +1,7 @@ import { Container } from '@/components/layout'; import { PageHeader } from '@/components/navigation'; import { ContactDataCard, PersonCard, ProfileOrdersList } from '@/components/profile'; -import { QuickAppointment } from '@/components/profile/quick-appointment'; +import { ProfileButtons } from '@/components/profile/profile-buttons'; import { ReadonlyServicesList } from '@/components/profile/services'; // Тип параметров страницы @@ -16,10 +16,11 @@ export default async function ProfilePage(props: Readonly) { - +
+ ); diff --git a/apps/web/components/profile/profile-buttons.tsx b/apps/web/components/profile/profile-buttons.tsx new file mode 100644 index 0000000..08720e6 --- /dev/null +++ b/apps/web/components/profile/profile-buttons.tsx @@ -0,0 +1,94 @@ +'use client'; + +import FloatingActionPanel from '@/components/shared/action-panel'; +import { useCustomerQuery } from '@/hooks/api/customers'; +import { usePushWithData } from '@/hooks/url'; +import { Button } from '@repo/ui/components/ui/button'; +import { + Drawer, + DrawerClose, + DrawerContent, + DrawerDescription, + DrawerFooter, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from '@repo/ui/components/ui/drawer'; +import { useState } from 'react'; + +type QuickAppointmentProps = { + readonly telegramId: number; +}; + +export function ProfileButtons({ telegramId }: Readonly) { + const [isPanelOpen, setIsPanelOpen] = useState(false); + const push = usePushWithData(); + + const { data: { customer: profile } = {} } = useCustomerQuery({ telegramId }); + const { data: { customer: currentUser } = {} } = useCustomerQuery(); + + const handleBookAsClient = () => { + push('/orders/add', { + client: currentUser, + slot: { master: profile }, + }); + }; + + const handleBookAsMaster = () => { + push('/orders/add', { + client: profile, + slot: { master: currentUser }, + }); + }; + + if (!telegramId) return null; + + return ( + <> + setIsPanelOpen(true)} /> + + +
+ + +
+ + Быстрая запись + Выберите действие + +
+
+ + + + + + +
+
+ + + + + +
+
+ + + ); +} diff --git a/apps/web/components/profile/quick-appointment.tsx b/apps/web/components/profile/quick-appointment.tsx deleted file mode 100644 index 5bb5e7a..0000000 --- a/apps/web/components/profile/quick-appointment.tsx +++ /dev/null @@ -1,92 +0,0 @@ -'use client'; - -import { useCustomerQuery } from '@/hooks/api/customers'; -import { usePushWithData } from '@/hooks/url'; -import { Button } from '@repo/ui/components/ui/button'; -import { - Drawer, - DrawerClose, - DrawerContent, - DrawerDescription, - DrawerFooter, - DrawerHeader, - DrawerTitle, - DrawerTrigger, -} from '@repo/ui/components/ui/drawer'; - -type QuickAppointmentProps = { - readonly telegramId: number; -}; - -export function QuickAppointment({ telegramId }: Readonly) { - const push = usePushWithData(); - - const { data: { customer: profile } = {} } = useCustomerQuery({ telegramId }); - const { data: { customer: currentUser } = {} } = useCustomerQuery(); - - const handleBookAsClient = () => { - push('/orders/add', { - client: currentUser, - slot: { master: profile }, - }); - }; - - const handleBookAsMaster = () => { - push('/orders/add', { - client: profile, - slot: { master: currentUser }, - }); - }; - - if (!telegramId) return null; - - return ( - - -
- -
-
- -
- - Быстрая запись - Выберите действие - -
-
- - - - - - -
-
- - - - - -
-
-
- ); -} diff --git a/apps/web/components/shared/action-panel.tsx b/apps/web/components/shared/action-panel.tsx index 5056a2f..fd61610 100644 --- a/apps/web/components/shared/action-panel.tsx +++ b/apps/web/components/shared/action-panel.tsx @@ -2,7 +2,7 @@ import { Button } from '@repo/ui/components/ui/button'; import { Card } from '@repo/ui/components/ui/card'; -import { Ban, Check, Lock, RotateCcw, Save, Trash2, Undo, Unlock } from 'lucide-react'; +import { Ban, Check, Lock, Plus, RotateCcw, Save, Trash2, Undo, Unlock } from 'lucide-react'; type FloatingActionPanelProps = { readonly isLoading?: boolean; @@ -11,6 +11,7 @@ type FloatingActionPanelProps = { readonly onComplete?: () => void; readonly onConfirm?: () => void; readonly onDelete?: () => void; + readonly onQuickBook?: () => void; readonly onRepeat?: () => void; readonly onReturn?: () => void; readonly onSave?: () => void; @@ -24,6 +25,7 @@ export default function FloatingActionPanel({ onComplete, onConfirm, onDelete, + onQuickBook, onRepeat, onReturn, onSave, @@ -36,6 +38,7 @@ export default function FloatingActionPanel({ !onDelete && !onComplete && !onRepeat && + !onQuickBook && !onToggle && !onReturn && !onSave @@ -45,6 +48,18 @@ export default function FloatingActionPanel({ return (
+ {/* Кнопка записать */} + {onQuickBook && ( + + )} {/* Кнопка закрыть/открыть */} {onToggle && (