// Rôle : regroupe les switches, alertes et choix de couleur du formulaire calendrier.
import { Icon } from "../../../components/Icon.jsx";
import {
CALENDAR_ALERT_OFFSETS,
CALENDAR_COLORS,
CALENDAR_COLOR_VALUES
} from "./calendarUtils.js";
import { ALERT_MODES } from "./timerOptions.js";
export function MonthlyRepeatSwitch({ value, textContent, onChange }) {
const options = [
{ value: "monthDay", icon: "day-number", label: textContent.monthlyRepeatMonthDay || "Numéro du jour" },
{ value: "weekday", icon: "day-name", label: textContent.monthlyRepeatWeekday || "Jour de semaine" }
];
return (
{options.map((option) => (
))}
);
}
export function MonthEventRepeatSwitch({ value, monthlyRepeatBy, textContent, onChange }) {
const options = [
{ value: "none", icon: "close", label: textContent.repeatNone || "Aucune" },
{ value: "weekly", icon: "calendar-week", label: textContent.repeatWeekly || "Chaque semaine", disabled: monthlyRepeatBy === "monthDay" },
{ value: "monthly", icon: "calendar-month", label: textContent.repeatMonthly || "Chaque mois" }
];
const safeValue = monthlyRepeatBy === "monthDay" && value === "weekly" ? "none" : value;
return (
{options.map((option) => (
))}
);
}
export function CalendarAlertOffsets({ selectedOffsets, textContent, onToggle }) {
const labels = {
10: textContent.alertOffset10 || "10 min avant",
5: textContent.alertOffset5 || "5 min avant",
0: textContent.alertOffset0 || "Au début"
};
return (
);
}
export function CalendarColorPicker({ value, textContent, onChange }) {
const label = textContent.colorLabel || "Couleur";
return (
{label}
{CALENDAR_COLORS.map((color) => (
);
}
export function CalendarAlertModeSwitch({ mode, textContent, onChange }) {
const labels = {
off: textContent.alertOffTitle || "Pas d'alerte",
visible: textContent.alertVisibleTitle || "Alerte quand la toolbox est affichée",
site: textContent.alertSiteTitle || "Alerte sur tout le site"
};
return (
{ALERT_MODES.map((option) => (
))}
);
}