Skip to content

Commit

Permalink
link to existing reservations (#10)
Browse files Browse the repository at this point in the history
jgravois authored Jun 2, 2024

Verified

This commit was signed with the committer’s verified signature.
jasonehines Jason Hines
1 parent 934f183 commit 0ad42d3
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions app/routes/ReservationList.tsx
Original file line number Diff line number Diff line change
@@ -71,19 +71,19 @@ const Guts = ({
})}
>
{rezTimes.map((num) => {
const onHourPrivate = reservations.some(
const onHourPrivate = reservations.find(
(r) => isOverlapping(r, date, num) && !r.openPlay,
);

const onHourOpenPlay = reservations.some(
const onHourOpenPlay = reservations.find(
(r) => isOverlapping(r, date, num) && r.openPlay,
);

const halfHourPrivate = reservations.some(
const halfHourPrivate = reservations.find(
(r) => isOverlapping(r, date, num + 0.5) && !r.openPlay,
);

const halfHourOpenPlay = reservations.some(
const halfHourOpenPlay = reservations.find(
(r) => isOverlapping(r, date, num + 0.5) && r.openPlay,
);

@@ -94,8 +94,8 @@ const Guts = ({
<div className="schedule_row" key={num}>
<button
className={cn("schedule_button", {
schedule_button___private: onHourPrivate,
schedule_button___open: onHourOpenPlay,
schedule_button___private: !!onHourPrivate,
schedule_button___open: !!onHourOpenPlay,
})}
onClick={() =>
canReserveOnHour
@@ -106,15 +106,19 @@ const Guts = ({
String(num).padStart(2, "0") + ":00"
}`,
)
: undefined
: navigate(
`/reservations/${
onHourPrivate?.id ?? onHourOpenPlay?.id
}`,
)
}
>
{num + ":00"}
</button>
<button
className={cn("schedule_button", {
schedule_button___private: halfHourPrivate,
schedule_button___open: halfHourOpenPlay,
schedule_button___private: !!halfHourPrivate,
schedule_button___open: !!halfHourOpenPlay,
})}
onClick={() =>
canReserveOnHalfHour
@@ -125,7 +129,11 @@ const Guts = ({
String(num).padStart(2, "0") + ":30"
}`,
)
: console.log("cant touch this")
: navigate(
`/reservations/${
halfHourPrivate?.id ?? halfHourOpenPlay?.id
}`,
)
}
>
{num + ":30"}
2 changes: 1 addition & 1 deletion app/routes/reservations.new.tsx
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ export default function NewReservationPage() {
<div className="newRes_stack">
<label className="newRes_label" htmlFor="startTime">
<span>What time are you starting?</span>
<p>{params.get("start")}</p>
<p>{params.get("start") + " on " + params.get("day")}</p>
</label>
</div>
<fieldset>

0 comments on commit 0ad42d3

Please sign in to comment.