makeopensource / devU-client

Auto-grading 4.0 Client
0 stars 2 forks source link

DevU Client

This project is the client for the DevU autograder. It's intent is to act as a way to manage courses, assignments, and students, for professors/ tas; and submit, edit, and run assignments for students.

Application Technologies

Running the Application

Firstly install this projects dependancies by installing node. Once node is installed we can continue with running the application.

Firstly we'll have to install the project dependancies

npm install

Because this project lives almost entirely behind auth, this project requires its API to be running in order to operate correctly. Under normal circumstances you'd be able to hit the development or production APIs without having to run your own local API. But because those don't yet exist for now if you want to run this project you'll have to run a local version of the api to use this client.

Once there project dependancies are installed and an api is running, we can run the project with a few different commands

npm run local # points to local api
npm start # points to development api (not yet availible)
npm run prod # points to production api (not yet availible)

Convienent Devtools

If you're not familar with chrome's devtools, you should familiarize yourself with them as they are going to be your best friend when developing for this project.

Those tools can be used to debug your code, check network requests, edit css/html, checking local storage and cookies, and much more.

Beyond the base chrome devtools, as a react developer you should probably also install the react devtools which can be used to check component state, as well as update component state, amongst other things.

Since we're also using redux in this project, I'd also reccomend installing the redux devtools as well. This tool is great for updating state, as well as checking state for redux.

Working in the project

This project is primarilly built using

But also uses libraries fairly heavilly. Some of those libraries include

There are many others that are used but those are the major players in making the app run the way that it does.

The Application

When starting up the server, the index.tsx is the first component initialized. All other components in the chain stem from that component, so I'd reccomend checking it out to see what's going on in there.

Some notes on some services

For ease and consistency of development a few services have been added that can be included and used as needed. Some of these are

Css and Themes

This application uses scss for all of it's styles. The scss is largely only used as it's called as we avoid the cascading parts of css at all costs. The only exception to this is the css that's been declared in global.scss that's imported and run from index.tsx.

global.scss is special because that should be the only place in the application that has cascading css. It is used to setup the theme color variables as well, though notably not all of the variables, not even most really.

variables.scss is where the majority of the css variables are declared. We couldn't declare them all here because we need dynamic variables for themes to work as expected. Scss is by it's nature unable to be dynamic, so any theme based variables must be controller by vanilla css variables. Because we're using vanilla css variables for theme variables, those need to be set globally. Therefor that's why theme variables are set and them brought into variables.scss. Beyond that, variables is a bit special because it's the only scss file in the project that can be imported without any kind of pathing. This is because it's built into the build to be allowed to included without a path. It's a piece of syntactic sugar that the developer will need to be aware of when importing variables and other scss variables.

The theme of the application is bootstrapped by the darkModeToggle component. The catch of this is that unless that component is being renender, because this component exists on the globaltoolbar it shouldn't cause issues, but it is something to keep in mind.

The theme's state is stored in the browsers local storage so that the chosen theme will persist across users sessions.

Environement Stuff

The environment of the application is controlled entirely (mostly) by it's .env.* files. These files live within the repository as public environment strings that are needed for production and development builds. All of their configuation options should be public as they're going into the build that will be pulled into the browser when a user loads the site. The reason we keep these options in the repository is so it's easy to connect to the development and production apis locally when developing (not availible yet).

These env files just offer a way to provide env vars without having to set them yourself, but they're not actually pulled into the application unless they're added to config.ts. There you can see how some env vars have been added, and subsequently then can be imported into the rest of the application for use.

All env variables can be overwritten by actually setting the matching variable on your local system.

Building the Application

The application can be built in multiple different ways for multilpe different environments, here are the commands

npm run build # builds with .env.production
npm run build-local # builds with .env.local
npm run build-development # builds with .env.development
npm run build-all # builds all

All of these build to ./dist then their environemnt as a sub directory (ex ./dist/local). From there the bundled html, css, and js can be hosted by any normal webserver.