@@ -52,7 +52,6 @@ export function UserProfileClient({ user, location, countryParam }: Props) {
5252 const { copied, copy } = useClipboardCopy ( ) ;
5353 const { copied : markdownCopied , copy : copyMarkdown } = useClipboardCopy ( ) ;
5454 const { copied : htmlCopied , copy : copyHtml } = useClipboardCopy ( ) ;
55- const { copied : badgeCopied } = useClipboardCopy ( ) ;
5655 const [ badgeDialogOpen , setBadgeDialogOpen ] = useState ( false ) ;
5756 const [ badgeStyle , setBadgeStyle ] = useState < "flat" | "flat-square" | "gradient" > ( "flat-square" ) ;
5857
@@ -71,8 +70,14 @@ export function UserProfileClient({ user, location, countryParam }: Props) {
7170 const badgeUrl =
7271 `https://img.shields.io/badge/${ esc ( "DevImpact Score" ) } -${ esc ( score . toFixed ( 1 ) ) } -${ color } ` +
7372 `?style=${ shieldStyle } &logo=github` ;
73+ const siteUrl = process . env . NEXT_PUBLIC_SITE_URL ;
74+ let origin = "" ;
75+ if ( siteUrl ) {
76+ origin = siteUrl . endsWith ( "/" ) ? siteUrl . slice ( 0 , - 1 ) : siteUrl ;
77+ } else if ( typeof window !== "undefined" ) {
78+ origin = window . location . origin ;
79+ }
7480
75- const origin = typeof window !== "undefined" ? window . location . origin : "" ;
7681 const profileUrl = `${ origin } /user/${ encodeURIComponent ( user . username ) } ` ;
7782
7883 return {
@@ -328,22 +333,11 @@ export function UserProfileClient({ user, location, countryParam }: Props) {
328333 variant = "secondary"
329334 size = "md"
330335 onClick = { ( ) => setBadgeDialogOpen ( true ) }
331- className = "col-span-2 flex w-full items-center justify-center gap-1.5 px-3 text-xs sm:col-span-1 sm:w-auto sm:px-4 sm:text-sm"
336+ className = "col-span-2 flex w-full items-center justify-center gap-1.5 whitespace-nowrap px-3 text-xs sm:col-span-1 sm:w-auto sm:px-4 sm:text-sm"
332337 aria-label = { t ( "profile.getBadge" ) }
333338 >
334- { badgeCopied ? (
335- < >
336- < Check className = "h-4 w-4 shrink-0 text-green-500" />
337-
338- < span className = "truncate text-green-500" > { t ( "profile.badgeCopied" ) } </ span >
339- </ >
340- ) : (
341- < >
342- < BadgeCheck className = "h-4 w-4 shrink-0" />
343-
344- < span className = "truncate" > { t ( "profile.getBadge" ) } </ span >
345- </ >
346- ) }
339+ < BadgeCheck className = "h-4 w-4 shrink-0" />
340+ < span className = "truncate" > { t ( "profile.getBadge" ) } </ span >
347341 </ Button >
348342 </ div >
349343 </ div >
0 commit comments