import useFetchHosting from "../utils/fetchHosting"; import { useNotification } from "../NotificationContext"; import { useCookies } from "react-cookie"; import CenteredContainer from "./ChildrenContainer"; interface ReserveButtonProps { update: (name: string, id: number) => void, reservedBy: string, id: number, } const ReserveButton: React.FC = (props) => { const { reservedBy, update, id } = props; const [cookie] = useCookies(['userName']) const userName = cookie.userName; const isReserved = reservedBy !== ''; const notify = useNotification(); const handleReserve = async () => { try { await update(userName, id); notify(`Успешно забронировано для ${userName}`, 'success'); } catch (error) { notify(`Не удалось забронировать: ${error instanceof Error ? error.message : 'Unknown error'}`, 'error'); } }; return ( <> ); }; function Hosting() { const { data, error, loading, update } = useFetchHosting(); return ( <>

Поселение

Мы готовы приютить в наших 150 квадратах всех. У нас есть 6 спальных мест. При этом, если вы не хотите тесниться, то рядом с нами есть отель, а так же кэмпинг-виллы (Лучше бронировать заранее если есть надобность. Оба в 1-1,5км от нашего дома). Спальные места:

{loading &&
Loading...
} {error &&
Error
} {data && (
{Object.entries(data).map(([id, item]) => ( ))}
Размещение Спальных мест Бронирование
{item.name} {item.capacity} {}

Таблицу можно скроллить

)}

); } export default Hosting;