feat: implement auto-sharing functionality for session creation across motivators, weekly check-ins, and year reviews, enhancing collaboration capabilities

This commit is contained in:
Julien Froidefond
2026-02-17 15:11:46 +01:00
parent d05157d498
commit 520a1f4838
11 changed files with 133 additions and 24 deletions

View File

@@ -0,0 +1,56 @@
'use client';
import { useState, useEffect } from 'react';
import { Select } from '@/components/ui';
interface TeamMemberUser {
id: string;
email: string;
name: string | null;
}
interface ParticipantInputProps {
name: string;
label?: string;
required?: boolean;
}
export function ParticipantInput({
name,
label = "Choisir un membre de l'équipe",
required = true,
}: ParticipantInputProps) {
const [teamMembers, setTeamMembers] = useState<TeamMemberUser[]>([]);
const [value, setValue] = useState('');
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('/api/teams/members')
.then((res) => res.json())
.then((data) => setTeamMembers(data.members ?? []))
.catch(() => setTeamMembers([]))
.finally(() => setLoading(false));
}, []);
const options =
teamMembers.length > 0
? teamMembers.map((m) => ({
value: m.email,
label: m.name ? `${m.name} (${m.email})` : m.email,
}))
: [{ value: '', label: 'Aucun membre dans vos équipes', disabled: true }];
if (loading) return null;
return (
<Select
name={name}
label={label}
options={options}
placeholder={teamMembers.length > 0 ? '— Sélectionner —' : undefined}
value={value}
onChange={(e) => setValue(e.target.value)}
required={required}
/>
);
}

View File

@@ -10,6 +10,7 @@ export { EditableYearReviewTitle } from './EditableYearReviewTitle';
export { EditableWeeklyCheckInTitle } from './EditableWeeklyCheckInTitle';
export { EditableWeatherTitle } from './EditableWeatherTitle';
export { Input } from './Input';
export { ParticipantInput } from './ParticipantInput';
export { Modal, ModalFooter } from './Modal';
export { RocketIcon } from './RocketIcon';
export { Select } from './Select';