@@ -92,6 +92,7 @@ export default function CertificateCard({ cert, onReset }: Props) {
9292 const [ exportError , setExportError ] = useState < string | null > ( null )
9393 const [ showInlineShare , setShowInlineShare ] = useState ( false )
9494 const [ copied , setCopied ] = useState ( false )
95+ const [ badgeCopied , setBadgeCopied ] = useState ( false )
9596
9697 function getPixelRatio ( highQuality = false ) : number {
9798 if ( typeof navigator === 'undefined' ) return 2
@@ -612,6 +613,37 @@ export default function CertificateCard({ cert, onReset }: Props) {
612613 </ div >
613614 ) }
614615
616+ { /* Badge copy */ }
617+ { ! showInlineShare && ( ( ) => {
618+ const repoUrl = `https://commitmentissues.dev/?repo=${ encodeURIComponent ( cert . repoData . fullName ) } `
619+ const shieldsUrl = `https://img.shields.io/badge/%F0%9F%AA%A6%20declared%20dead-view%20certificate-555?style=for-the-badge&labelColor=cc0000`
620+ const badgeMd = `[](${ repoUrl } )`
621+ return (
622+ < div style = { { display : 'flex' , alignItems : 'center' , justifyContent : 'space-between' , gap : '10px' } } >
623+ { /* eslint-disable-next-line @next/next/no-img-element */ }
624+ < img src = { shieldsUrl } alt = "commitmentissues badge" style = { { height : '20px' , display : 'block' , flexShrink : 0 } } />
625+ < button
626+ type = "button"
627+ onClick = { async ( ) => { try { await navigator . clipboard . writeText ( badgeMd ) ; setBadgeCopied ( true ) ; setTimeout ( ( ) => setBadgeCopied ( false ) , 2000 ) } catch { /* ignore */ } } }
628+ style = { {
629+ fontFamily : UI , fontSize : '11px' , fontWeight : 700 ,
630+ flexShrink : 0 ,
631+ height : '28px' ,
632+ padding : '0 10px' ,
633+ background : badgeCopied ? '#2a5a2a' : '#0a0a0a' ,
634+ color : '#fff' ,
635+ border : 'none' ,
636+ cursor : 'pointer' ,
637+ letterSpacing : '0.04em' ,
638+ transition : 'background 0.15s' ,
639+ } }
640+ >
641+ { badgeCopied ? '✓ Copied' : 'Copy badge' }
642+ </ button >
643+ </ div >
644+ )
645+ } ) ( ) }
646+
615647 { /* Export error */ }
616648 { exportError && (
617649 < p style = { { fontFamily : UI , fontSize : '12px' , color : '#8B1A1A' , textAlign : 'center' , margin : '0' } } >
0 commit comments