Measures of Safety
Tomorrow, I will join the masses in the Great Remote Work Experiment that's happening across the globe right now. It was not mandated by my company to work from home because we were deemed an essential service, but my job can just as easily be done from home, if not easier. I won't have the distractions of working in an office with noisy neighbors or people carrying on conversations and I can focus solely on my work. Yes, my fiancé and daughter will be home, but she understands I won't be distracted while I work, and the bedroom is my office during the day, until 4:30. I expect my productivity to actually go up during this time, as long as communication lines are strong and I can get the information I need in a timely manner. But, nothing changes there; I deal with the same thing when working in the office, as well. The really good thing about this, is that most remote jobs require you to have some kind of experience working remotely in the past, and now I can say that I have. Starting out, I have plenty of work to get me going, but in a week's time, I will need to be handed more projects to work on, and I'm hoping it's not a hassle to get what I need. My neighbor, who works on the same kind of stuff I do, is also working from home, so I hope we can collaborate well.
Right now, I have 2 different projects I'm working on, one more pressing than the other. As of now, I'm really down to just the finishing touches on the more important project, and am pretty much waiting on the backend to be built out so we can hook it up correctly. I discussed it yesterday, but I built out a frontend for a form application that signs people up for virtual appointments with representatives. I had a lot of it done yesterday, but some of the stuff I didn't have done took more time than I thought today to finish up. I was stuck on a validation issue for most of the day. On the second page of the form, after their zip code is validated, they are asked to enter their first name, last name, email, and phone number. What I wanted was for an error to be thrown whenever they exit one of the inputs if the information is not valid. For the names, I only check to see if the inputs are blank. If so, it just presents a small error message below the input. For the phone number, it was a little trickier. I have a mask on the phone number so it shows up like "(___) ___-____" instead of just one long number, but if they leave that blank, it still shows up with a length longer than 0, making it difficult to validate. I also can't check to make sure it's a certain length because if, say, they put in "(545)344-3___," it still shows up as a full length number. My neighbor had a little validation to deal with this that he had used in the past, so we used that, but I was still having trouble with it.
If all I was doing is throwing the small error below the input, it would have been no problem, but I also wanted to disable the button to advance them to the next step until all inputs were valid. I tried so many different ways to make this happen, using different useStates along with a useEffect to handle the disabling of the button, but nothing seemed to be working. Literally, I spent about 2 or 3 hours tearing my hair out with this one, when finally I realized what I was doing wrong. I tell you, while this was definitely counterproductive in a certain way, hitting these blocks are the best learning tools. I learned more from this mistake than I would have if I had gotten lucky the first time and figured it out. It was a great feeling to get that to work. The other mess I had on my hands was parsing the date-time object to something that was more human-readable. I ended up with multiple 15 or so part ternary operations that did the trick, but I can imagine there's a better way of doing this somewhere along the line. From there, I built out a couple more of the simple parts of the application, like throwing a success page when their appointment was booked, or an error page is something went wrong with the post fetch. I have one more error page left, and then the functionality is complete. All the while, my neighbor is working on another branch of the same project to get the styling looking awesome. He's pretty talented with CSS, as he is with a lot of things, so from what I saw it looked pretty awesome. I think after I finish this TypeScript course, I'm going to move on to a CSS course to really up my skills in that area.
Until tomorrow!