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
8 changes: 8 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"development"
],
"hints": {
"meta-viewport": "off"
}
}
102 changes: 35 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,68 @@
Assignment 2 - Short Stack: Basic Two-tier Web Application using HTML/CSS/JS and Node.js
===
# CS 4241 a2-adedejisultan02 (Sultan Adedeji)

Due: September 11th, by 11:59 AM.

This assignment aims to introduce you to creating a prototype two-tiered web application.
Your application will include the use of HTML, CSS, JavaScript, and Node.js functionality, with active communication between the client and the server over the life of a user session.

Baseline Requirements
---

There is a large range of application areas and possibilities that meet these baseline requirements.
Try to make your application do something useful! A todo list, storing / retrieving high scores for a very simple game... have a little fun with it.

Your application is required to implement the following functionalities:

- a `Server` which not only serves files, but also maintains a tabular dataset with 3 or more fields related to your application
- a `Results` functionality which shows the entire dataset residing in the server's memory
- a `Form/Entry` functionality which allows a user to add or delete data items residing in the server's memory
- a `Server Logic` which, upon receiving new or modified "incoming" data, includes and uses a function that adds at least one additional derived field to this incoming data before integrating it with the existing dataset
- the `Derived field` for a new row of data must be computed based on fields already existing in the row.
For example, a `todo` dataset with `task`, `priority`, and `creation_date` may generate a new field `deadline` by looking at `creation_date` and `priority`

Your application is required to demonstrate the use of the following concepts:
## **Glitch link:** https://a2-adedejisultan02.glitch.me/

