Skip to content

Commit

Permalink
chore(room-booking): add button to show booking on timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemSBulgakov committed Nov 19, 2024
1 parent c0095e1 commit 54c0fe4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/components/room-booking/list/BookingsListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Tooltip from "@/components/common/Tooltip.tsx";
import { DeleteBookingModal } from "@/components/room-booking/list/DeleteBookingModal.tsx";
import { clockTime, durationFormatted, msBetween } from "@/lib/utils/dates.ts";
import { useQueryClient } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import clsx from "clsx";
import React, { useMemo, useState } from "react";

Expand Down Expand Up @@ -106,6 +107,16 @@ export function BookingCard({
isPending ? "visible" : "invisible",
)}
>
<Tooltip content="Show on timeline">
<Link
to="/room-booking"
search={{ d: new Date(booking.start).getTime() }}
className="flex h-8 w-8 items-center justify-center rounded-md text-icon-main/50 hover:bg-secondary-hover"
>
<span className="icon-[tabler--list-search] text-2xl" />
</Link>
</Tooltip>

<Tooltip content="Delete booking">
<button
className="flex h-8 w-8 items-center justify-center rounded-md border-[1px] border-red-400 bg-red-200 text-red-600 hover:bg-red-300 dark:border-red-600 dark:bg-red-800 dark:text-red-400 dark:hover:bg-red-700"
Expand Down
4 changes: 2 additions & 2 deletions src/components/room-booking/timeline/RoomBookingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { $roomBooking } from "@/api/room-booking";
import { AuthWall } from "@/components/common/AuthWall.tsx";
import { BookingModal } from "@/components/room-booking/timeline/BookingModal.tsx";
import { T } from "@/lib/utils/dates.ts";
import { getRouteApi } from "@tanstack/react-router";
import { lazy, Suspense, useEffect, useRef, useState } from "react";
import type { Booking, ScrollToOptions, Slot } from "./BookingTimeline.vue";
import { getRouteApi } from "@tanstack/react-router";

const BookingTimeline = lazy(
() => import("@/components/room-booking/timeline/BookingTimeline.tsx"),
Expand Down Expand Up @@ -37,7 +37,7 @@ export function RoomBookingPage() {
timelineRef.current?.__veauryVueRef__.scrollTo({
to: new Date(search.d),
behavior: "smooth",
offsetMs: T.Min * 20,
offsetMs: -T.Min * 20,
position: "left",
});
}
Expand Down

0 comments on commit 54c0fe4

Please sign in to comment.