From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001
From: Martial Simon <msimon_fr@hotmail.com>
Date: Mon, 15 Sep 2025 01:07:58 +0200
Subject: add: added projects

---
 .../src/lib/components/input/UserSelector.svelte   | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 ping/frontend/src/lib/components/input/UserSelector.svelte

(limited to 'ping/frontend/src/lib/components/input/UserSelector.svelte')

diff --git a/ping/frontend/src/lib/components/input/UserSelector.svelte b/ping/frontend/src/lib/components/input/UserSelector.svelte
new file mode 100644
index 0000000..a0c80c7
--- /dev/null
+++ b/ping/frontend/src/lib/components/input/UserSelector.svelte
@@ -0,0 +1,35 @@
+<script lang="ts">
+	import type { IUser } from '$lib/stores/auth';
+	import { addToast } from '$lib/stores/toast';
+	import Avatar from '../Avatar.svelte';
+
+	let { users = $bindable<IUser[]>([]) }: { users: IUser[] } = $props();
+</script>
+
+<div>
+	{#each users as u, i}
+		<Avatar
+			username={u.displayName}
+			url={u.avatar}
+			onclick={() => {
+				users = users.filter((_, index) => index !== i);
+			}}
+		/>
+	{/each}
+	<Avatar
+		username={'Ajouter un utilisateur'}
+		url={'/icons/add-green.svg'}
+		onclick={() => {
+			let userId = prompt("Entrez l'ID de l'utilisateur à ajouter :");
+			if (userId === null || userId.trim() === '') {
+				addToast({ title: 'ID utilisateur invalide.' });
+				return;
+			}
+			if (users.map((u) => u.displayName).includes(userId)) {
+				addToast({ title: 'Cet utilisateur est déjà ajouté.' });
+				return;
+			}
+			users = [...users, { displayName: userId, avatar: '/img/default-avatar.png' } as IUser];
+		}}
+	/>
+</div>
-- 
cgit v1.2.3

