* add team profile * first version for team members page * finish up design of member list item * fix dialog buttons * add missing seats and upgrading information * add v2 dialog for changing role * finish basic version of member's schedule * remove modalContainer * design fixes team profile page * show only team info to non admins * allow all member to check availabilities * make time available heading sticky * add dropdown for mobile view * create team appearance view * finish appearance page * use settings layout and add danger zone for member * add fallback logo * Add teams to sidebar and fix UI * add team invitations * Clean up * code clean up * add impersontation and disable autofocus on calendar * improve team info * refactor teaminvitelist code and fix leaving a team * add team pages to settings shell * add link to create new team * small fixes * clean up comments * V2 Multi-select (Team Select) (#4324) * --init * design improved * further fine tuning * more fixes * removed extra JSX tag * added story * NIT * revert to use of CheckedTeamSelect * Removes comments Co-authored-by: Peer Richelsen <[email protected]> * fix: toggle alligment (#4361) * fix: add checked tranform for switch (#4357) * fixed input size on mobile, fixed settings (#4360) * fix image uploader button in safari * code clean up * fixing type errors * Moved v2 team components to features Adds deprecation notices * Update SettingsLayout.tsx * Migrated to features and build fixes Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Syed Ali Shahbaz <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: zomars <[email protected]>
104 lines
3.7 KiB
TypeScript
104 lines
3.7 KiB
TypeScript
import React, { useState, useEffect } from "react";
|
|
|
|
import dayjs from "@calcom/dayjs";
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
|
|
import TimezoneSelect, { ITimezone } from "@calcom/ui/form/TimezoneSelect";
|
|
import { Avatar, Label, Select } from "@calcom/ui/v2";
|
|
import { DatePicker } from "@calcom/ui/v2";
|
|
|
|
import LicenseRequired from "../../../common/components/LicenseRequired";
|
|
import TeamAvailabilityTimes from "./TeamAvailabilityTimes";
|
|
|
|
interface Props {
|
|
team?: inferQueryOutput<"viewer.teams.get">;
|
|
member?: inferQueryOutput<"viewer.teams.get">["members"][number];
|
|
}
|
|
|
|
export default function TeamAvailabilityModal(props: Props) {
|
|
const utils = trpc.useContext();
|
|
const [selectedDate, setSelectedDate] = useState(dayjs());
|
|
const [selectedTimeZone, setSelectedTimeZone] = useState<ITimezone>(
|
|
localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()
|
|
);
|
|
|
|
const { t } = useLocale();
|
|
|
|
const [frequency, setFrequency] = useState<15 | 30 | 60>(30);
|
|
|
|
useEffect(() => {
|
|
utils.invalidateQueries(["viewer.teams.getMemberAvailability"]);
|
|
}, [utils, selectedTimeZone, selectedDate]);
|
|
|
|
return (
|
|
<LicenseRequired>
|
|
<>
|
|
<div className="grid h-[400px] w-[36.7rem] grid-cols-2 space-x-11 rtl:space-x-reverse">
|
|
<div className="col-span-1">
|
|
<div className="flex">
|
|
<Avatar
|
|
size="md"
|
|
imageSrc={WEBAPP_URL + "/" + props.member?.username + "/avatar.png"}
|
|
alt={props.member?.name || ""}
|
|
/>
|
|
<div className="flex items-center justify-center ">
|
|
<span className="ml-2 text-base font-semibold leading-4 text-gray-500">
|
|
{props.member?.name}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div className="text-brand-900 mt-4 mb-5 text-2xl font-semibold">{t("availability")}</div>
|
|
<DatePicker
|
|
minDate={new Date()}
|
|
date={selectedDate.toDate() || dayjs().toDate()}
|
|
onDatesChange={(newDate) => {
|
|
setSelectedDate(dayjs(newDate));
|
|
}}
|
|
/>
|
|
|
|
<Label className="mt-4">{t("timezone")}</Label>
|
|
<TimezoneSelect
|
|
id="timeZone"
|
|
autoFocus
|
|
value={selectedTimeZone}
|
|
className="w-64 rounded-md"
|
|
onChange={(timezone) => setSelectedTimeZone(timezone.value)}
|
|
classNamePrefix="react-select"
|
|
/>
|
|
</div>
|
|
<div className="mt-3">
|
|
<Label>{t("slot_length")}</Label>
|
|
<Select
|
|
options={[
|
|
{ value: 15, label: "15 minutes" },
|
|
{ value: 30, label: "30 minutes" },
|
|
{ value: 60, label: "60 minutes" },
|
|
]}
|
|
isSearchable={false}
|
|
classNamePrefix="react-select"
|
|
className="w-64"
|
|
value={{ value: frequency, label: `${frequency} minutes` }}
|
|
onChange={(newFrequency) => setFrequency(newFrequency?.value ?? 30)}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="col-span-1 max-h-[500px]">
|
|
{props.team && props.member && (
|
|
<TeamAvailabilityTimes
|
|
teamId={props.team.id}
|
|
memberId={props.member.id}
|
|
frequency={frequency}
|
|
selectedDate={selectedDate}
|
|
selectedTimeZone={selectedTimeZone}
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</>
|
|
</LicenseRequired>
|
|
);
|
|
}
|