feat: add GIF Mood Board workshop
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m5s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m5s
- New workshop where each team member shares up to 5 GIFs with notes to express their weekly mood - Per-user week rating (1-5 stars) visible next to each member's section - Masonry-style grid with adjustable column count (3/4/5) toggle - Handwriting font (Caveat) for GIF notes - Full real-time collaboration via SSE - Clean migration (add_gif_mood_workshop) safe for production deploy - DB backup via cp before each migration in docker-entrypoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import { deleteMotivatorSession, updateMotivatorSession } from '@/actions/moving
|
||||
import { deleteYearReviewSession, updateYearReviewSession } from '@/actions/year-review';
|
||||
import { deleteWeeklyCheckInSession, updateWeeklyCheckInSession } from '@/actions/weekly-checkin';
|
||||
import { deleteWeatherSession, updateWeatherSession } from '@/actions/weather';
|
||||
import { deleteGifMoodSession, updateGifMoodSession } from '@/actions/gif-mood';
|
||||
import {
|
||||
type WorkshopTabType,
|
||||
type WorkshopTypeId,
|
||||
@@ -125,12 +126,28 @@ interface WeatherSession {
|
||||
canEdit?: boolean;
|
||||
}
|
||||
|
||||
interface GifMoodSession {
|
||||
id: string;
|
||||
title: string;
|
||||
date: Date;
|
||||
updatedAt: Date;
|
||||
isOwner: boolean;
|
||||
role: 'OWNER' | 'VIEWER' | 'EDITOR';
|
||||
user: { id: string; name: string | null; email: string };
|
||||
shares: Share[];
|
||||
_count: { items: number };
|
||||
workshopType: 'gif-mood';
|
||||
isTeamCollab?: true;
|
||||
canEdit?: boolean;
|
||||
}
|
||||
|
||||
type AnySession =
|
||||
| SwotSession
|
||||
| MotivatorSession
|
||||
| YearReviewSession
|
||||
| WeeklyCheckInSession
|
||||
| WeatherSession;
|
||||
| WeatherSession
|
||||
| GifMoodSession;
|
||||
|
||||
interface WorkshopTabsProps {
|
||||
swotSessions: SwotSession[];
|
||||
@@ -138,6 +155,7 @@ interface WorkshopTabsProps {
|
||||
yearReviewSessions: YearReviewSession[];
|
||||
weeklyCheckInSessions: WeeklyCheckInSession[];
|
||||
weatherSessions: WeatherSession[];
|
||||
gifMoodSessions: GifMoodSession[];
|
||||
teamCollabSessions?: (AnySession & { isTeamCollab?: true })[];
|
||||
}
|
||||
|
||||
@@ -150,7 +168,6 @@ function getResolvedCollaborator(session: AnySession): ResolvedCollaborator {
|
||||
} else if (session.workshopType === 'weekly-checkin') {
|
||||
return (session as WeeklyCheckInSession).resolvedParticipant;
|
||||
} else if (session.workshopType === 'weather') {
|
||||
// For weather sessions, use the owner as the "participant" since it's a personal weather
|
||||
const weatherSession = session as WeatherSession;
|
||||
return {
|
||||
raw: weatherSession.user.name || weatherSession.user.email,
|
||||
@@ -160,6 +177,16 @@ function getResolvedCollaborator(session: AnySession): ResolvedCollaborator {
|
||||
name: weatherSession.user.name,
|
||||
},
|
||||
};
|
||||
} else if (session.workshopType === 'gif-mood') {
|
||||
const gifMoodSession = session as GifMoodSession;
|
||||
return {
|
||||
raw: gifMoodSession.user.name || gifMoodSession.user.email,
|
||||
matchedUser: {
|
||||
id: gifMoodSession.user.id,
|
||||
email: gifMoodSession.user.email,
|
||||
name: gifMoodSession.user.name,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return (session as MotivatorSession).resolvedParticipant;
|
||||
}
|
||||
@@ -205,6 +232,7 @@ export function WorkshopTabs({
|
||||
yearReviewSessions,
|
||||
weeklyCheckInSessions,
|
||||
weatherSessions,
|
||||
gifMoodSessions,
|
||||
teamCollabSessions = [],
|
||||
}: WorkshopTabsProps) {
|
||||
const searchParams = useSearchParams();
|
||||
@@ -235,6 +263,7 @@ export function WorkshopTabs({
|
||||
...yearReviewSessions,
|
||||
...weeklyCheckInSessions,
|
||||
...weatherSessions,
|
||||
...gifMoodSessions,
|
||||
].sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
||||
|
||||
// Filter based on active tab (for non-byPerson tabs)
|
||||
@@ -251,7 +280,9 @@ export function WorkshopTabs({
|
||||
? yearReviewSessions
|
||||
: activeTab === 'weekly-checkin'
|
||||
? weeklyCheckInSessions
|
||||
: weatherSessions;
|
||||
: activeTab === 'gif-mood'
|
||||
? gifMoodSessions
|
||||
: weatherSessions;
|
||||
|
||||
// Separate by ownership (for non-team tab: owned, shared, teamCollab)
|
||||
const ownedSessions = filteredSessions.filter((s) => s.isOwner);
|
||||
@@ -305,6 +336,7 @@ export function WorkshopTabs({
|
||||
'year-review': yearReviewSessions.length,
|
||||
'weekly-checkin': weeklyCheckInSessions.length,
|
||||
weather: weatherSessions.length,
|
||||
'gif-mood': gifMoodSessions.length,
|
||||
team: teamCollabSessions.length,
|
||||
}}
|
||||
/>
|
||||
@@ -551,7 +583,7 @@ function SessionCard({
|
||||
? (session as SwotSession).collaborator
|
||||
: session.workshopType === 'year-review'
|
||||
? (session as YearReviewSession).participant
|
||||
: session.workshopType === 'weather'
|
||||
: session.workshopType === 'weather' || session.workshopType === 'gif-mood'
|
||||
? ''
|
||||
: (session as MotivatorSession).participant
|
||||
);
|
||||
@@ -561,6 +593,7 @@ function SessionCard({
|
||||
const isYearReview = session.workshopType === 'year-review';
|
||||
const isWeeklyCheckIn = session.workshopType === 'weekly-checkin';
|
||||
const isWeather = session.workshopType === 'weather';
|
||||
const isGifMood = session.workshopType === 'gif-mood';
|
||||
const href = getSessionPath(session.workshopType as WorkshopTypeId, session.id);
|
||||
const participant = isSwot
|
||||
? (session as SwotSession).collaborator
|
||||
@@ -570,7 +603,9 @@ function SessionCard({
|
||||
? (session as WeeklyCheckInSession).participant
|
||||
: isWeather
|
||||
? (session as WeatherSession).user.name || (session as WeatherSession).user.email
|
||||
: (session as MotivatorSession).participant;
|
||||
: isGifMood
|
||||
? (session as GifMoodSession).user.name || (session as GifMoodSession).user.email
|
||||
: (session as MotivatorSession).participant;
|
||||
const accentColor = workshop.accentColor;
|
||||
|
||||
const handleDelete = () => {
|
||||
@@ -583,7 +618,9 @@ function SessionCard({
|
||||
? await deleteWeeklyCheckInSession(session.id)
|
||||
: isWeather
|
||||
? await deleteWeatherSession(session.id)
|
||||
: await deleteMotivatorSession(session.id);
|
||||
: isGifMood
|
||||
? await deleteGifMoodSession(session.id)
|
||||
: await deleteMotivatorSession(session.id);
|
||||
|
||||
if (result.success) {
|
||||
setShowDeleteModal(false);
|
||||
@@ -609,10 +646,12 @@ function SessionCard({
|
||||
})
|
||||
: isWeather
|
||||
? await updateWeatherSession(session.id, { title: editTitle })
|
||||
: await updateMotivatorSession(session.id, {
|
||||
title: editTitle,
|
||||
participant: editParticipant,
|
||||
});
|
||||
: isGifMood
|
||||
? await updateGifMoodSession(session.id, { title: editTitle })
|
||||
: await updateMotivatorSession(session.id, {
|
||||
title: editTitle,
|
||||
participant: editParticipant,
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
setShowEditModal(false);
|
||||
@@ -705,6 +744,17 @@ function SessionCard({
|
||||
})}
|
||||
</span>
|
||||
</>
|
||||
) : isGifMood ? (
|
||||
<>
|
||||
<span>{(session as GifMoodSession)._count.items} GIFs</span>
|
||||
<span>·</span>
|
||||
<span>
|
||||
{new Date((session as GifMoodSession).date).toLocaleDateString('fr-FR', {
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
})}
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span>{(session as MotivatorSession)._count.cards}/10</span>
|
||||
)}
|
||||
@@ -834,7 +884,7 @@ function SessionCard({
|
||||
>
|
||||
{editParticipantLabel}
|
||||
</label>
|
||||
{!isWeather && (
|
||||
{!isWeather && !isGifMood && (
|
||||
<Input
|
||||
id="edit-participant"
|
||||
value={editParticipant}
|
||||
@@ -855,7 +905,7 @@ function SessionCard({
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={isPending || !editTitle.trim() || (!isWeather && !editParticipant.trim())}
|
||||
disabled={isPending || !editTitle.trim() || (!isWeather && !isGifMood && !editParticipant.trim())}
|
||||
>
|
||||
{isPending ? 'Enregistrement...' : 'Enregistrer'}
|
||||
</Button>
|
||||
|
||||
@@ -20,6 +20,10 @@ import {
|
||||
getWeatherSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamWeatherSessions,
|
||||
} from '@/services/weather';
|
||||
import {
|
||||
getGifMoodSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamGifMoodSessions,
|
||||
} from '@/services/gif-mood';
|
||||
import { Card } from '@/components/ui';
|
||||
import { withWorkshopType } from '@/lib/workshops';
|
||||
import { WorkshopTabs } from './WorkshopTabs';
|
||||
@@ -58,22 +62,26 @@ export default async function SessionsPage() {
|
||||
yearReviewSessions,
|
||||
weeklyCheckInSessions,
|
||||
weatherSessions,
|
||||
gifMoodSessions,
|
||||
teamSwotSessions,
|
||||
teamMotivatorSessions,
|
||||
teamYearReviewSessions,
|
||||
teamWeeklyCheckInSessions,
|
||||
teamWeatherSessions,
|
||||
teamGifMoodSessions,
|
||||
] = await Promise.all([
|
||||
getSessionsByUserId(session.user.id),
|
||||
getMotivatorSessionsByUserId(session.user.id),
|
||||
getYearReviewSessionsByUserId(session.user.id),
|
||||
getWeeklyCheckInSessionsByUserId(session.user.id),
|
||||
getWeatherSessionsByUserId(session.user.id),
|
||||
getGifMoodSessionsByUserId(session.user.id),
|
||||
getTeamSwotSessions(session.user.id),
|
||||
getTeamMotivatorSessions(session.user.id),
|
||||
getTeamYearReviewSessions(session.user.id),
|
||||
getTeamWeeklyCheckInSessions(session.user.id),
|
||||
getTeamWeatherSessions(session.user.id),
|
||||
getTeamGifMoodSessions(session.user.id),
|
||||
]);
|
||||
|
||||
// Add workshopType to each session for unified display
|
||||
@@ -82,12 +90,14 @@ export default async function SessionsPage() {
|
||||
const allYearReviewSessions = withWorkshopType(yearReviewSessions, 'year-review');
|
||||
const allWeeklyCheckInSessions = withWorkshopType(weeklyCheckInSessions, 'weekly-checkin');
|
||||
const allWeatherSessions = withWorkshopType(weatherSessions, 'weather');
|
||||
const allGifMoodSessions = withWorkshopType(gifMoodSessions, 'gif-mood');
|
||||
|
||||
const teamSwotWithType = withWorkshopType(teamSwotSessions, 'swot');
|
||||
const teamMotivatorWithType = withWorkshopType(teamMotivatorSessions, 'motivators');
|
||||
const teamYearReviewWithType = withWorkshopType(teamYearReviewSessions, 'year-review');
|
||||
const teamWeeklyCheckInWithType = withWorkshopType(teamWeeklyCheckInSessions, 'weekly-checkin');
|
||||
const teamWeatherWithType = withWorkshopType(teamWeatherSessions, 'weather');
|
||||
const teamGifMoodWithType = withWorkshopType(teamGifMoodSessions, 'gif-mood');
|
||||
|
||||
// Combine and sort by updatedAt
|
||||
const allSessions = [
|
||||
@@ -96,6 +106,7 @@ export default async function SessionsPage() {
|
||||
...allYearReviewSessions,
|
||||
...allWeeklyCheckInSessions,
|
||||
...allWeatherSessions,
|
||||
...allGifMoodSessions,
|
||||
].sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
||||
|
||||
const hasNoSessions = allSessions.length === 0;
|
||||
@@ -135,12 +146,14 @@ export default async function SessionsPage() {
|
||||
yearReviewSessions={allYearReviewSessions}
|
||||
weeklyCheckInSessions={allWeeklyCheckInSessions}
|
||||
weatherSessions={allWeatherSessions}
|
||||
gifMoodSessions={allGifMoodSessions}
|
||||
teamCollabSessions={[
|
||||
...teamSwotWithType,
|
||||
...teamMotivatorWithType,
|
||||
...teamYearReviewWithType,
|
||||
...teamWeeklyCheckInWithType,
|
||||
...teamWeatherWithType,
|
||||
...teamGifMoodWithType,
|
||||
]}
|
||||
/>
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user