import type { IDateValue } from 'src/types/common';
import type { ICalendarView } from 'src/types/calendar';
import { usePopover } from 'minimal-shared/hooks';
import Box from '@mui/material/Box';
import Badge from '@mui/material/Badge';
import Button from '@mui/material/Button';
import MenuList from '@mui/material/MenuList';
import MenuItem from '@mui/material/MenuItem';
import IconButton from '@mui/material/IconButton';
import Typography from '@mui/material/Typography';
import LinearProgress from '@mui/material/LinearProgress';
import { Iconify } from 'src/components/iconify';
import { CustomPopover } from 'src/components/custom-popover';
// ----------------------------------------------------------------------
const VIEW_OPTIONS = [
{ value: 'dayGridMonth', label: 'Month', icon: 'mingcute:calendar-month-line' },
{ value: 'timeGridWeek', label: 'Week', icon: 'mingcute:calendar-week-line' },
{ value: 'timeGridDay', label: 'Day', icon: 'mingcute:calendar-day-line' },
{ value: 'listWeek', label: 'Agenda', icon: 'custom:calendar-agenda-outline' },
] as const;
// ----------------------------------------------------------------------
type Props = {
loading: boolean;
canReset: boolean;
view: ICalendarView;
date: IDateValue;
onToday: () => void;
onNextDate: () => void;
onPrevDate: () => void;
onOpenFilters: () => void;
onChangeView: (newView: ICalendarView) => void;
};
export function CalendarToolbar({
date,
view,
loading,
onToday,
canReset,
onNextDate,
onPrevDate,
onChangeView,
onOpenFilters,
}: Props) {
const menuActions = usePopover();
const selectedItem = VIEW_OPTIONS.filter((item) => item.value === view)[0];
const renderMenuActions = () => (
{VIEW_OPTIONS.map((viewOption) => (
))}
);
return (
<>
}
endIcon={}
sx={{ display: { xs: 'none', sm: 'inline-flex' } }}
>
{selectedItem.label}
{/* FIXME: no raw json output in html */}
{JSON.stringify({ date })}
{loading && (
)}
{renderMenuActions()}
>
);
}