Devlog 3: React.js!
What’s Old?
I never got to go in-depth on what this is, so now would be a good time as ever to do that. This project was originally a school assignment which mandated that the legacy python CGI library was used to retrieve the data of forms instead of using something like JS to read the value of the inputs.
Here are the features of the original site:
-
Loginpage which would create a cookie that had user information including the user name, type, and more data pertaining to that particular user -
Loginpage would take you to theHomepage on login, which would look different based on which of thecontextsyou were logged in as (this is basically checking if you are a schoolAdmin,Teacher, orStudent) and would update theNavbarto include buttons linking tocontext-specific pages as well as theDashboardbased on thiscontext-
Adminview had aHomepage which would display overall school statistics -
Adminspecific pages included pages to add or delete a course, or add, delete, or assign/remove a user from a course -
Teacherview had aHomepage which would display courses taught and the amount of students in each course -
Teacherspecific pages were pages to modify the grades of students, and each course would have its own page for editing the grades -
Studenthad no specific pages and would see their grades displayed in a table on theDashboardon theHomepage
-
-
Navbarhad a Logout button which deleted the aforementioned cookies by setting their “expires” value to 0 -
SuccessIndicatorIndicated whether a form action succeeded or not by reading a GET request - Similar pages were in one
.htmlfile and were modified based off a GET request parameter to display appropriate content
What’s New?
It is important to note that this is a complete rewrite of the project!
The code similarity between the current state of the site and the original state (which you can view by going to the Legacy release linked here!) is minimal.
- I completely remade the project by making a new directory and then rebasing the newly created project onto the previous repository stack. This added my files to the GitHub repo without me having to make a new one, which was convenient. I learned how to rebase using git to do this, expanding my knowledge of git.
- The project has been rewritten to mostly use
.jsxfiles instead of the mess that was using.html,.css,.js, and.pyfiles for a single page of the website. Now, every single component (whether that be a page, a styled form, or even just a header) has its own file, which makes everything WAY MORE organized! - Every single form on the website is now a
<FormStyled/>which is a component that I made. To make this work I simply add a JS object which has a key-value pair notation of Input Name - OnChange handler, which makes making forms way faster. Development has overall been way more pleasing as compared to not havingreact.jsdue to the amount of new things in react! - Every single interaction with things outside the DOM is now in a convenient
services/folder, which includes files such asmanageCookies.jsandhttpRequests.jswhich allow me to import certain functions anywhere in the code. This is an improvement over me simply copy and pasting the same code over and over again in two different files. - Speaking of organization, all files are now organized in the
src/folder by type of component/use. For example, my components which I add to the website at will are in thecomponents/folder while the overall page layout components are in thepages/folder
View my commit history for commit-by-commit commentary on the code that I modified!
SupaBase incoming!