Updated booking link to proper username

pull/293/head
Alex van Andel 2021-07-01 10:31:38 +00:00
parent 6aa8df7fcf
commit a7173a32a0
1 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Slots from "./Slots"; import Slots from "./Slots";
import {ExclamationIcon} from "@heroicons/react/solid"; import { ExclamationIcon } from "@heroicons/react/solid";
const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeFormat, user }) => { const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeFormat, user }) => {
const router = useRouter(); const router = useRouter();
@ -12,12 +12,12 @@ const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeForm
<div className="text-gray-600 font-light text-xl mb-4 text-left"> <div className="text-gray-600 font-light text-xl mb-4 text-left">
<span className="w-1/2">{date.format("dddd DD MMMM YYYY")}</span> <span className="w-1/2">{date.format("dddd DD MMMM YYYY")}</span>
</div> </div>
{slots.length > 0 && ( {slots.length > 0 &&
slots.map((slot) => ( slots.map((slot) => (
<div key={slot.format()}> <div key={slot.format()}>
<Link <Link
href={ href={
`/${user}/book?date=${slot.utc().format()}&type=${eventTypeId}` + `/${user.username}/book?date=${slot.utc().format()}&type=${eventTypeId}` +
(rescheduleUid ? "&rescheduleUid=" + rescheduleUid : "") (rescheduleUid ? "&rescheduleUid=" + rescheduleUid : "")
}> }>
<a className="block font-medium mb-4 text-blue-600 border border-blue-600 rounded hover:text-white hover:bg-blue-600 py-4"> <a className="block font-medium mb-4 text-blue-600 border border-blue-600 rounded hover:text-white hover:bg-blue-600 py-4">
@ -25,11 +25,12 @@ const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeForm
</a> </a>
</Link> </Link>
</div> </div>
)) ))}
{isFullyBooked && (
<div className="w-full h-full flex flex-col justify-center content-center items-center -mt-4">
<h1 className="text-xl font">{user.name} is all booked today.</h1>
</div>
)} )}
{isFullyBooked && <div className="w-full h-full flex flex-col justify-center content-center items-center -mt-4">
<h1 className="text-xl font">{user.name} is all booked today.</h1>
</div>}
{!isFullyBooked && slots.length === 0 && !hasErrors && <div className="loader" />} {!isFullyBooked && slots.length === 0 && !hasErrors && <div className="loader" />}