import FormatListBulletedIcon from "@mui/icons-material/FormatListBulleted"; import LockIcon from "@mui/icons-material/Lock"; import PublicIcon from "@mui/icons-material/Public"; import { Box, Button, TextField, ToggleButton, ToggleButtonGroup, Typography, } from "@mui/material"; import { useState } from "react"; import { useAppSelector } from "../../app/hooks"; import { Calendars } from "../../features/Calendars/CalendarTypes"; import { ColorPicker } from "./CalendarColorPicker"; export function SettingsTab({ name, setName, description, setDescription, color, setColor, visibility, setVisibility, calendar, }: { name: string; setName: Function; description: string; setDescription: Function; color: Record; setColor: Function; visibility: "public" | "private"; setVisibility: Function; calendar?: Calendars; }) { const [toggleDesc, setToggleDesc] = useState(Boolean(description)); const userId = useAppSelector((state) => state.user.userData?.openpaasId) ?? ""; const isOwn = calendar ? calendar.id.split("/")[0] === userId : true; return ( setName(e.target.value)} size="small" margin="dense" /> {!toggleDesc && ( )} {toggleDesc && ( setDescription(e.target.value)} size="small" margin="dense" multiline rows={2} /> )} Color setColor(color)} selectedColor={color} /> {isOwn && ( New events created will be visible to: val && setVisibility(val)} size="small" > All You )} ); }