diff --git a/apps/web/src/components/game-end-view.tsx b/apps/web/src/components/game-end-view.tsx index f071f52..19c9f16 100644 --- a/apps/web/src/components/game-end-view.tsx +++ b/apps/web/src/components/game-end-view.tsx @@ -1,11 +1,18 @@ +import { useState } from "react" import { Link } from "wouter" import { motion } from "framer-motion" -import { Crown, ExternalLink, Music } from "lucide-react" -import type { PlayerScore, RoomSnapshot } from "@nerdware/shared" +import { Check, ClipboardList, Crown, ExternalLink, Music, Music2 } from "lucide-react" +import type { BlindtestTrackInfo, PlayerScore, RoomSnapshot } from "@nerdware/shared" import { Button } from "@workspace/ui/components/button" import { useRoomStore } from "@/store/room" import { Avatar } from "@/components/avatar" +/** Lien de recherche Spotify (le titre vidéo contient en général artiste + chanson). */ +function spotifySearch(track: BlindtestTrackInfo): string { + const query = `${track.title} ${track.artist}`.trim() + return `https://open.spotify.com/search/${encodeURIComponent(query)}` +} + type Place = 1 | 2 | 3 // Hauteur de marche, couleurs (or / argent / bronze) et taille d'avatar par place. @@ -198,43 +205,7 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { )} {gameTracks && gameTracks.length > 0 && ( -
-

- Les musiques de la partie -

- -
+ )}
@@ -256,3 +227,67 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) {
) } + +function TracksRecap({ tracks }: { tracks: BlindtestTrackInfo[] }) { + const [copied, setCopied] = useState(false) + + async function copyPlaylist() { + const text = tracks.map((t) => `${t.title} — ${t.artist}`).join("\n") + try { + await navigator.clipboard.writeText(text) + setCopied(true) + setTimeout(() => setCopied(false), 1500) + } catch { + // presse-papier indisponible : on ignore + } + } + + return ( +
+
+

+ Les musiques de la partie +

+ +
+ +
+ ) +}