HTML:
- One or more [HTML Forms](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms), with any combination of form tags appropriate for the user input portion of the application
- A results page displaying all data currently available on the server. You will most likely use a `<table>` tag for this, but `<ul>` or `<ol>` could also work and might be simpler to work with. Alternatively, you can create a single-page app (see Technical Acheivements) but this is not a requirement.
- All pages should [validate](https://validator.w3.org)
- If your app contains multple pages, they should all be accessible from the homepage (index.html)
- HTML form to input fashion designers.
- All pages validate

CSS:
- CSS styling of the primary visual elements in the application
- Various CSS Selector functionality must be demonstrated:
- Various CSS Selector functionality used include:
- Element selectors
- ID selectors
- Class selectors
- CSS positioning and styling of the primary visual elements in the application:
- Use of either a CSS grid or flexbox for layout
- Rules defining fonts for all text used; no default fonts! Be sure to use a web safe font or a font from a web service like [Google Fonts](http://fonts.google.com/)
- used various google fonts

- CSS defined in a maintainable, readable form, in external stylesheets

JavaScript:
- At minimum, a small amount of front-end JavaScript to get / fetch data from the server; a sample is provided in this repository.
- functionality to add/delete data from the server

Node.js:
- An HTTP Server that delivers all necessary files and data for the application, and also creates the required `Derived Fields` in your data.
A starting point is provided in this repository.
- created derived field for counting number of designers.

Deliverables
---
## Fashion Show Designer Interest
The Fashion Show Designer Site is an online platform tailored for fashion event organizers and designers. It provides a user-friendly interface to seamlessly manage and showcase fashion designers and their brands. This site allows event organizers to collect and display essential information about fashion designers, such as brand name, designer name, contact details, and brand type.

Do the following to complete this assignment and acheive a base grade of 85%:
## Technical Achievements
- **Tech Achievement 1**: Used adobe color scheme
- **Tech Achievement 2**: Used google font
- **Tech Achievement 1**: single page app
- **Tech Achievement 1**: modify existing data

1. Fork the starting project code (make sure to fork the 2023 repo!). This repo contains some starter code that may be used or discarded as needed.
2. Implement your project with the above requirements.
3. Test your project to make sure that when someone goes to your main page, it displays correctly.
4. Deploy your project to Glitch, and fill in the appropriate fields in your package.json file.
5. Ensure that your project has the proper naming scheme `a2-yourGithubUsername` so we can find it.
6. Modify the README to the specifications below, and delete all of the instructions originally found in this README.
7. Create and submit a Pull Request to the original repo. Label the pull request as follows: a2-gitusername-firstname-lastname
### Design/Evaluation Achievements
- **Design Achievement 1**:

Acheivements
---
Last Name: Mark

Below are suggested technical and design achievements. You can use these to help boost your grade up to an A and customize the assignment to your personal interests. These are recommended acheivements, but feel free to create/implement your own... just make sure you thoroughly describe what you did in your README and why it was challenging. ALL ACHIEVEMENTS MUST BE DESCRIBED IN YOUR README IN ORDER TO GET CREDIT FOR THEM. Remember, the highest grade you can get on any individual assignment is a 100%.
Problems with Design:

*Technical*
- (5 points) Create a single-page app that both provides a form for users to submit data and always shows the current state of the server-side data. To put it another way, when the user submits data, the server should respond sending back the updated data (including the derived field calculated on the server) and the client should then update its data display.
The registration form was a bit lengthy, and it took some time to fill out all the required fields.
I found it a bit confusing to understand the specific format expected for the phone number.

- (5 points) In addition to a form enabling adding and deleting data on the server, also add the ability to modify existing data.
Comments That Surprised You:

*Design/UX*
- (5 points per person, with a max of 10 points) Test your user interface with other students in the class. Define a specific task for them to complete (ideally something short that takes <10 minutes), and then use the [think-aloud protocol](https://en.wikipedia.org/wiki/Think_aloud_protocol) to obtain feedback on your design (talk-aloud is also fine). Important considerations when designing your study:
I was pleasantly surprised by how visually appealing the designer showcase was on the site. It made me feel excited about participating in the fashion show.
I didn't expect the registration process to be so thorough, which is actually a good thing because it ensures that only serious designers get to participate.

1. Make sure you start the study by clearly stating the task that you expect your user to accomplish.
2. You shouldn't provide any verbal instructions on how to use your interface / accomplish the task you give them. Make sure that your interface is clear enough that users can figure it out without any instruction, or provide text instructions from within the interface itself.
3. If users get stuck to the point where they give up, you can then provde instruction so that the study can continue, but make sure to discuss this in your README. You won't lose any points for this... all feedback is good feedback!
Changes to Interface Based on Feedback:

You'll need to use sometype of collaborative software that will enable you both to see the test subject's screen and listen to their voice as they describe their thoughts, or conduct the studies in person. After completing each study, briefly (one to two sentences for each question) address the following in your README:
To improve the interface, I would suggest simplifying the registration process by providing clearer instructions and examples for phone number formatting.
I'd also maintain the visually appealing designer showcase but maybe add a search or filter feature for easier browsing.

1. Provide the last name of each student you conduct the evaluation with.
2. What problems did the user have with your design?
3. What comments did they make that surprised you?
4. What would you change about the interface based on their feedback?
Last Name: John

*You do not need to actually make changes based on their feedback*. This acheivement is designed to help gain experience testing user interfaces. If you run two user studies, you should answer two sets of questions.
Problems with Design:

Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions)
---
While registering, I encountered a minor issue with the "Brand Type" field. It was not entirely clear what was expected in that field, and I hesitated about what to put.

## Your Web Application Title
Include a very brief summary of your project here. Be sure to include the CSS positioning technique you used, and any required instructions to use your application.
Comments That Surprised You:

## Technical Achievements
- **Tech Achievement 1**: Using a combination of...
The color scheme and interface are awesome

### Design/Evaluation Achievements
- **Design Achievement 1**:
Changes to Interface Based on Feedback:

To improve the interface, I would suggest adding placeholder text or a brief description next to the "Brand Type" field to clarify the information expected.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 53 additions & 3 deletions public/css/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
body {
background:black;
color:white;
}
background-color: #97BFF0;
display: block;
}

.designer-form {
display: flex;
flex-direction: column;
align-items: center;
align-content: center;
}

h1,h2 {
text-align: center;
}

form button {
background-color: #1E66A8;
color: white;
padding: 14px 0;
margin: 10px 0;
border: none;
cursor: grabbing;
width: 40%;
border-radius: 10px;
}

form {
width: 40%;
align-content: center;
background-color: #8AAFDB;
padding: 20px;
border-radius: 30px;
}

form label {
font-weight: bold;
}

input {
width: 100%;
padding: 16px 8px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
border-radius: 5px;
}

.buttons {
display: flex;
flex-direction: column;
align-items: center;
}
44 changes: 32 additions & 12 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>CS4241 Assignment 2</title>
<head>
<meta charset="utf-8">
<script src="js/main.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fashion Show Designer Interest</title>
<link rel="stylesheet" href="css/main.css">
<script src="js/main.js"></script>

<!-- get rid of favicon error -->
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
</head>
<body>
<form>
<input type="text" id="yourname" value="your name here">
<button>submit</button>
</form>
</body>
</html>
</head>
<body>
<h1>Fashion Show Designer Interest</h1>
<!-- Look into for action and how it works with forms -->
<div id="add-designer-section" class="designer-form">
<form id="add-designer-form">
<h2>Add Designer</h2>
<label for="phone-number">Phone Number:</label><br>
<input type="text" id="phone-number" name="phone-number"/><br><br>
<label for="brand-name">Brand Name:</label><br>
<input type="text" id="brand-name" name="brand-name"/><br><br>
<label for="designer-name">Designer's Name:</label><br>
<input type="text" id="designer-name" name="designer-name"/><br><br>
<label for="brand-type">Brand Type:</label><br>
<input type="text" id="brand-type" name="brand-type"/><br><br>
<div class="buttons">
<button type="submit" id="addDesigner" formaction="/submit">Add Designer</button>
<button type="reset" id="reset">Reset</button>
</div>
</form>
</div>

<div id="designer-list">
<h2 id="recordCount">Designer List</h2>
</div>
</body>
</html>
99 changes: 74 additions & 25 deletions public/js/main.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,76 @@
// FRONT-END (CLIENT) JAVASCRIPT HERE

const submit = async function( event ) {
// stop form submission from trying to load
// a new .html page for displaying results...
// this was the original browser behavior and still
// remains to this day
event.preventDefault()

const input = document.querySelector( '#yourname' ),
json = { yourname: input.value },
body = JSON.stringify( json )

const response = await fetch( '/submit', {
method:'POST',
body
})

const text = await response.text()

console.log( 'text:', text )
let list, appdata = [];

// Function to handle form submission
const submit = async function (event) {
event.preventDefault();

let json,
evt = event.target

if (evt.getAttribute('formaction') == '/submit'){
let brandName = document.getElementById("brand-name");
let designerName = document.getElementById("designer-name");
let phoneNumber = document.getElementById("phone-number");
let brandType = document.getElementById("brand-type");
json = {phoneNumber: phoneNumber.value, brandName: brandName.value, designerName: designerName.value, brandType: brandType.value}
} else {
json = appdata[evt.getAttribute('id')]
}

const response = await fetch(evt.getAttribute('formaction'), {
method: 'POST',
body: JSON.stringify(json),
});

if (response.status === 400) {
const errorResponse = await response.json();
alert(errorResponse.error);
return;
}

let data = await response.json();
let count = data.recordCount
data = JSON.parse(data.data);

document.getElementById('reset').click();

// Update the designer list
updateDesignerList(data, count);
};

// Function to update the designer list
function updateDesignerList(data, count) {
list = document.getElementById('designerList');

if (list == null) {
list = document.createElement('ul');
list.id = 'designerList';
document.getElementById('designer-list').appendChild(list);
} else {
list.innerHTML = '';
}

document.getElementById('recordCount').innerHTML = `Designer List - ${count}`;
appdata = []
// Append designer information and buttons
data.forEach(d => {
const listItem = document.createElement('li');

// const designerInfoDiv = document.createElement('div');
listItem.innerHTML = `Brand Name: ${d.brandName}, Designer Name: ${d.designerName}, Phone Number: ${d.phoneNumber}, Brand Type: ${d.brandType} <button id=${d.phoneNumber} formaction="/delete" class="delete-btn")>Delete</button>`;
appdata[d.phoneNumber] = d
list.appendChild(listItem);
});

const deleteButtons = document.querySelectorAll('.delete-btn');
deleteButtons.forEach(button => {
button.addEventListener('click', submit);
});

}

window.onload = function() {
const button = document.querySelector("button");
button.onclick = submit;
}
window.onload = function () {
const addDesigner = document.getElementById('addDesigner');
addDesigner.onclick = submit;
};

Loading