remove rental calendar from toy page
This commit is contained in:
parent
c74edf7397
commit
1154e56555
|
|
@ -3,15 +3,12 @@ import Image from 'next/image';
|
||||||
import { getToyById } from '@/data/operations';
|
import { getToyById } from '@/data/operations';
|
||||||
import type { Toy } from '@/types';
|
import type { Toy } from '@/types';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Calendar } from '@/components/ui/calendar';
|
|
||||||
import { ArrowLeft, DollarSign, MapPin } from 'lucide-react';
|
import { ArrowLeft, DollarSign, MapPin } from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { getI18n, getStaticParams as getLocaleStaticParams } from '@/locales/server';
|
import { getI18n, getStaticParams as getLocaleStaticParams } from '@/locales/server';
|
||||||
import type { Locale } from '@/locales/server';
|
import type { Locale } from '@/locales/server';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
||||||
import { addDays, parseISO } from 'date-fns';
|
|
||||||
import { getAllToys } from '@/data/operations';
|
import { getAllToys } from '@/data/operations';
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||||
import { ShoppingBag } from 'lucide-react';
|
import { ShoppingBag } from 'lucide-react';
|
||||||
|
|
@ -41,12 +38,6 @@ export default async function ToyPage({ params }: ToyPageProps) {
|
||||||
|
|
||||||
const placeholderHint = toy.category.toLowerCase() || "toy detail";
|
const placeholderHint = toy.category.toLowerCase() || "toy detail";
|
||||||
|
|
||||||
const disabledDates = toy.unavailableRanges.map(range => {
|
|
||||||
const from = parseISO(range.startDate);
|
|
||||||
const to = parseISO(range.endDate);
|
|
||||||
return { from, to };
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto py-8 px-4">
|
<div className="container mx-auto py-8 px-4">
|
||||||
<Link href={`/${params.locale}/`} className="inline-flex items-center text-primary hover:underline mb-6 group">
|
<Link href={`/${params.locale}/`} className="inline-flex items-center text-primary hover:underline mb-6 group">
|
||||||
|
|
@ -132,23 +123,6 @@ export default async function ToyPage({ params }: ToyPageProps) {
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|
||||||
<Card className="shadow-md">
|
|
||||||
<CardHeader>
|
|
||||||
<CardTitle className="text-xl font-headline text-primary">{t('toy_details.availability_calendar_title')}</CardTitle>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="flex justify-center">
|
|
||||||
<Calendar
|
|
||||||
mode="single"
|
|
||||||
disabled={disabledDates}
|
|
||||||
month={new Date()}
|
|
||||||
className="rounded-md border"
|
|
||||||
/>
|
|
||||||
</CardContent>
|
|
||||||
<p className="text-xs text-muted-foreground mt-0 pb-4 text-center">
|
|
||||||
{t('toy_details.calendar_note')}
|
|
||||||
</p>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Button size="lg" className="w-full mt-6 transition-transform transform hover:scale-105">
|
<Button size="lg" className="w-full mt-6 transition-transform transform hover:scale-105">
|
||||||
<ShoppingBag className="mr-2 h-5 w-5" /> {t('toy_details.request_to_rent')}
|
<ShoppingBag className="mr-2 h-5 w-5" /> {t('toy_details.request_to_rent')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,10 @@ import Image from 'next/image';
|
||||||
import { getToyById, getAllToys } from '@/data/operations';
|
import { getToyById, getAllToys } from '@/data/operations';
|
||||||
import type { Toy } from '@/types';
|
import type { Toy } from '@/types';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Calendar } from '@/components/ui/calendar';
|
|
||||||
import { ArrowLeft, DollarSign, MapPin, ShoppingBag, UserCircle2 } from 'lucide-react';
|
import { ArrowLeft, DollarSign, MapPin, ShoppingBag, UserCircle2 } from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
||||||
import { addDays, parseISO } from 'date-fns';
|
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -37,12 +34,6 @@ export default async function ToyPage({ params }: ToyPageProps) {
|
||||||
|
|
||||||
const placeholderHint = toy.category.toLowerCase() || "toy detail";
|
const placeholderHint = toy.category.toLowerCase() || "toy detail";
|
||||||
|
|
||||||
const disabledDates = toy.unavailableRanges.map(range => {
|
|
||||||
const from = parseISO(range.startDate);
|
|
||||||
const to = parseISO(range.endDate);
|
|
||||||
return { from, to };
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto py-8 px-4">
|
<div className="container mx-auto py-8 px-4">
|
||||||
<Link href="/" className="inline-flex items-center text-primary hover:underline mb-6 group">
|
<Link href="/" className="inline-flex items-center text-primary hover:underline mb-6 group">
|
||||||
|
|
@ -128,23 +119,6 @@ export default async function ToyPage({ params }: ToyPageProps) {
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|
||||||
<Card className="shadow-md">
|
|
||||||
<CardHeader>
|
|
||||||
<CardTitle className="text-xl font-headline text-primary">Availability Calendar</CardTitle>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="flex justify-center">
|
|
||||||
<Calendar
|
|
||||||
mode="single"
|
|
||||||
disabled={disabledDates}
|
|
||||||
month={new Date()}
|
|
||||||
className="rounded-md border"
|
|
||||||
/>
|
|
||||||
</CardContent>
|
|
||||||
<p className="text-xs text-muted-foreground mt-0 pb-4 text-center">
|
|
||||||
Dates shown in gray or crossed out are unavailable.
|
|
||||||
</p>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Button size="lg" className="w-full mt-6 transition-transform transform hover:scale-105">
|
<Button size="lg" className="w-full mt-6 transition-transform transform hover:scale-105">
|
||||||
<ShoppingBag className="mr-2 h-5 w-5" /> Request to Rent
|
<ShoppingBag className="mr-2 h-5 w-5" /> Request to Rent
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
BIN
toyshare.db-shm
BIN
toyshare.db-shm
Binary file not shown.
BIN
toyshare.db-wal
BIN
toyshare.db-wal
Binary file not shown.
Loading…
Reference in New Issue