-
- Реквизиты
-
-
-
- ИП:
-
- {requisites.ip}
-
-
-
- ИНН:
-
- {requisites.inn}
-
-
-
-
- ОГРН/ОГРНИП:
-
-
- {requisites.ogrn}
-
-
+
+
+ Реквизиты
+
+
+
+ ИП
+
+ {requisites.ip}
+
+
+
+ ИНН
+
+ {requisites.inn}
+
+
+
+
+ ОГРН/ОГРНИП
+
+
+ {requisites.ogrn}
+
);
}
-
-
-
diff --git a/src/app/catalog/[id]/components/YachtAvailability.tsx b/src/app/catalog/[id]/components/YachtAvailability.tsx
index 8be9f9b..4548260 100644
--- a/src/app/catalog/[id]/components/YachtAvailability.tsx
+++ b/src/app/catalog/[id]/components/YachtAvailability.tsx
@@ -2,38 +2,24 @@
import { useState } from "react";
import { Calendar } from "@/components/ui/calendar";
-import { format } from "date-fns";
+import { isSameMonth, isBefore, startOfDay, format } from "date-fns";
import { ru } from "date-fns/locale";
-import { ChevronLeft, ChevronRight } from "lucide-react";
-import Icon from "@/components/ui/icon";
+import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
interface YachtAvailabilityProps {
price: string;
}
export function YachtAvailability({ price }: YachtAvailabilityProps) {
- const [currentMonth, setCurrentMonth] = useState(new Date(2025, 3, 1)); // Апрель 2025
-
- // Генерируем доступные даты (27, 28, 29 апреля доступны)
- const availableDates = [
- new Date(2025, 3, 27),
- new Date(2025, 3, 28),
- new Date(2025, 3, 29),
- ];
+ const today = startOfDay(new Date());
+ const [currentMonth, setCurrentMonth] = useState(
+ new Date(today.getFullYear(), today.getMonth(), 1)
+ );
const unavailableDates = Array.from({ length: 26 }, (_, i) => {
return new Date(2025, 3, i + 1);
});
- const isDateAvailable = (date: Date) => {
- return availableDates.some(
- (d) =>
- d.getDate() === date.getDate() &&
- d.getMonth() === date.getMonth() &&
- d.getFullYear() === date.getFullYear()
- );
- };
-
const isDateUnavailable = (date: Date) => {
return unavailableDates.some(
(d) =>
@@ -43,101 +29,135 @@ export function YachtAvailability({ price }: YachtAvailabilityProps) {
);
};
- const handlePreviousMonth = () => {
+ const isDateInPast = (date: Date) => {
+ return isBefore(startOfDay(date), today);
+ };
+
+ const shouldBeCrossedOut = (date: Date) => {
+ // Перечеркиваем если день занят или находится до текущего дня
+ return isDateUnavailable(date) || isDateInPast(date);
+ };
+
+ const goToPreviousMonth = () => {
setCurrentMonth(
- new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1)
+ new Date(
+ currentMonth.getFullYear(),
+ currentMonth.getMonth() - 1,
+ 1
+ )
);
};
- const handleNextMonth = () => {
+ const goToNextMonth = () => {
setCurrentMonth(
- new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1)
+ new Date(
+ currentMonth.getFullYear(),
+ currentMonth.getMonth() + 1,
+ 1
+ )
);
};
return (
-
+
-
+
Доступность яхты
-
-
- По местному времени яхты
-
-
-
-
-
- {format(currentMonth, "LLLL yyyy", { locale: ru })}
-
-
+
+
+
+
+
+ {format(currentMonth, "LLLL yyyy", { locale: ru })}
+
+
+
-
{
- const isAvailable = isDateAvailable(day.date);
- const isUnavailable = isDateUnavailable(day.date);
- const isDay30 = day.date.getDate() === 30;
+ // Показываем только дни текущего месяца
+ if (!isSameMonth(day.date, currentMonth)) {
+ return ;
+ }
+
+ const isCrossedOut = shouldBeCrossedOut(day.date);
return (
);
},
@@ -147,4 +167,3 @@ export function YachtAvailability({ price }: YachtAvailabilityProps) {
);
}
-
diff --git a/src/app/catalog/[id]/components/YachtCharacteristics.tsx b/src/app/catalog/[id]/components/YachtCharacteristics.tsx
index 90f5458..7c2822f 100644
--- a/src/app/catalog/[id]/components/YachtCharacteristics.tsx
+++ b/src/app/catalog/[id]/components/YachtCharacteristics.tsx
@@ -33,19 +33,19 @@ export function YachtCharacteristics({ yacht }: YachtCharacteristicsProps) {
return (
-
+
Характеристики
-
+
{characteristics.map((char, index) => (
- {char.label}:
+ {char.label}
-
+
{char.value}
@@ -54,6 +54,3 @@ export function YachtCharacteristics({ yacht }: YachtCharacteristicsProps) {
);
}
-
-
-
diff --git a/src/app/catalog/[id]/components/YachtGallery.tsx b/src/app/catalog/[id]/components/YachtGallery.tsx
index 16ace2e..0014d38 100644
--- a/src/app/catalog/[id]/components/YachtGallery.tsx
+++ b/src/app/catalog/[id]/components/YachtGallery.tsx
@@ -52,7 +52,7 @@ export function YachtGallery({ images, badge }: YachtGalleryProps) {
{images.map((img, index) => (
-
+
- {badge && (
-
- )}
-
- {index + 1}/{images.length}
-
))}
@@ -78,6 +67,21 @@ export function YachtGallery({ images, badge }: YachtGalleryProps) {
+ {/* Badge - поверх слайдера, не скроллится */}
+ {badge && (
+
+ )}
+ {/* Photo counter - поверх слайдера, не скроллится */}
+
+
+ {current + 1}/{images.length}
+
+
{/* Thumbnails */}
@@ -86,7 +90,7 @@ export function YachtGallery({ images, badge }: YachtGalleryProps) {