@@ -219,15 +219,15 @@ function showInfoModal(title, steps) {
219219 e . preventDefault ( ) ;
220220 e . stopPropagation ( ) ;
221221 closeModal ( ) ;
222- } ) ;
222+ } ;
223223 }
224224
225225 if ( gotItBtn ) {
226226 gotItBtn . onclick = function ( e ) {
227227 e . preventDefault ( ) ;
228228 e . stopPropagation ( ) ;
229229 closeModal ( ) ;
230- } ) ;
230+ } ;
231231 }
232232
233233 overlay . onclick = function ( e ) {
@@ -1632,106 +1632,119 @@ function openProjectSafe(name, trigger) {
16321632 }
16331633
16341634 // Load the project
1635- setTimeout ( function ( ) {
1635+ setTimeout ( function ( ) {
1636+ try {
1637+ var htmlContent = null ;
1638+
1639+ if ( typeof getProjectHTML === 'function' ) {
16361640 try {
1637- var htmlContent = null ;
1638-
1639- // Try getProjectHTML from project.js
1640- if ( typeof getProjectHTML === 'function' ) {
1641- try {
1642- htmlContent = getProjectHTML ( name ) ;
1643- console . log ( '📄 getProjectHTML returned:' , htmlContent ? 'content' : 'null' ) ;
1644- } catch ( e ) {
1645- console . warn ( 'getProjectHTML error:' , e . message ) ;
1646- }
1647- }
1648-
1649- // If that failed, try direct function
1650- if ( ! htmlContent || htmlContent . trim ( ) . length < 50 || htmlContent . includes ( 'error-state' ) ) {
1651- var fnName = 'get' + name . split ( '-' ) . map ( function ( w ) {
1652- return w . charAt ( 0 ) . toUpperCase ( ) + w . slice ( 1 ) ;
1653- } ) . join ( '' ) + 'HTML' ;
1641+ htmlContent = getProjectHTML ( name ) ;
1642+ console . log ( '📄 Got HTML for:' , name ) ;
1643+ } catch ( e ) {
1644+ console . warn ( 'getProjectHTML error:' , e . message ) ;
1645+ }
1646+ }
1647+
1648+ if ( htmlContent && htmlContent . trim ( ) . length > 50 && ! htmlContent . includes ( 'error-state' ) ) {
1649+
1650+ // 👇 SET THE HTML
1651+ modalBody . innerHTML = htmlContent ;
1652+
1653+ // 👇 ADD INFO BUTTON
1654+ console . log ( '🔧 Adding info button for:' , name ) ;
1655+
1656+ setTimeout ( function ( ) {
1657+ try {
1658+ const h2 = modalBody . querySelector ( 'h2' ) ;
16541659
1655- if ( typeof window [ fnName ] === 'function' ) {
1656- try {
1657- htmlContent = window [ fnName ] ( ) ;
1658- console . log ( '📄 Direct function loaded:' , fnName ) ;
1659- } catch ( e ) {
1660- console . warn ( fnName + ' error:' , e . message ) ;
1660+ if ( h2 ) {
1661+ console . log ( '✅ Found h2:' , h2 . textContent ) ;
1662+
1663+ if ( ! h2 . querySelector ( '.info-btn-simple' ) ) {
1664+ const btn = document . createElement ( 'button' ) ;
1665+ btn . className = 'info-btn-simple' ;
1666+ btn . innerHTML = ' ℹ️' ;
1667+ btn . style . cssText = `
1668+ background: transparent;
1669+ border: none;
1670+ color: #a78bfa;
1671+ font-size: 1.2rem;
1672+ cursor: pointer;
1673+ padding: 0 5px;
1674+ margin-left: 8px;
1675+ ` ;
1676+
1677+ btn . onclick = function ( e ) {
1678+ e . stopPropagation ( ) ;
1679+ e . preventDefault ( ) ;
1680+
1681+ let instructions = null ;
1682+ if ( typeof projectInstructions !== 'undefined' && projectInstructions ) {
1683+ instructions = projectInstructions [ name ] ;
1684+ }
1685+
1686+ if ( instructions && instructions . title && instructions . steps ) {
1687+ let msg = instructions . title + '\n\n' ;
1688+ instructions . steps . forEach ( function ( step , i ) {
1689+ msg += ( i + 1 ) + '. ' + step + '\n' ;
1690+ } ) ;
1691+ alert ( msg ) ;
1692+ } else {
1693+ alert ( 'No instructions available for: ' + name ) ;
1694+ }
1695+ } ;
1696+
1697+ h2 . appendChild ( btn ) ;
1698+ console . log ( '✅ Info button added!' ) ;
16611699 }
1700+ } else {
1701+ console . warn ( '⚠️ No h2 found' ) ;
16621702 }
1703+ } catch ( error ) {
1704+ console . error ( '❌ Error:' , error ) ;
16631705 }
1664-
1665- // If we have content, show it
1666- if ( htmlContent && typeof htmlContent === 'string' && htmlContent . trim ( ) . length > 50 && ! htmlContent . includes ( 'error-state' ) ) {
1667- modalBody . innerHTML = htmlContent ;
1668- console . log ( '✅ Loaded:' , name ) ;
1669-
1670- // Initialize the project
1671- setTimeout ( function ( ) {
1672- try {
1673- // Try initializeProject from project.js
1674- if ( typeof initializeProject === 'function' ) {
1675- initializeProject ( name ) ;
1676- console . log ( '✅ Initialized via project.js' ) ;
1677- }
1678-
1679- // Also try direct init function
1680- var initFn = 'init' + name . split ( '-' ) . map ( function ( w ) {
1681- return w . charAt ( 0 ) . toUpperCase ( ) + w . slice ( 1 ) ;
1682- } ) . join ( '' ) ;
1683- if ( typeof window [ initFn ] === 'function' ) {
1684- window [ initFn ] ( ) ;
1685- console . log ( '✅ Initialized via direct function:' , initFn ) ;
1686- }
1687- } catch ( e ) {
1688- console . warn ( 'Init error:' , e . message ) ;
1689- }
1690- } , 100 ) ;
1691-
1692- // Setup focus trap
1693- if ( removeTrap ) removeTrap ( ) ;
1694- removeTrap = trapFocus ( modal ) ;
1695-
1696- setTimeout ( function ( ) {
1697- if ( modalClose && modalClose . focus ) {
1698- modalClose . focus ( { preventScroll : true } ) ;
1699- }
1700- } , 100 ) ;
1701-
1702- return ;
1706+ } , 500 ) ;
1707+
1708+ // Initialize the project
1709+ setTimeout ( function ( ) {
1710+ try {
1711+ if ( typeof initializeProject === 'function' ) {
1712+ initializeProject ( name ) ;
1713+ }
1714+ } catch ( e ) {
1715+ console . warn ( 'Init error:' , e . message ) ;
17031716 }
1704-
1705- // If nothing worked, show coming soon
1706- modalBody . innerHTML = `
1707- <div style="text-align:center;padding:60px 20px;">
1708- <div style="font-size:4rem;margin-bottom:1rem;">🚀</div>
1709- <h2 style="color:#e2e8f0;margin-bottom:0.5rem;"> ${ name . replace ( / - / g , ' ' ) . toUpperCase ( ) } </h2 >
1710- <p style="color:#94a3b8 ;margin-bottom:1.5rem ;">This project is coming soon!</p >
1711- <button onclick="closeProjectSafe()"
1712- style="background:#a78bfa;color:white;border:none;padding:12px 32px;border-radius:50px;cursor:pointer;font-size:1rem;" >
1713- Close
1714- </button >
1715- </div>
1716- ` ;
1717- console . warn ( '⚠️ Project not available:' , name ) ;
1718-
1719- } catch ( error ) {
1720- console . error ( 'Error loading project:' , error ) ;
1721- modalBody . innerHTML = `
1722- <div style="text-align:center;padding:60px 20px;">
1723- <div style="font-size:3rem;margin-bottom: 20px;">⚠️</div >
1724- <h3 style="color:#e2e8f0;">Error Loading Project</h3 >
1725- <p style="color:#94a3b8 ;">${ error . message || 'Unknown error' } </p >
1726- <button onclick="closeProjectSafe()"
1727- style="margin-top:20px;background:#a78bfa;color:white;border: none;padding:12px 32px;border-radius:50px;cursor:pointer;">
1728- Close
1729- </button>
1730- </div >
1731- ` ;
1732- }
1733- } , 300 ) ;
1734-
1717+ } , 600 ) ;
1718+
1719+ } else {
1720+ // Show coming soon
1721+ modalBody . innerHTML = `
1722+ <div style="text-align:center;padding:60px 20px;" >
1723+ <div style="font-size:4rem ;margin-bottom:1rem ;">🚀</div >
1724+ <h2 style="color:#e2e8f0;margin-bottom:0.5rem;"> ${ name . replace ( / - / g , ' ' ) . toUpperCase ( ) } </h2>
1725+ <p style="color:#94a3b8;margin-bottom:1.5rem;">Coming soon!</p >
1726+ <button onclick="document.getElementById('projectModal').style.display='none';document.body.style.overflow='';"
1727+ style="background:#a78bfa;color:white;border:none;padding:12px 32px;border-radius:50px;cursor:pointer;font-size:1rem;" >
1728+ Close
1729+ </button>
1730+ </div>
1731+ ` ;
1732+ }
1733+ } catch ( error ) {
1734+ console . error ( 'Error loading project:' , error ) ;
1735+ modalBody . innerHTML = `
1736+ <div style="text-align:center;padding:60px 20px;">
1737+ <div style="font-size:3rem;margin-bottom:20px;">⚠️</div >
1738+ <h3 style="color:#e2e8f0 ;">Error Loading Project</h3 >
1739+ <p style="color:#94a3b8;"> ${ error . message || 'Unknown error' } </p>
1740+ <button onclick="document.getElementById('projectModal').style.display=' none';document.body.style.overflow='';"
1741+ style="margin-top:20px;background:#a78bfa;color:white;border:none;padding:12px 32px;border-radius:50px;cursor:pointer;">
1742+ Close
1743+ </button >
1744+ </div>
1745+ ` ;
1746+ }
1747+ } , 300 ) ;
17351748 // Setup focus trap
17361749 if ( removeTrap ) removeTrap ( ) ;
17371750 removeTrap = trapFocus ( modal ) ;
0 commit comments