import CancelIcon from "@mui/icons-material/Cancel";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import Avatar from "@mui/material/Avatar";
import Badge from "@mui/material/Badge";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { userAttendee } from "../../../features/User/userDataTypes";
export function renderAttendeeBadge(
a: userAttendee,
key: string,
isFull?: boolean,
isOrganizer?: boolean
) {
const classIcon =
a.partstat === "ACCEPTED" ? (
) : a.partstat === "DECLINED" ? (
) : null;
if (!isFull) {
return ;
} else {
return (
{classIcon}
)
}
>
{a.cn || a.cal_address}
{isOrganizer && (
Organizer
)}
);
}
}
export function stringToColor(string: string) {
let hash = 0;
for (let i = 0; i < string.length; i++) {
hash = string.charCodeAt(i) + ((hash << 5) - hash);
}
let color = "#";
for (let i = 0; i < 3; i++) {
const value = (hash >> (i * 8)) & 0xff;
color += `00${value.toString(16)}`.slice(-2);
}
return color;
}
export function stringAvatar(name: string) {
return {
style: { backgroundColor: stringToColor(name) },
children: name[0],
};
}