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

Add dot to current week #245

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Changes from all commits
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
28 changes: 22 additions & 6 deletions frontend/src/components/FilteredConsultantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import ConsultantRows from "./ConsultantRows";
import ActiveFilters from "./ActiveFilters";
import { useFilteredConsultants } from "@/hooks/useFilteredConsultants";
import WeekSelection from "@/components/WeekSelection";
import { DateTime } from "luxon";

export default function FilteredConsultantList() {
const { filteredConsultants: consultants } = useFilteredConsultants();

function isCurrentWeek(weekNumber: number, year: number) {
const today = DateTime.now();
return today.weekNumber == weekNumber && today.year == year;
}

return (
<div>
<div>
Expand All @@ -25,14 +31,24 @@ export default function FilteredConsultantList() {
</p>
</div>
</th>
{consultants.at(0)?.bookings?.map((b) => (
<th key={b.weekNumber} className="px-2 py-1">
{consultants.at(0)?.bookings?.map((booking) => (
<th key={booking.weekNumber} className="px-2 py-1">
<div className="flex flex-col gap-1 justify-items-end">
<p className=" body text-right">{b.weekNumber}</p>
{isCurrentWeek(booking.weekNumber, booking.year) ? (
<div className="flex flex-row gap-2 items-center justify-end">
<div className="h-2 w-2 rounded-full bg-primary_default" />
<p className="body-bold text-right">
{booking.weekNumber}
</p>
</div>
) : (
<p className="body text-right">{booking.weekNumber}</p>
)}

<p className="detail text-neutral_l1 text-right">
{booking.dateString}
</p>
</div>
<p className="detail text-neutral_l1 text-right">
{b.dateString}
</p>
</th>
))}
</tr>
Expand Down
Loading