2022-12-14 13:36:10 +00:00
|
|
|
import dayjs from "@calcom/dayjs";
|
2023-01-23 23:08:01 +00:00
|
|
|
import { Button, ButtonGroup } from "@calcom/ui";
|
|
|
|
import { FiChevronLeft, FiChevronRight } from "@calcom/ui/components/icon";
|
2022-12-14 13:36:10 +00:00
|
|
|
|
|
|
|
import { useCalendarStore } from "../../state/store";
|
|
|
|
|
|
|
|
export function SchedulerHeading() {
|
|
|
|
const { startDate, endDate, handleDateChange } = useCalendarStore((state) => ({
|
|
|
|
startDate: dayjs(state.startDate),
|
|
|
|
endDate: dayjs(state.endDate),
|
|
|
|
handleDateChange: state.handleDateChange,
|
|
|
|
}));
|
|
|
|
|
|
|
|
return (
|
|
|
|
<header className="flex flex-none flex-col justify-between py-4 sm:flex-row sm:items-center">
|
|
|
|
<h1 className="text-xl font-semibold text-gray-900">
|
2023-02-09 19:01:43 +00:00
|
|
|
{startDate.format("MMM DD")}-{endDate.format("DD")}
|
2022-12-14 13:36:10 +00:00
|
|
|
<span className="text-gray-500">,{startDate.format("YYYY")}</span>
|
|
|
|
</h1>
|
2023-01-04 07:38:45 +00:00
|
|
|
<div className="flex items-center space-x-2 rtl:space-x-reverse">
|
2022-12-14 13:36:10 +00:00
|
|
|
{/* TODO: Renable when we have daily/mobile support */}
|
|
|
|
{/* <ToggleGroup
|
|
|
|
options={[
|
|
|
|
{ label: "Daily", value: "day", disabled: false },
|
|
|
|
{ label: "Weekly", value: "week", disabled: isSm },
|
|
|
|
]}
|
|
|
|
defaultValue={view === "day" ? "day" : "week"}
|
|
|
|
/> */}
|
|
|
|
|
|
|
|
<ButtonGroup combined>
|
|
|
|
{/* TODO: i18n label with correct view */}
|
|
|
|
<Button
|
2023-01-23 23:08:01 +00:00
|
|
|
StartIcon={FiChevronLeft}
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2022-12-14 13:36:10 +00:00
|
|
|
color="secondary"
|
|
|
|
aria-label="Previous Week"
|
|
|
|
onClick={() => {
|
|
|
|
handleDateChange("DECREMENT");
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Button
|
2023-01-23 23:08:01 +00:00
|
|
|
StartIcon={FiChevronRight}
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2022-12-14 13:36:10 +00:00
|
|
|
color="secondary"
|
|
|
|
aria-label="Next Week"
|
|
|
|
onClick={() => {
|
|
|
|
handleDateChange("INCREMENT");
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</ButtonGroup>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|