@@ -68,7 +68,8 @@ const GameSummary = ({
6868 data,
6969 hidden,
7070 multiplayerState,
71- session
71+ session,
72+ gameId
7273} ) => {
7374 const { t : text } = useTranslation ( "common" ) ;
7475 const [ activeRound , setActiveRound ] = useState ( null ) ; // null = no round selected
@@ -78,6 +79,7 @@ const GameSummary = ({
7879 const [ selectedPlayer , setSelectedPlayer ] = useState ( null ) ;
7980 const [ headerCompact , setHeaderCompact ] = useState ( false ) ;
8081 const [ userHasInteracted , setUserHasInteracted ] = useState ( false ) ; // Track if user has manually moved the map
82+ const [ copiedGameId , setCopiedGameId ] = useState ( false ) ;
8183 const mapRef = useRef ( null ) ;
8284 const destIconRef = useRef ( null ) ;
8385 const srcIconRef = useRef ( null ) ;
@@ -413,6 +415,25 @@ const GameSummary = ({
413415 window . open ( url , '_blank' ) ;
414416 } ;
415417
418+ const copyGameId = ( ) => {
419+ if ( gameId ) {
420+ navigator . clipboard . writeText ( gameId ) . then ( ( ) => {
421+ setCopiedGameId ( true ) ;
422+ setTimeout ( ( ) => setCopiedGameId ( false ) , 2000 ) ;
423+ } ) . catch ( ( ) => {
424+ // Fallback for older browsers
425+ const textArea = document . createElement ( 'textarea' ) ;
426+ textArea . value = gameId ;
427+ document . body . appendChild ( textArea ) ;
428+ textArea . select ( ) ;
429+ document . execCommand ( 'copy' ) ;
430+ document . body . removeChild ( textArea ) ;
431+ setCopiedGameId ( true ) ;
432+ setTimeout ( ( ) => setCopiedGameId ( false ) , 2000 ) ;
433+ } ) ;
434+ }
435+ } ;
436+
416437 const getOptimalZoom = ( distance ) => {
417438 if ( distance < 1 ) return 15 ;
418439 if ( distance < 5 ) return 13 ;
@@ -854,6 +875,37 @@ const GameSummary = ({
854875 </ div >
855876 ) }
856877
878+ { gameId && (
879+ < div className = "game-id-container" style = { {
880+ margin : '12px 0' ,
881+ padding : '8px 12px' ,
882+ backgroundColor : 'rgba(255, 255, 255, 0.1)' ,
883+ borderRadius : '6px' ,
884+ display : 'flex' ,
885+ alignItems : 'center' ,
886+ justifyContent : 'space-between' ,
887+ fontSize : '0.9rem'
888+ } } >
889+ < span style = { { color : 'white' , marginRight : '8px' } } > ID: { gameId } </ span >
890+ < button
891+ onClick = { copyGameId }
892+ style = { {
893+ background : 'rgba(255, 255, 255, 0.1)' ,
894+ border : '1px solid rgba(255, 255, 255, 0.2)' ,
895+ color : 'white' ,
896+ padding : '4px 8px' ,
897+ borderRadius : '4px' ,
898+ cursor : 'pointer' ,
899+ fontSize : '0.8rem' ,
900+ transition : 'all 0.2s'
901+ } }
902+ title = "Copy Game ID"
903+ >
904+ { copiedGameId ? '✓' : '📋' }
905+ </ button >
906+ </ div >
907+ ) }
908+
857909 < div className = "summary-actions" >
858910 < button
859911 className = "action-btn mobile-expand-btn"
@@ -1278,6 +1330,37 @@ const GameSummary = ({
12781330 { text ( "outOf" ) } { maxPoints } { text ( "points" ) }
12791331 </ div >
12801332
1333+ { gameId && (
1334+ < div className = "game-id-container" style = { {
1335+ margin : '12px 0' ,
1336+ padding : '8px 12px' ,
1337+ backgroundColor : 'rgba(255, 255, 255, 0.1)' ,
1338+ borderRadius : '6px' ,
1339+ display : 'flex' ,
1340+ alignItems : 'center' ,
1341+ justifyContent : 'space-between' ,
1342+ fontSize : '0.9rem'
1343+ } } >
1344+ < span style = { { color : 'white' , marginRight : '8px' } } > ID: { gameId } </ span >
1345+ < button
1346+ onClick = { copyGameId }
1347+ style = { {
1348+ background : 'rgba(255, 255, 255, 0.1)' ,
1349+ border : '1px solid rgba(255, 255, 255, 0.2)' ,
1350+ color : 'white' ,
1351+ padding : '4px 8px' ,
1352+ borderRadius : '4px' ,
1353+ cursor : 'pointer' ,
1354+ fontSize : '0.8rem' ,
1355+ transition : 'all 0.2s'
1356+ } }
1357+ title = "Copy Game ID"
1358+ >
1359+ { copiedGameId ? '✓' : '📋' }
1360+ </ button >
1361+ </ div >
1362+ ) }
1363+
12811364 < div className = "summary-actions" >
12821365 < button
12831366 className = "action-btn mobile-expand-btn"
0 commit comments