Assignments > HW4: React Client
Due Fri, 04/17 at 11:59pm
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
hw04starter files and move them to yourcsci344/homework/directory. - Open a terminal and make sure that you are inside the
hw04directory. - 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).
Note: The
AddCommentcomponent and theFollow / Unfolloware 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 | See Videos |
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 | See Videos |
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 | See Videos |
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 | See Videos |
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.htmlfile in thedistdirectory) - The name of your partner (if applicable)
- Whether you completed any of the extra credit (so that I can look for it)
Final Checklist
Please verify that you have completed the following tasks before you submit:
| Resource | Description of Task | |
|---|---|---|
| Profile | The current user’s profile is rendered in the right panel using React and data from /api/profile. |
|
| Stories | Stories are rendered in React using data from /api/stories. |
|
| Suggestions | Suggested accounts are rendered in React using data from /api/suggestions. |
|
| Suggestions | Individual suggested users are rendered with a Suggestion child component. |
|
| Posts | Posts are rendered in React using data from /api/posts. |
|
| Posts | Individual posts are rendered with a Post component. |
|
| Components | The app uses a series of React components rather than copying the Homework 3 HTML directly into one file. | |
| React State | props, useState, and useEffect are used appropriately to pass data, manage state, and handle side effects. |
|
| Like Button | The LikeButton component renders the correct heart icon state for liked vs. unliked posts. |
|
| Like Button | Clicking the like button issues the correct create / delete requests and redraws the post in React. | |
| Bookmark Button | The BookmarkButton component renders the correct bookmark state for bookmarked vs. unbookmarked posts. |
|
| Bookmark Button | Clicking the bookmark button issues the correct create / delete requests and redraws the post in React. | |
| Composition | The page still looks good and remains responsive after converting the UI to React. | |
| Build | Running npm run build successfully creates a dist directory. |
|
| Build | The transpiled app works when previewing dist/index.html. |
|
| GitHub | The transpiled Homework 4 app is linked from your homepage. | |
| GitHub | Your edits have been committed and pushed to GitHub. | |
| Moodle | You are ready to submit your GitHub repository link and your GitHub Pages link to Moodle. | |
| Moodle | If applicable, you included your partner’s name and noted any extra credit in your Moodle submission. |