feat: integrate user team retrieval into session components, enhancing sharing functionality and user experience across motivators, sessions, weekly check-ins, and year reviews
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m35s

This commit is contained in:
Julien Froidefond
2026-02-17 14:47:43 +01:00
parent 4d04d3ede8
commit d05157d498
19 changed files with 345 additions and 892 deletions

View File

@@ -4,9 +4,11 @@ import { useState, useCallback } from 'react';
import { useSessionLive, type LiveEvent } from '@/hooks/useSessionLive';
import { LiveIndicator } from './LiveIndicator';
import { ShareModal } from './ShareModal';
import { shareSessionAction, removeShareAction } from '@/actions/share';
import { Button } from '@/components/ui/Button';
import { Avatar } from '@/components/ui/Avatar';
import type { ShareRole } from '@prisma/client';
import type { TeamWithMembers } from '@/lib/share-utils';
interface ShareUser {
id: string;
@@ -28,6 +30,7 @@ interface SessionLiveWrapperProps {
shares: Share[];
isOwner: boolean;
canEdit: boolean;
userTeams?: TeamWithMembers[];
children: React.ReactNode;
}
@@ -38,6 +41,7 @@ export function SessionLiveWrapper({
shares,
isOwner,
canEdit,
userTeams = [],
children,
}: SessionLiveWrapperProps) {
const [shareModalOpen, setShareModalOpen] = useState(false);
@@ -122,10 +126,22 @@ export function SessionLiveWrapper({
<ShareModal
isOpen={shareModalOpen}
onClose={() => setShareModalOpen(false)}
sessionId={sessionId}
title="Partager la session"
sessionSubtitle="Session"
sessionTitle={sessionTitle}
shares={shares}
isOwner={isOwner}
userTeams={userTeams}
currentUserId={currentUserId}
onShareWithEmail={(email, role) => shareSessionAction(sessionId, email, role)}
onRemoveShare={(userId) => removeShareAction(sessionId, userId)}
helpText={
<>
<strong>Éditeur</strong> : peut modifier les items et actions
<br />
<strong>Lecteur</strong> : peut uniquement consulter
</>
}
/>
</>
);