fix slots & orders layout
This commit is contained in:
parent
76ef0fd808
commit
c27bfe0cf4
@ -1,7 +1,6 @@
|
||||
import { HorizontalDivider } from '@/components/common/divider';
|
||||
import { Container } from '@/components/layout';
|
||||
import { PageHeader } from '@/components/navigation';
|
||||
import { DaySlotAddForm, DaySlotsList, ScheduleCalendar } from '@/components/schedule';
|
||||
import { DaySlotsList, ScheduleCalendar } from '@/components/schedule';
|
||||
|
||||
export default function SchedulePage() {
|
||||
return (
|
||||
@ -10,8 +9,6 @@ export default function SchedulePage() {
|
||||
<Container className="px-0">
|
||||
<ScheduleCalendar />
|
||||
<DaySlotsList />
|
||||
<HorizontalDivider className="px-4" />
|
||||
<DaySlotAddForm />
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -16,8 +16,8 @@ export default async function ProfilePage(props: Readonly<Props>) {
|
||||
<Container>
|
||||
<SlotDateTime {...parameters} />
|
||||
<SlotButtons {...parameters} />
|
||||
<SlotOrdersList {...parameters} />
|
||||
</Container>
|
||||
<SlotOrdersList {...parameters} className="mt-4" />
|
||||
</HydrationBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,13 +32,11 @@ export const DaySlotAddForm = withContext(ScheduleTimeContextProvider)(function
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="px-4">
|
||||
<EditableTimeRangeForm disabled={isPending} onSubmit={handleSubmit}>
|
||||
<Button className="rounded-full" disabled={isPending} type="submit">
|
||||
<PlusSquare className="mr-1 size-4" />
|
||||
Добавить
|
||||
</Button>
|
||||
</EditableTimeRangeForm>
|
||||
</div>
|
||||
<EditableTimeRangeForm disabled={isPending} onSubmit={handleSubmit}>
|
||||
<Button className="rounded-full" disabled={isPending} type="submit">
|
||||
<PlusSquare className="mr-1 size-4" />
|
||||
Добавить
|
||||
</Button>
|
||||
</EditableTimeRangeForm>
|
||||
);
|
||||
});
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
import { SlotCard } from './components/slot-card';
|
||||
import { DaySlotAddForm } from './day-slot-add-form';
|
||||
import { LoadingSpinner } from '@/components/common/spinner';
|
||||
import { useSlots } from '@/hooks/slots';
|
||||
|
||||
@ -10,12 +11,10 @@ export function DaySlotsList() {
|
||||
if (isLoading) return <LoadingSpinner />;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4 px-4">
|
||||
{slots?.map((slot) => {
|
||||
if (!slot?.documentId) return null;
|
||||
|
||||
return <SlotCard key={slot.documentId} {...slot} />;
|
||||
})}
|
||||
<div className="flex flex-col space-y-2 px-4">
|
||||
<h1 className="font-bold">Слоты</h1>
|
||||
{slots?.map((slot) => slot && <SlotCard key={slot.documentId} {...slot} />)}
|
||||
<DaySlotAddForm />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,23 +2,17 @@
|
||||
import { OrderCard } from './components/order-card';
|
||||
import { type SlotComponentProps } from './types';
|
||||
import { useSlotQuery } from '@/hooks/slots';
|
||||
import { cn } from '@repo/ui/lib/utils';
|
||||
|
||||
export function SlotOrdersList({
|
||||
className,
|
||||
documentId,
|
||||
}: Readonly<SlotComponentProps> & { readonly className?: string }) {
|
||||
export function SlotOrdersList({ documentId }: Readonly<SlotComponentProps>) {
|
||||
const { data } = useSlotQuery({ documentId });
|
||||
const slot = data?.data?.slot;
|
||||
|
||||
if (!slot) return null;
|
||||
|
||||
return (
|
||||
<div className={cn('bg-transparent p-4', className)}>
|
||||
<h1 className="mb-2 font-bold">Записи</h1>
|
||||
{slot?.orders.map((order) => {
|
||||
return order && <OrderCard key={order?.documentId} {...order} />;
|
||||
})}
|
||||
<div className="flex flex-col space-y-2">
|
||||
<h1 className="font-bold">Записи</h1>
|
||||
{slot?.orders.map((order) => order && <OrderCard key={order.documentId} {...order} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user