Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui component of courtbot #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*
21 changes: 21 additions & 0 deletions ui/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Brandon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CourtBotUI

The UI for CourtBot, a tool that makes it easier to get reminded of court dates

# Instructions on how to build on your local machine:

If you don't have Node installed, [download Node here](https://nodejs.org/en)

This project uses Node Version >= 18.16.0

After installation, run `npm install` to install dependencies

Once installation has finished, run `npm start` to start the project

# Changing/Adding behavior

I have set up the frontend in a way that will proxy requests to a server on localhost:5000, so test servers should be running on that

If you'd like to change that port, go into package.json and change that "proxy" attribute to whatever you want

The config.js file has several variables and endpoints that can be changed to test the app, as well as change its behavior

For instance, the actual endpoint urls and names can be changed, as well as using mock data to test if the app works as expected
20 changes: 20 additions & 0 deletions ui/functions/fetch.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from "axios";

export const handler = async (event, context) => {

// Cursed, but MVP lol
// Slicing to get the actual url wanted
// Ignoring the path
let fetchedUrl = event.rawUrl.slice(event.rawUrl.indexOf("http", 9))

const data = await axios.get(fetchedUrl).then(response => response.data)

console.log("fetched url: " + fetchedUrl)
console.log(data)

return {
statusCode: 200,
data: JSON.stringify(data),
body: JSON.stringify(data)
}
};
6 changes: 6 additions & 0 deletions ui/netifly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build]
functions = "functions"
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/fetch/:splat"
status = 200
Loading