diff --git a/.env b/.env new file mode 100644 index 000000000..f6908ca1f --- /dev/null +++ b/.env @@ -0,0 +1 @@ + # Scrubbed by Glitch 2022-10-04T02:06:26+0000 diff --git a/README.md b/README.md index 027584c5e..c5ef7bf4b 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,8 @@ -Assignment 4 - Components -=== - -Due: October 4th, by 11:59 AM. - -For this assignment you will re-implement the client side portion of *either* A2 or A3 using either React or Svelte components. If you choose A3 you only need to use components for the data display / updating; you can leave your login UI as is. - -[Svelte Tutorial](https://github.com/cs4241-21a/cs4241-21a.github.io/blob/main/using_svelte.md) -[React Tutorial](https://github.com/cs4241-21a/cs4241-21a.github.io/blob/main/using_react.md) - -This project can be implemented on any hosting service (Glitch, DigitalOcean, Heroku etc.), however, you must include all files in your GitHub repo so that the course staff can view them. - -Deliverables +README --- -Do the following to complete this assignment: - -1. Implement your project with the above requirements. -3. Test your project to make sure that when someone goes to your main page on Glitch/Heroku/etc., it displays correctly. -4. Ensure that your project has the proper naming scheme `a4-firstname-lastname` so we can find it. -5. Fork this repository and modify the README to the specifications below. Be sure to add *all* project files. -6. Create and submit a Pull Request to the original repo. Name the pull request using the following template: `a4-firstname-lastname`. - -Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions) ---- - -## Your Web Application Title - -your hosting link e.g. http://a4-charlieroberts.glitch.me +## Name-a-Rat -Include a very brief summary of your project here and what you changed / added to assignment #3. Briefly (3–4 sentences) answer the following question: did the new technology improve or hinder the development experience? +http://a4-charles-snow.glitch.me -Unlike previous assignments, this assignment will be solely graded on whether or not you successfully complete it. Partial credit will be generously given. +I based this project off of a2. It's almost entirely the same, however I changed it to only use a rat name, as I thought that it improved the application. I think react is a useful tool, however on an app with this small of a scale I felt that setting up react takes significantly more work than not using it, and it hindered the development experience. \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 000000000..57ace1b00 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "a4-csnow99", + "version": "1.0.0", + "description": "", + "main": "index.js", + "keywords": [], + "author": "", + "license": "ISC", + "scripts": { + "clean": "rm dist/bundle.js", + "start": "node server.js", + "build": "snowpack build" + }, + "dependencies": { + "express": "^4.18.1", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "snowpack": "^3.8.8" + } +} diff --git a/server.js b/server.js new file mode 100644 index 000000000..50d22daf9 --- /dev/null +++ b/server.js @@ -0,0 +1,25 @@ +const express = require( 'express' ), + app = express() + +const names = [] + +app.use( express.json() ) + +// this will most likely be 'build' or 'public' +app.use( express.static( 'build' ) ) + +app.get( '/read', ( req, res ) => res.json( names ) ) + +app.post( '/add', ( req,res ) => { + names.push( req.body ) + res.json( names ) +}) + +app.post( '/change', function( req,res ) { + const idx = names.findIndex( v => v.name === req.body.name ) + names[ idx ].completed = req.body.completed + + res.sendStatus( 200 ) +}) + +app.listen( 8080 ) \ No newline at end of file diff --git a/snowpack.config.json b/snowpack.config.json new file mode 100644 index 000000000..54e82771d --- /dev/null +++ b/snowpack.config.json @@ -0,0 +1,6 @@ +{ + "mount": { + "dist": "/", + "src": "/" + } +} \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 000000000..bd4ab08e7 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,88 @@ +import React from "react"; + + + +class Name extends React.Component { + // our .render() method creates a block of HTML using the .jsx format + + render() { + const name = this.props.name + if(document.getElementById("ratname").value != ""){ + const rats = document.getElementById("youname"); + const adjes = ["funky", "furry", "spunky", "based", "wiggly", "rabid", "feral", "amphibious", "moist", "scrungy", "filthy", "bronchiatic", "clueless", "ditsy", "arthritic", "useless", "cute", "decorative", "assiduous", "gothic", "postmodern", "fully automatic", "scared", "skittish", "large", "tiny", "strategic", "colorblind", "gaslighting", "gatekeeping", "cringe", "sus", "rancid", "bedazzled", "confused", "sticky", "litigious", "stinky", "nutty"] + let adje = adjes[Math.floor(Math.random()*adjes.length)]; + const nouns = ["fella", "friend", "pisser", "chef", "Charlie", "girlboss", "Bagungus", "ambassador", "microwave", "nurse", "spy", "loaf", "entertainer", "swifty", "garfhead", "furry", "guy", "professor", "hatrat", "mayor", "problem", "barrister", "mobster", "monster", "child", "Delta SkyPriority Gold Member", "Delta SkyPriority Silver Member", "credit card fraudster", "sinner", "snitch", "plumber", "rhat", "rat", "landlord", "vegetarian", "carnivore", "murderer", "true crime podcaster", "historian", "bandit", "smuggler", "morb", "amongus", "barista", "whippersnapper", "motivational speaker/juggler", "DJ", "game show host", "CS major", "singer", "puddle"] + let noun = nouns[Math.floor(Math.random() * nouns.length)]; + let html = + ` +
Here's what other people named this rat:
+