Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/*
34 changes: 3 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
Assignment 4 - Components
===
# Assignment 4: Name logger V2

Due: October 4th, by 11:59 AM.
Link: https://a4-sean-mcmillan.glitch.me/

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
---

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

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?

Unlike previous assignments, this assignment will be solely graded on whether or not you successfully complete it. Partial credit will be generously given.
For this project I reimplemented my assignment 2 using react. I had issues with deleting items so I kept it to only add names. Overall react was the hardest part of this entire class and also my least favorite topic to learn about. React definitely hindered the development experience and not using it was much easier.
52 changes: 52 additions & 0 deletions build/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, {useState} from "./_snowpack/pkg/react.js";
import {default as NewTable} from "./NewTable.js";
import "./_snowpack/pkg/bootstrap.js";
import "./_snowpack/pkg/bootstrap/dist/css/bootstrap.min.css.proxy.js";
const App = (props) => {
const [entries, setEntries] = useState([]);
const click = (event) => {
const value = document.querySelector("#yourname").value;
fetch("/add", {
method: "POST",
body: JSON.stringify({name: value}),
headers: {"Content-Type": "application/json"}
});
fetch("/read", {
method: "GET"
}).then(function(response) {
return response.json();
}).then(function(response) {
setEntries(response);
});
};
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
className: "grid-container"
}, /* @__PURE__ */ React.createElement("div", {
className: "box1"
}, /* @__PURE__ */ React.createElement("h1", {
id: "textSection"
}, "Assignment 4 By Sean McMillan")), /* @__PURE__ */ React.createElement("div", {
className: "box2"
}, /* @__PURE__ */ React.createElement("p", {
id: "textSection"
}, "Read the REAME.md to read about everything I did in this project! To add a row to the list, simply type your name into the box below.")), /* @__PURE__ */ React.createElement("div", {
className: "box3"
}, /* @__PURE__ */ React.createElement("div", {
id: "nonTextSection"
}, /* @__PURE__ */ React.createElement("form", {
action: ""
}, /* @__PURE__ */ React.createElement("input", {
type: "text",
id: "yourname",
defaultValue: "your name here"
}), /* @__PURE__ */ React.createElement("button", {
type: "button",
id: "submitButton",
onClick: click
}, "submit")))), /* @__PURE__ */ React.createElement("div", {
className: "box4"
}, /* @__PURE__ */ React.createElement(NewTable, {
rows: entries
}))));
};
export default App;
11 changes: 11 additions & 0 deletions build/NewTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "./_snowpack/pkg/react.js";
const NewTable = (props) => {
console.log(props);
return /* @__PURE__ */ React.createElement("table", {
className: "box4",
id: "table"
}, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", null, "Name"), /* @__PURE__ */ React.createElement("th", null, "Num Chars"), /* @__PURE__ */ React.createElement("th", null, "Timestamp")), props.rows.map((row) => {
return /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", null, row.name), /* @__PURE__ */ React.createElement("th", null, row.numChars), /* @__PURE__ */ React.createElement("th", null, row.timestamp));
}));
};
export default NewTable;
Loading