Assignments > HW4: React Client
Due on Tue, 11/26 @ 11:59PM. 50 Points.
Video Walkthroughs for Tutorial 8
The following video walkthroughs go over all of the requirements for Tutorial 8. To complete Homework 4, you will have to implement stories, profile, and suggestions on your own as well as liking / unliking posts.
- 06:43 Setup
- 15:05 Component organization
- 04:06 Understanding the NavBar component
- 15:40 Fetching Posts from the course API (via HTTP)
- 08:55 Creating a Post component
- 17:03 Enhancing the Post component
- 12:15 Like & Bookmark Buttons
- 17:42 Creating & Deleting Bookmarks on the course API (via HTTP)
- 12:30 Redrawing the Post after a state change
- 02:52 Transpiling and linking to your home page
The folder of videos can also be found here.
Overview
In this homework assignment, you will re-implement your HW3 code in React (with a few minor changes to improve the usability of your app). I recommend building from this starter code provided below (which uses Tailwind). That said, feel free to do it your way. I won’t be grading you on CSS, but please do make it look nice. You’re also welcome to customize the look and feel to make it your own.
When you’re done, your React version of the PhotoApp should behave like this one: https://photo-app-secured.herokuapp.com/.
Setup
- Download and unzip the
hw04
starter files and move them to yourcsci344/homework/
directory. - Open a terminal and make sure that you are inside the
hw04
directory. - Install the node packages as follows:
npm install
- Run the React bundler and local server by typing:
npm run dev
- Keep this process running while you are developing in React.
Tasks
In the section below, I’ve mapped out a suggested implementation strategy. If you implement your React functionality differently, that’s fine, but I will be verifying that you did indeed make a series of components (versus just copying your HW3 file into a React folder and only making minor changes). The “AddComment” component can be implemented for extra credit.
Points | Component / Task | Description | |
---|---|---|---|
0pts | On Your Own |
NavBar.js Displays the Header |
(Already done for you) Create a NavBar component that displays the username of the logged in user, a logout button, and a link to the API tester as shown in the demo. Notes:
|
4pts | On Your Own |
Profile.js Display Profile |
Create a Profile component that displays the current user's profile (inside of the right panel) using data from the /api/profile endpoint.
|
4pts | On Your Own |
Stories.js Display Stories |
Create a Stories component that displays stories from the user's network. This component will both fetch the stories from /api/stories , and draw the stories.
|
4pts | On Your Own |
Suggestions.js Display All Suggestions |
Create a Suggestions component that displays suggested user accounts. This component will both fetch the suggestions from /api/suggestions , and draw the suggested users with the help of the Suggestion.js child component (see below).
|
4pts | On Your Own |
Suggestion.js Display Individual Suggestion |
Create a Suggestion component that will render a representation fo each user.
|
4pts | Tutorial 8 |
Posts.js Display All Posts |
Create a Posts component that displays all of the posts user accounts. This component will both fetch the posts from /api/posts , and draw each post users with the help of the Post.js child component (see below).
|
8pts | Tutorial 8 |
Post.js Display Individual Post |
Create a Post component so that it looks like the post from HW4. To do this:
|
4pts | On Your Own |
LikeButton.js Like / Unlike Post |
Create a LikeButton component that will:
|
4pts | Tutorial 8 |
BookmarkButton.js Bookmark / Un-Bookmark Post |
Create a BookmarkButton component that will:
|
2pts | On Your Own | Keyboard Navigation |
|
4pts | On Your Own | Aria attributes |
Use the "aria-label" and "aria-checked" attributes (in conjunction with the role="switch" attribute) to indicate to the screen reader whether the following buttons are turned on or off:
|
8pts | Tutorial 8 |
Transpile Transpile your React App and link it to your homepage |
Since React uses language features that your browser can't understand, you'll need to "transpile" your code to "vanilla" HTML, CSS, and JavaScript. Luckily, Vite can do this for you. Please do the following:
|
5pts | Extra Credit |
AddComment.js
Add a Comment |
Create an AddComment component that will:
|
5pts | Extra Credit | Follow / Unfollow |
|
5pts | Extra Credit |
Form Accessibility
Extra handling for "Add Comment" |
|
Moodle Submission
Please review the requirements above and ensure you have met them. When you’re done, please submit the following to the Moodle:
- A link to your GitHub Repository
- A link to your GitHub Pages (which should link to your transpiled
index.html
file in thedist
directory) - The name of your partner (if applicable)
- Whether you completed any of the extra credit (so that I can look for it)