diff --git a/modules/companies/src/web/departments/list/ui/department-section.tsx b/modules/companies/src/web/departments/list/ui/department-section.tsx
index d509c3a..cee05b7 100644
--- a/modules/companies/src/web/departments/list/ui/department-section.tsx
+++ b/modules/companies/src/web/departments/list/ui/department-section.tsx
@@ -11,6 +11,7 @@ import { useTranslation } from "react-i18next";
import type { CompanyDTO } from "../../../../common";
import { DepartmentEditorDialog } from "../../shared";
+import { PersonAvatarGroup } from "../../../people";
export function DepartmentSection({
company,
@@ -56,15 +57,13 @@ export function DepartmentSection({
company.assignments.filter(
(entry) => entry.departmentId === item.id && entry.endDate === null
).length,
- render: (item) => (
- <>
- {
- company.assignments.filter(
- (entry) => entry.departmentId === item.id && entry.endDate === null
- ).length
- }
- >
- ),
+ render: (item) => {
+ const people = company.assignments
+ .filter((entry) => entry.departmentId === item.id && entry.endDate === null)
+ .map((entry) => company.people.find((person) => person.id === entry.personId))
+ .filter((person): person is CompanyDTO["people"][number] => Boolean(person));
+ return ;
+ },
},
{
id: "actions",
diff --git a/modules/companies/src/web/people/index.ts b/modules/companies/src/web/people/index.ts
index 0d8a350..b311610 100644
--- a/modules/companies/src/web/people/index.ts
+++ b/modules/companies/src/web/people/index.ts
@@ -1,2 +1,2 @@
export { PeopleSection } from "./list";
-export { PersonEditorDialog, PersonForm } from "./shared";
+export { PersonEditorDialog, PersonForm, PersonAvatarGroup } from "./shared";
diff --git a/modules/companies/src/web/people/shared/index.ts b/modules/companies/src/web/people/shared/index.ts
index 10da975..739b52c 100644
--- a/modules/companies/src/web/people/shared/index.ts
+++ b/modules/companies/src/web/people/shared/index.ts
@@ -1 +1 @@
-export { PersonEditorDialog, PersonForm, PersonAvatar } from "./ui";
+export { PersonEditorDialog, PersonForm, PersonAvatar, PersonAvatarGroup } from "./ui";
diff --git a/modules/companies/src/web/people/shared/ui/index.ts b/modules/companies/src/web/people/shared/ui/index.ts
index c568f44..8af0b3c 100644
--- a/modules/companies/src/web/people/shared/ui/index.ts
+++ b/modules/companies/src/web/people/shared/ui/index.ts
@@ -1,4 +1,4 @@
export { PersonEditorDialog } from "./person-editor-dialog";
export { PersonForm } from "./person-form";
-export { PersonAvatar } from "./person-avatar";
+export { PersonAvatar, PersonAvatarGroup } from "./person-avatar";
diff --git a/modules/companies/src/web/people/shared/ui/person-avatar.tsx b/modules/companies/src/web/people/shared/ui/person-avatar.tsx
index e2d99c4..db8a507 100644
--- a/modules/companies/src/web/people/shared/ui/person-avatar.tsx
+++ b/modules/companies/src/web/people/shared/ui/person-avatar.tsx
@@ -4,3 +4,17 @@ export function PersonAvatar({ companyId, personId, photoVersion, name, classNam
const src = photoVersion ? `/api/companies/${companyId}/people/${personId}/photo?version=${photoVersion}` : undefined;
return {initials};
}
+
+export function PersonAvatarGroup({ companyId, people, max = 3, peopleLabel = "Personas" }: { companyId: string; people: readonly { id: string; name: string; photoVersion?: string | null | undefined }[]; max?: number; peopleLabel?: string }) {
+ const visible = people.slice(0, max);
+ const remaining = people.length - visible.length;
+ if (!people.length) return —;
+ return (
+
+
+ {visible.map((person) =>
)}
+
+ {remaining > 0 &&
+{remaining}}
+
+ );
+}