Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
type SyntheticEvent,
|
||||
} from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { ResourceIcon } from "./ResourceIcon";
|
||||
|
||||
export interface User {
|
||||
email: string;
|
||||
@@ -289,14 +290,21 @@ export function PeopleSearch({
|
||||
renderOption={(props, option) => {
|
||||
if (selectedUsers.find((u) => u.email === option.email)) return null;
|
||||
const { key, ...otherProps } = props;
|
||||
const isResource = option.objectType === "resource";
|
||||
return (
|
||||
<ListItem key={key + option?.email} {...otherProps} disableGutters>
|
||||
<ListItemAvatar>
|
||||
<Avatar {...stringAvatar(option.displayName || option.email)} />
|
||||
{isResource ? (
|
||||
<ResourceIcon displayName={option.displayName} />
|
||||
) : (
|
||||
<Avatar
|
||||
{...stringAvatar(option.displayName || option.email)}
|
||||
/>
|
||||
)}
|
||||
</ListItemAvatar>
|
||||
<ListItemText
|
||||
primary={option.displayName}
|
||||
secondary={option.email}
|
||||
secondary={isResource ? "" : option.email}
|
||||
slotProps={{
|
||||
primary: { variant: "body2" },
|
||||
secondary: { variant: "caption" },
|
||||
|
||||
@@ -283,7 +283,7 @@ export default function CalendarResources({
|
||||
cal,
|
||||
owner: user,
|
||||
}))
|
||||
: { cal: undefined, owner: user };
|
||||
: [{ cal: undefined, owner: user }];
|
||||
}
|
||||
return null;
|
||||
})
|
||||
|
||||
@@ -81,7 +81,7 @@ export function TempCalendarsInput({
|
||||
|
||||
return (
|
||||
<PeopleSearch
|
||||
objectTypes={["user"]}
|
||||
objectTypes={["user", "resource"]}
|
||||
selectedUsers={tempUsers}
|
||||
onChange={handleUserChange}
|
||||
onToggleEventPreview={handleToggleEventPreview}
|
||||
|
||||
Reference in New Issue
Block a user