Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
@@ -295,7 +295,7 @@ export function PeopleSearch({
|
|||||||
<ListItem key={key + option?.email} {...otherProps} disableGutters>
|
<ListItem key={key + option?.email} {...otherProps} disableGutters>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
{isResource ? (
|
{isResource ? (
|
||||||
<ResourceIcon displayName={option.displayName} />
|
<ResourceIcon avatarUrl={option.avatarUrl} />
|
||||||
) : (
|
) : (
|
||||||
<Avatar
|
<Avatar
|
||||||
{...stringAvatar(option.displayName || option.email)}
|
{...stringAvatar(option.displayName || option.email)}
|
||||||
|
|||||||
@@ -1,54 +1,21 @@
|
|||||||
import { Avatar } from "@linagora/twake-mui";
|
import { Avatar } from "@linagora/twake-mui";
|
||||||
import PeopleAltOutlinedIcon from "@mui/icons-material/PeopleAltOutlined";
|
|
||||||
import CalendarMonthOutlinedIcon from "@mui/icons-material/CalendarMonthOutlined";
|
|
||||||
import PhoneIphoneOutlinedIcon from "@mui/icons-material/PhoneIphoneOutlined";
|
|
||||||
import DescriptionOutlinedIcon from "@mui/icons-material/DescriptionOutlined";
|
|
||||||
import VideoCameraBackOutlinedIcon from "@mui/icons-material/VideoCameraBackOutlined";
|
|
||||||
import MeetingRoomOutlinedIcon from "@mui/icons-material/MeetingRoomOutlined";
|
|
||||||
import LayersOutlinedIcon from "@mui/icons-material/LayersOutlined";
|
import LayersOutlinedIcon from "@mui/icons-material/LayersOutlined";
|
||||||
import ViewComfyAltOutlinedIcon from "@mui/icons-material/ViewComfyAltOutlined";
|
|
||||||
import TvOutlinedIcon from "@mui/icons-material/TvOutlined";
|
|
||||||
import type { SvgIconComponent } from "@mui/icons-material";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* displayName → MUI icon mapping.
|
|
||||||
* Add new entries here when new resources are created.
|
|
||||||
*/
|
|
||||||
const RESOURCE_ICON_MAP: Record<string, SvgIconComponent> = {
|
|
||||||
"Astreinte OSSA": PeopleAltOutlinedIcon,
|
|
||||||
"Chômage Partiel": CalendarMonthOutlinedIcon,
|
|
||||||
Congés: CalendarMonthOutlinedIcon,
|
|
||||||
COPIL: CalendarMonthOutlinedIcon,
|
|
||||||
"Iphone 11 Pro Max": PhoneIphoneOutlinedIcon,
|
|
||||||
"Note de Service": DescriptionOutlinedIcon,
|
|
||||||
"OSS Events": CalendarMonthOutlinedIcon,
|
|
||||||
"Permanence OSSA": PeopleAltOutlinedIcon,
|
|
||||||
"Projo salle 404": VideoCameraBackOutlinedIcon,
|
|
||||||
"Salle-bat-A-S215-visio-15p": MeetingRoomOutlinedIcon,
|
|
||||||
"Salle-bat-A-S216-ecran-5p": MeetingRoomOutlinedIcon,
|
|
||||||
"Salle-bat-B-S217-10p": MeetingRoomOutlinedIcon,
|
|
||||||
"Salle-bat-C-S218-ecran-20p": MeetingRoomOutlinedIcon,
|
|
||||||
"Salle-bat-D-S218-visio-amphi-200p": MeetingRoomOutlinedIcon,
|
|
||||||
Télétravail: LayersOutlinedIcon,
|
|
||||||
"TV - VN": TvOutlinedIcon,
|
|
||||||
"Veille COPIL": LayersOutlinedIcon,
|
|
||||||
"White Board - VN": ViewComfyAltOutlinedIcon,
|
|
||||||
};
|
|
||||||
|
|
||||||
function getIconForDisplayName(displayName: string): SvgIconComponent {
|
|
||||||
return RESOURCE_ICON_MAP[displayName] ?? LayersOutlinedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ResourceIconProps {
|
interface ResourceIconProps {
|
||||||
displayName: string;
|
avatarUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ResourceIcon({ displayName }: ResourceIconProps) {
|
export function ResourceIcon({ avatarUrl }: ResourceIconProps) {
|
||||||
const IconComponent = getIconForDisplayName(displayName);
|
return avatarUrl ? (
|
||||||
|
<Avatar
|
||||||
return (
|
sx={{ backgroundColor: "transparent", width: "24px", height: "24px" }}
|
||||||
<Avatar sx={{ backgroundColor: "transparent" }}>
|
src={avatarUrl}
|
||||||
<IconComponent fontSize="medium" />
|
/>
|
||||||
|
) : (
|
||||||
|
<Avatar
|
||||||
|
sx={{ backgroundColor: "transparent", width: "24px", height: "24px" }}
|
||||||
|
>
|
||||||
|
<LayersOutlinedIcon />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ export function ResourceSearch({
|
|||||||
disableGutters
|
disableGutters
|
||||||
>
|
>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<ResourceIcon displayName={option.displayName} />
|
<ResourceIcon avatarUrl={option.avatarUrl} />
|
||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
<ListItemText primary={option.displayName} />
|
<ListItemText primary={option.displayName} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function CalendarItem({
|
|||||||
gap={2}
|
gap={2}
|
||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center" gap={1}>
|
<Box display="flex" alignItems="center" gap={1}>
|
||||||
<ResourceIcon displayName={cal.owner.displayName} />
|
<ResourceIcon avatarUrl={cal.owner.avatarUrl} />
|
||||||
<Typography variant="body1">
|
<Typography variant="body1">
|
||||||
{renameDefault(cal.cal["dav:name"], cal.owner.displayName, t, false)}
|
{renameDefault(cal.cal["dav:name"], cal.owner.displayName, t, false)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
Reference in New Issue
Block a user