@@ -142,6 +142,7 @@ const welcomeCloseBtn = document.getElementById("welcome-close");
142142const welcomeDismissBtn = document . getElementById ( "welcome-dismiss" ) ;
143143const welcomeCtaBtn = document . getElementById ( "welcome-cta" ) ;
144144const signupPanel = document . getElementById ( "welcome-signup" ) ;
145+ const signupName = document . getElementById ( "signup-name" ) ;
145146const signupEmail = document . getElementById ( "signup-email" ) ;
146147const signupProjects = document . getElementById ( "signup-projects" ) ;
147148const signupSH = document . getElementById ( "signup-siliconharbour" ) ;
@@ -183,7 +184,7 @@ welcomeOverlay.addEventListener("click", (e) => {
183184welcomeCtaBtn . addEventListener ( "click" , ( ) => {
184185 welcomeCtaBtn . style . display = "none" ;
185186 signupPanel . style . display = "block" ;
186- signupEmail . focus ( ) ;
187+ signupName . focus ( ) ;
187188} ) ;
188189
189190// Note toggle
@@ -195,6 +196,13 @@ signupNoteToggle.addEventListener("click", () => {
195196
196197// Submit signup
197198signupSubmitBtn . addEventListener ( "click" , async ( ) => {
199+ const name = signupName . value . trim ( ) ;
200+ if ( ! name ) {
201+ signupStatus . textContent = "Please enter your name." ;
202+ signupStatus . className = "error" ;
203+ return ;
204+ }
205+
198206 const email = signupEmail . value . trim ( ) ;
199207 if ( ! email || ! email . includes ( "@" ) ) {
200208 signupStatus . textContent = "Please enter a valid email address." ;
@@ -212,6 +220,7 @@ signupSubmitBtn.addEventListener("click", async () => {
212220 headers : { "Content-Type" : "application/json" } ,
213221 body : JSON . stringify ( {
214222 email,
223+ name,
215224 notify_plow : true ,
216225 notify_projects : signupProjects . checked ,
217226 notify_siliconharbour : signupSH . checked ,
@@ -228,6 +237,7 @@ signupSubmitBtn.addEventListener("click", async () => {
228237 signupStatus . textContent =
229238 "You're signed up! I don't have a newsletter system just yet, but when I do, you'll be the first to know!" ;
230239 signupStatus . className = "success" ;
240+ signupName . disabled = true ;
231241 signupEmail . disabled = true ;
232242 signupProjects . disabled = true ;
233243 signupSH . disabled = true ;
0 commit comments