/**
* CalendarTree - left sidebar calendar selector for the Calendar plugin.
*
* Groups calendars by type (personal, team, project, company) with color dots,
* visibility checkboxes, and a "New Calendar" button at the bottom.
* Pattern follows DMS SourceTree.
*/
import React, { useState } from 'react';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import type { Calendar, CalendarType } from '@/api/calendar';
const TYPE_ORDER: CalendarType[] = ['personal', 'team', 'project', 'company'];
interface CalendarRowProps {
calendar: Calendar;
selected: boolean;
visible: boolean;
onSelect: () => void;
onToggleVisibility: () => void;
}
function CalendarRow({ calendar, selected, visible, onSelect, onToggleVisibility }: CalendarRowProps) {
return (
);
}
const grouped = new Map();
for (const type of TYPE_ORDER) {
grouped.set(type, []);
}
for (const cal of calendars) {
const list = grouped.get(cal.type) ?? grouped.get('personal')!;
list.push(cal);
}
return (
);
}
export default CalendarTree;