@@ -9,6 +9,7 @@ import { getLeague, leagues } from "./utils/leagues";
99import { signOut } from "@/components/auth/auth" ;
1010import { useTranslation } from '@/components/useTranslations' ;
1111import FriendsModal from "@/components/friendModal" ;
12+ import { FaLink , FaCheck } from "react-icons/fa" ;
1213
1314export default function AccountModal ( { session, shown, setAccountModalOpen, eloData, inCrazyGames, friendModal, accountModalPage, setAccountModalPage, ws, sendInvite, canSendInvite, options } ) {
1415 const { t : text } = useTranslation ( "common" ) ;
@@ -19,6 +20,7 @@ export default function AccountModal({ session, shown, setAccountModalOpen, eloD
1920 const [ selectedGame , setSelectedGame ] = useState ( null ) ;
2021 const [ showingGameAnalysis , setShowingGameAnalysis ] = useState ( false ) ;
2122 const [ isTouchDevice , setIsTouchDevice ] = useState ( false ) ;
23+ const [ copiedLink , setCopiedLink ] = useState ( false ) ;
2224 const badgeStyle = {
2325 marginLeft : '15px' ,
2426 color : 'black' ,
@@ -215,7 +217,47 @@ export default function AccountModal({ session, shown, setAccountModalOpen, eloD
215217 padding : isTouchDevice ? '10px 20px' : undefined ,
216218 minHeight : isTouchDevice ? '50px' : undefined
217219 } } >
218- < h1 className = "account-modal-title" > { accountData ?. username || text ( "account" ) } { accountData ?. supporter && < span style = { badgeStyle } > { text ( "supporter" ) } </ span > } </ h1 >
220+ < h1 className = "account-modal-title" >
221+ { accountData ?. username || text ( "account" ) }
222+ { accountData ?. username && (
223+ < button
224+ onClick = { ( ) => {
225+ const profileUrl = `${ window . location . origin } /user?u=${ encodeURIComponent ( accountData . username ) } ` ;
226+ navigator . clipboard . writeText ( profileUrl ) . then ( ( ) => {
227+ setCopiedLink ( true ) ;
228+ setTimeout ( ( ) => setCopiedLink ( false ) , 2000 ) ;
229+ } ) ;
230+ } }
231+ title = { text ( "copyProfileLink" ) || "Copy profile link" }
232+ style = { {
233+ marginLeft : '10px' ,
234+ background : 'rgba(255,255,255,0.1)' ,
235+ border : 'none' ,
236+ borderRadius : '6px' ,
237+ padding : '6px 10px' ,
238+ cursor : 'pointer' ,
239+ color : copiedLink ? '#4ade80' : 'rgba(255,255,255,0.7)' ,
240+ fontSize : '0.8rem' ,
241+ transition : 'all 0.2s ease' ,
242+ display : 'inline-flex' ,
243+ alignItems : 'center' ,
244+ gap : '5px' ,
245+ verticalAlign : 'middle'
246+ } }
247+ onMouseEnter = { ( e ) => {
248+ if ( ! copiedLink ) e . target . style . color = '#fff' ;
249+ e . target . style . background = 'rgba(255,255,255,0.2)' ;
250+ } }
251+ onMouseLeave = { ( e ) => {
252+ if ( ! copiedLink ) e . target . style . color = 'rgba(255,255,255,0.7)' ;
253+ e . target . style . background = 'rgba(255,255,255,0.1)' ;
254+ } }
255+ >
256+ { copiedLink ? < FaCheck /> : < FaLink /> }
257+ </ button >
258+ ) }
259+ { accountData ?. supporter && < span style = { badgeStyle } > { text ( "supporter" ) } </ span > }
260+ </ h1 >
219261
220262
221263 < button
0 commit comments