@@ -639,11 +639,51 @@ async function enforceDonationLockout() {
639639 <h1 style="font-size:2.5em;margin-bottom:0.5em;">CCPorted Is Down</h1>
640640 <p style="font-size:1.2em;">CCPorted has been shut down. Check back next school year!!<br>
641641 In the meantime, <a href ="https://discord.gg/GDEFRBTT3Z">join our discord</a> to hang out.</p>
642+ <p>CCPorted is coming back soon!</p>
643+ <p>Please add your email to the waitlist to be the first to know when we are back online!</p>
644+ <p><input type="email" placeholder="Enter your email" id="waitlist-email" style="padding:10px;width:300px;margin-top:10px;"></p>
645+ <button id="waitlist-submit" style="padding:10px 20px;margin-top:10px;">Join Waitlist</button>
646+ <p id="waitlist-message" style="margin-top:10px;"></p>
647+
642648 </div>
643649 </div>
644650 ` ;
645651 // Disable all interaction
646652 // document.body.style.pointerEvents = "none";
653+ async function handler ( ) {
654+ const emailInput = document . getElementById ( "waitlist-email" ) ;
655+ const email = emailInput . value . trim ( ) ;
656+ if ( ! email ) {
657+ document . getElementById ( "waitlist-message" ) . textContent = "Please enter a valid email address." ;
658+ return ;
659+ }
660+
661+ document . getElementById ( "waitlist-message" ) . textContent = "Thank you for joining the waitlist!" ;
662+ const url = "https://dahljrdecyiwfjgklnvz.supabase.co/rest/v1/email_waitlist" ;
663+ const response = await fetch ( url , {
664+ method : "POST" ,
665+ headers : {
666+ "Content-Type" : "application/json" ,
667+ "apikey" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRhaGxqcmRlY3lpd2ZqZ2tsbnZ6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjgyNjE3NzMsImV4cCI6MjA0MzgzNzc3M30.8-YlXqSXsYoPTaDlHMpTdqLxfvm89-8zk2HG2MCABRI" ,
668+ "Authorization" : "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRhaGxqcmRlY3lpd2ZqZ2tsbnZ6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjgyNjE3NzMsImV4cCI6MjA0MzgzNzc3M30.8-YlXqSXsYoPTaDlHMpTdqLxfvm89-8zk2HG2MCABRI"
669+ } ,
670+ body : JSON . stringify ( { email : email } )
671+ } ) ;
672+ if ( ! response . ok ) {
673+ document . getElementById ( "waitlist-message" ) . textContent = "Failed to join waitlist. Please try again later." ;
674+ return ;
675+ }
676+ document . getElementById ( "waitlist-email" ) . disabled = true ;
677+ document . getElementById ( "waitlist-submit" ) . disabled = true ;
678+ document . getElementById ( "waitlist-message" ) . textContent = "Thank you for joining the waitlist! We'll notify you when we're back online." ;
679+ }
680+ document . getElementById ( "waitlist-submit" ) . addEventListener ( "click" , handler ) ;
681+ document . getElementById ( "waitlist-email" ) . addEventListener ( "keypress" , ( e ) => {
682+ if ( e . key === "Enter" ) {
683+ e . preventDefault ( ) ;
684+ handler ( ) ;
685+ }
686+ } ) ;
647687 document . body . style . userSelect = "none" ;
648688 window . locked = true ;
649689 return ;
0 commit comments