Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

228 hover bookings #262

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 44 additions & 26 deletions frontend/src/components/ConsultantRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { BookingType, Consultant } from "@/types";
import { BookingType, Consultant, DetailedBooking } from "@/types";
import { ReactElement, useState } from "react";
import {
AlertTriangle,
Expand Down Expand Up @@ -80,39 +80,57 @@ export default function ConsultantRows({
<div
className={`absolute bottom-full left-1/2 -translate-x-1/2 flex flex-col items-center ${
(hoveredRowWeek != b.weekNumber ||
consultant.detailedBooking.length == 0) &&
consultant.detailedBooking
.map((d) =>
d.hours
.filter((h) => h.week % 100 == b.weekNumber)
.reduce((sum, h) => sum + h.hours, 0),
)
.reduce((a, b) => a + b, 0) == 0) &&
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
"hidden"
}`}
>
<div className="rounded-lg bg-white flex flex-col gap-2 min-w-[222px] p-3 shadow-xl">
{consultant.detailedBooking.map((db, index) => (
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
<div
key={index}
className={`flex flex-row gap-2 justify-between items-center ${
index < consultant.detailedBooking.length - 1 &&
"border-b pb-2 border-hover_background"
}`}
>
<div className="flex flex-row gap-2 items-center">
<>
{db.hours.find((hour) => hour.week % 100 == b.weekNumber)
?.hours != 0 && (
<div
className={`h-8 w-8 flex justify-center align-middle items-center rounded ${getColorByStaffingType(
db.bookingDetails.type,
)}`}
key={index}
className={`flex flex-row gap-2 justify-between items-center
${
index <
consultant.detailedBooking.filter(
(db) =>
db.hours.find(
(hour) => hour.week % 100 == b.weekNumber,
)?.hours != 0,
).length -
1 && "border-b pb-2 border-hover_background"
}`}
>
{getIconByBookingType(db.bookingDetails.type)}
<div className="flex flex-row gap-2 items-center">
<div
className={`h-8 w-8 flex justify-center align-middle items-center rounded ${getColorByStaffingType(
db.bookingDetails.type,
)}`}
>
{getIconByBookingType(db.bookingDetails.type)}
</div>
<p className="text-black whitespace-nowrap">
{db.bookingDetails.name}
</p>
</div>
<p className="text-black text-opacity-60">
{
db.hours.find(
(hour) => hour.week % 100 == b.weekNumber,
)?.hours
}
</p>
</div>
<p className="text-black whitespace-nowrap">
{db.bookingDetails.name}
</p>
</div>
<p className="text-black text-opacity-60">
{
db.hours.find((hour) =>
String(hour.week).includes(String(b.weekNumber)),
)?.hours
}
</p>
</div>
)}
</>
))}
</div>
<div className="w-0 h-0 border-l-[12px] border-l-transparent border-t-[16px] border-t-white border-r-[12px] border-r-transparent"></div>
Expand Down
Loading