mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
bd68e47e03
* feat: page verification workflow * feat: refactor page-verification * sync * fix type * fix * fix * notification icon * use full word * accept .license file * - update templates - update migration and notification * fix copy * update audit labels * sync * add space name
44 lines
1009 B
TypeScript
44 lines
1009 B
TypeScript
import { Group, SelectProps, Text } from "@mantine/core";
|
|
import { CustomAvatar } from "@/components/ui/custom-avatar";
|
|
import { IUser } from "@/features/user/types/user.types";
|
|
|
|
export const MAX_VERIFIERS = 5;
|
|
|
|
export type UserOptionItem = {
|
|
value: string;
|
|
label: string;
|
|
email: string;
|
|
avatarUrl: string;
|
|
};
|
|
|
|
export function toUserOptions(users: IUser[] | undefined): UserOptionItem[] {
|
|
return (users ?? []).map((user) => ({
|
|
value: user.id,
|
|
label: user.name,
|
|
email: user.email,
|
|
avatarUrl: user.avatarUrl,
|
|
}));
|
|
}
|
|
|
|
export const renderUserSelectOption: SelectProps["renderOption"] = ({
|
|
option,
|
|
}) => (
|
|
<Group gap="sm" wrap="nowrap">
|
|
<CustomAvatar
|
|
avatarUrl={option["avatarUrl"]}
|
|
size={20}
|
|
name={option.label}
|
|
/>
|
|
<div>
|
|
<Text size="sm" lineClamp={1}>
|
|
{option.label}
|
|
</Text>
|
|
{option["email"] && (
|
|
<Text size="xs" c="dimmed" lineClamp={1}>
|
|
{option["email"]}
|
|
</Text>
|
|
)}
|
|
</div>
|
|
</Group>
|
|
);
|