
* [WIP] checkpoint before pull & merge - Added teams to sidebar - Refactored team settings - Improved team list UI This code will be partly reverted next commit. * [WIP] - Moved team code back to components - Removed team link from sidebar - Built new team manager screen based on Event Type designs - Component-ized frequently reused code (SettingInputContainer, FlatIconButton) * [WIP] - Created LinkIconButton as standalone component - Added functionality to sidebar of team settings - Fixed type bug on public team page induced by my normalization of members array in team query - Removed teams-old which was kept as refrence - Cleaned up loose ends * [WIP] - added create team model - fixed profile missing label due to my removal of default label from component * [WIP] - Fixed TeamCreateModal trigger - removed TeamShell, it didn't make the cut - added getPlaceHolderAvatar - renamed TeamCreate to TeamCreateModal - removed deprecated UsernameInput and replaced uses with suggested TextField * fix save button * [WIP] - Fixed drop down actions on team list - Cleaned up state updates * [WIP] converting teams to tRPC * [WIP] Finished refactor to tRPC * [WIP] Finishing touches * [WIP] Team availability beginning * team availability mvp * - added validation to change role - modified layout of team availability - corrected types * fix ui issue on team availability screen * - added virtualization to team availability - added flexChildrenContainer boolean to Shell to allow for flex on children * availability style fix * removed hard coded team type as teams now use inferred type from tRPC * Removed unneeded vscode settings * Reverted prisma schema * Fixed migrations * Removes unused dayjs plugins * Reverts type regression * Type fix * Type fixes * Type fixes * Moves team availability code to ee Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import classNames from "classnames";
|
|
import dayjs, { Dayjs } from "dayjs";
|
|
import utc from "dayjs/plugin/utc";
|
|
import React from "react";
|
|
import { ITimezone } from "react-timezone-select";
|
|
|
|
import getSlots from "@lib/slots";
|
|
import { inferQueryOutput, trpc } from "@lib/trpc";
|
|
|
|
import Loader from "@components/Loader";
|
|
|
|
interface Props {
|
|
team: inferQueryOutput<"viewer.teams.get">;
|
|
member: inferQueryOutput<"viewer.teams.get">["members"][number];
|
|
selectedDate: Dayjs;
|
|
selectedTimeZone: ITimezone;
|
|
frequency: number;
|
|
HeaderComponent?: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
dayjs.extend(utc);
|
|
|
|
export default function TeamAvailabilityTimes(props: Props) {
|
|
const { data, isLoading } = trpc.useQuery(
|
|
[
|
|
"viewer.teams.getMemberAvailability",
|
|
{
|
|
teamId: props.team.id,
|
|
memberId: props.member.id,
|
|
dateFrom: props.selectedDate.toString(),
|
|
dateTo: props.selectedDate.add(1, "day").toString(),
|
|
timezone: `${props.selectedTimeZone.toString()}`,
|
|
},
|
|
],
|
|
{
|
|
refetchOnWindowFocus: false,
|
|
}
|
|
);
|
|
|
|
const times = !isLoading
|
|
? getSlots({
|
|
frequency: props.frequency,
|
|
inviteeDate: props.selectedDate,
|
|
workingHours: data?.workingHours || [],
|
|
minimumBookingNotice: 0,
|
|
})
|
|
: [];
|
|
|
|
return (
|
|
<div className={classNames("flex-grow p-5 pl-0 min-w-60", props.className)}>
|
|
{props.HeaderComponent}
|
|
{isLoading && times.length === 0 && <Loader />}
|
|
{!isLoading && times.length === 0 && (
|
|
<div className="flex flex-col items-center justify-center pt-4">
|
|
<span className="text-sm text-gray-500">No Available Slots</span>
|
|
</div>
|
|
)}
|
|
{times.map((time) => (
|
|
<div key={time.format()} className="flex flex-row items-center">
|
|
<a
|
|
className="flex-grow block py-2 mb-2 mr-3 font-medium text-center bg-white border rounded-sm min-w-48 dark:bg-gray-600 text-primary-500 dark:text-neutral-200 border-brand dark:border-transparent hover:text-white hover:bg-brand dark:hover:border-black dark:hover:bg-black"
|
|
data-testid="time">
|
|
{time.format("HH:mm")}
|
|
</a>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|