Git Product home page Git Product logo

parcel-pointers's Introduction

Parcel Pointers

Production Build License: MIT Contributor Covenant Netlify Status

What's this? This is a template repository that sets up a few minor systems for a React micro-app, which is something that we've done frequently at Teach LA. Here's what it does:

  • has GitHub Actions automatically set up for testing and linting builds
  • has a default Dependabot config for yarn (with monthly audits)
  • has Netlify redirects set up for multi-route SPAs
  • has Webpack that helps bundle JS/TS files for browser usage
  • Husky for Git Hooks which enforces linting rules for files on commit
  • ESLint for our .TS and .TSX files
  • StyleLint with SASS guidelines for CSS, SASS, SCSS stylesheets.
  • includes the Contributor Covenant in CODE_OF_CONDUCT.md
  • has a little bit of documentation for new people!
  • Some extra stuff like changing the app logo to TeachLA's logo and setting up the src directory for further development!

Overview

This project is Parcel Pointers - a Teach LA learning lab for teaching students all about pointers for CS 31/32!

Development Setup

We'll use a really common Node.js project workflow + Yarn! First, let's clone our repository, and install all of our yarn dependencies:

git clone https://github.com/uclaacm/parcel-pointers.git
cd parcel-pointers

The instructions to install Node.js will be different based on which platform you're running. It's heavily advised to install your Node.js using NVM (Node Version Manager) because it's easy to manage a standardized version and update it as needed.

macOS or Linux

Instructions for installing NVM on macOS and Linux (including WSL) are here.

At this point you can run nvm install. Assuming you've already cded into the correct directory as mentioned earlier, this will download the LTS (Long-Term Support) version of Node.js for you. Then, run nvm use to make sure you've switched to the right version; if it tells you Now using Node v16.13.2 or something similar, you're good to go!

Windows

If you're on Windows, you can use NVM for Windows, a separate version manager whose installation instructions can be found here. Once you've done that, you can run nvm install 16.13.2 to install the LTS version of Node.js, and nvm use 16.13.2 to switch to it.

If you don't have yarn installed...

npm install --global yarn

Then install our dependencies!

yarn install
yarn prepare

(If the above commands don't work even after installing yarn via npm, check this npm installation guide, click on alternatives, choose your operating system, and follow the steps there!)

(We handle the yarn and npm conflict issues within our .gitignore we set up so dw about it!) To start our app, you just need to run yarn start!

yarn start

And to build our project for production (with CRA and Webpack's bundling with all that goodness),

yarn run build

Contribution Workflow

Thanks for your interest in contributing to Parcel Pointers! ❤️

Here's a quick guide on how to get started.

  1. Either make a new branch or a fork of this repository. main is a protected branch, so you cannot push to it.
  2. Follow the instructions in "Development Setup" above. If you're on a fork, replace the URL with the fork's URL; if you're on a different branch, check it out using git checkout -b {branch_name}.
    a. For branch naming, you can generally use {issue number}_{change} to keep track of which branch corresponds to which ticket! For example for implenting a slideshow, I would use 30_slideshow.
    b. For commit messages, it does not need to be detailed- a short, general description of changes made works!
  3. Beep boop away!
  4. Before you push, make sure your app runs with yarn start. If there are any errors, our CI/CD service will reject your build.
  5. Once you're ready, stage and commit your changes with git commit -am {commit_message}.
  6. Push your changes with git push --set-upstream origin {branch_name} to push your branch to the repository, then make a pull request with your changes, and let someone on your project team know.
    a. Netlify has a neat feature called "Deploy Previews" that give you a link to preview your changes; see the blog post for more info!
    b. Link your pull request to its corresponding ticket by replacing the comment with the issue number after # sign at the top!
    c. You can add someone as a reviewer to a pull request to let them know.
  7. If your code passes code review, then we can squash and merge it into main. Congratulations! If you'd like, it's now safe to delete your branch/fork.

Helpful Commands

By running yarn lint-fix we can use the linter that we set-up to format our code the way that passes our style checks! Before you commit your changes and submit a pull request, make sure to run

yarn lint-fix

With Husky, we run yarn lint-staged automatically before you commit! If you want to lint before commiting, you can run yarn lint-fix.

FAQs

Some lint is unnecessary :( How do I disable it?

There are actually 2 main ways to disable lint. Disabling the "rule" entirely, or in just a single line or file!

Disabling the rule entirely.

** Make sure this is what you really want!! It is often likely that you want to disable for just a single file. **

Depending on whether it's from stylelint or eslint, you can go to stylelintrc.json and add to `"rules"

<rule-name>: null

or eslintrc.json and add

'<rule-name>': 'off',

Disabling a rule for a single line or file

Take a look at the eslint docs for this: https://eslint.org/docs/user-guide/configuring/rules#disabling-rules

Or the stylelint docs for this: https://stylelint.io/user-guide/ignore-code/

It's pretty simple though, it'd look something like

/* eslint-disable <rule-name> */

or

// eslint-disable-next-line

The process for stylelint is very similar.

Husky is yelling at me and not letting me commit :(

Add the -n flag to your commit message to skip Husky's auto-linting.

EG: git commit -m "changes" -n

Assets are angry and won't accept

Our webpack set-up currently accepts asset files with the following extensions: png, svg, jpg/jpeg, gif, mp3, ttf

Code for it can be seen in line 22 webpack.dev.js and in webpack.prod.js

      {
        test: /\.(png|svg|jpe?g|gif|mp3|ttf)$/i, // we use regex to test different file types
        use: {
          loader: 'file-loader',
          options: {
            name: 'assets/[name].[ext]',
          },
        },
      },

If you want to add more assets like .pdf, .wav, .mp4, <YOUR_ASSET_TYPE> etc.

  • Update webpack.dev.js file. Change test: /\.(png|svg|jpe?g|gif|mp3)$/i to test: /\.(png|svg|jpe?g|gif|mp3|<YOUR_ASSET_TYPE>)$/i
  • Update webpack.prod.js file. Change test: /\.(png|svg|jpe?g|gif|mp3)$/i, to test: /\.(png|svg|jpe?g|gif|mp3|<YOUR_ASSET_TYPE>)$/i
  • (If typing is needed) add a folder under custom_typing => import-<YOUR_ASSET_TYPE>
  • (If typing is needed) create a file like import-<YOUR_ASSET_TYPE>.d.ts
  • (If typing is needed) add in:
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.<YOUR_ASSET_TYPE>' {
  const value: <YOUR_ASSET_TYPE-TYPE>;
  export default value;
}

How can I tell if my asset is actually being served?

Take a look at <YOUR_PROJECT_PATH>/asset-manifest.json. Like this!

Some More Helpful Tools

  • Preloading Images - if rendering images gets annoying because it's slow: Link Example here

Licensing & Attribution

This project and its code are licensed under the MIT License. You're free to use them however you wish, though we'd love to hear from you if you found this useful!

parcel-pointers's People

Contributors

ajtadeo avatar audreyemu avatar bliutech avatar chenghengli avatar colbertx avatar dankco avatar dependabot[bot] avatar edmundyau avatar emmettlsc avatar flobythebay avatar hunter-kang avatar jenniferylee avatar lawtlee avatar lilyorlilypad avatar lymoniquewong avatar michaelbunte avatar mohelizabeth avatar nathandhummi avatar osphia avatar snyk-bot avatar sweeneyngo avatar tiffanyorian avatar tr-vs avatar ypandas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jenniferylee

parcel-pointers's Issues

Feature: Write Answers/Explanations for Excercise 1 Page

We have the components in, so now we need to add in answers into the dropdowns along with explanations of why answer choices are right or wrong. Try to also link the correct/incorrect options to the check button.
These are the answers/explanations I thought of, feel free to suggest any edits:
Q1.
10 - Not Quite. box b does not cover this address at all. Please try again.
11- Correct! This is the first address for box b, which is what pointers use to find variables in memory. Now Pipi needs to calculate how much he needs to move to get there.
12- Not Quite. This is the second address for box b, pointers don't want to point to the middle of a variable in memory, or it will read the incorrect value. It is like pointing to the middle of a word and starting to read from there! Please try again.
13- Not Quite. This is the end of box b. Remember that memory is read from left to right, just like our warehouse has addresses from left to right. Please try again.
Q2.
7- Not Quite. Pipi needs to move from address 3 to address 11. Please try again.
8- Correct! Pipi needs to move from address 3 to address 11. Now Pipi needs to go to a different box.
9- Not Quite. Pipi needs to move from address 3 to address 11. Please try again.
Q3.
21 - Not Quite. box e does not cover this address at all. Please try again.
22- Correct! This is the first address for box e, which is what pointers use to find variables in memory. Now Pipi needs to calculate how much he needs to move to get there.
23- Not Quite. This is the second address for box e, pointers don't want to point to the middle of a variable in memory, or it will read the incorrect value. It is like pointing to the middle of a word! Please try again.
24- Not Quite. This is the end of box e. Remember that memory is read from left to right, just like our warehouse has addresses from left to right. Please try again.
Q4.
10- Not Quite. Pipi needs to move from address 11 to address 22. Please try again.
11- Correct! Pipi needs to move from address 11 to address 22. Thanks to you, Pipi found all of the boxes correctly!
12- Not Quite. Pipi needs to move from address 11 to address 22. Please try again.

Feature: Create Motivation Behind Pointers Page

Make this page from the Figma:
image
Don't worry about the slideshow or back/next button components, those are different tickets, you can either put in a placeholder for now, or nothing at all. Just make the skeleton of the page

Feature: Create Note component

Tip/Note cards were combined into one Note component and revised in the Figma. All lesson pages which used Tip/Note should be updated with the new component.

Lesson 3:
image

Lesson 4:
image

Feature: Make Lesson 2, Page 2

Summary

Complete the second page for Lesson 2. This feature was not added in the original issue #92 and should be implemented. For "terminal" section, be sure to include correct syntax highlighting!

image

Feature: Implement sidebar

Implement a sidebar component
Take a look at the figma design, have a button in the top left corner of the page

Have a sidebar pop out from the left of the screen, and the user can click on the section they want to navigate to. For now, just have it be able to navigate between the home page, demo page, and lesson 1 page. We'll add more pages as we create them

Don't worry about styling for now (what the popped out sidebar looks like, how much of the screen to take up etc) - we'll leave that for another ticket, just focus on the functionality for now

Feature: Animate Pipi

We want Pipi to move from here:
image
to here:
image
The animation can occur on page load or upon trigger for now. Don't worry too much about the exact coordinates, just make Pipi move!

Feature: Implement slideshow component

image

Implement a slideshow component that you can include on a page. The user should be able to cycle through the images by clicking on the left and right arrows, and the bottom indicator should indicate which image they are on.

Feature: create popup component

image

When the user clicks on the red mail-inbox button, we should have a popup window that tells them which box they should be telling the robot to go to.

Create a red button on the demo page. Have a popup that appears on the screen when the red button is clicked. To close the pop up window, the user should be able to either click the "ok" button, or just click somewhere on the screen that's not on the popup window. Feel free to use a package like https://www.npmjs.com/package/reactjs-popup, or whatever method you prefer.

Depending on how long you've spent on the ticket, you can choose what you want to put on the contents of the popup. If you've been working on it for a while, and want to call it a day and move on to something else, you can just hard code some text onto the popup window and we'll leave the content of the popup for another ticket. If you're still feeling fresh, you can try making the contents of the popup look like the figma design. It would be good to pass in the section number as props, so we can reuse this component easily. Again though, if it's taken some time to get the popup to work you can just leave it at that and we can leave the content of the popup for another ticket.

Minor Update: Add confetti variant to box component

Add confetti to the box component as a variant that looks like this:
image
Confetti can be an argument passed into the function to decide whether to render confetti or not. Add one confetti box to the Demo page for now. We will figure out states and stuff later.

Feature: Add Boxes to Demo Page

Add non-clickable boxes to the Demo Page as shown by the Figma
image
They can all be the same size for now, but make sure they are labeled alphabetically
Don't worry about the positioning either for now, that will come after #13 and #88 .

Feature: Make Lesson 4 Page- Dereferencing Pointers

Make the lesson 4 page based on the Figma:
Screenshots here-
image
image
image
Note that the center image with the partially filled box flowing into the other box should be an animation, but that will come later- so either include a static image for now or just leave a comment of where the component should go.

Minor Update: Popup closes if user clicks off it

Very minor update, I think it would be nice if in addition to the user clicking on the close button to get rid of the popup, they could also just click somewhere on the screen that's off the popup to close it.

Minor Update: Make box with confetti render conditionally

Currently, the confetti comes out on page load. Let's make the box with confetti only render upon clicking a shelf address button- doesn't matter which one for now. This will set us up for the animation later!
image
This is what we are looking for later!
image

Feature: Implement clickable address buttons

image

On the main demo page, we want the user to be able to click on the correct address. So the addresses will have to be clickable buttons.

Implement a reusable "ShelfAddress" component that is a clickable button. The address should be displayed on the button, so probably try and pass that address in as props, so each button can display the correct address.
Have the background color of the button change to green when the user clicks on it, and have it stay green.

On the demo page, put one of the buttons on screen to test it and make sure it works. If you want to/have time, try lining up shelves of these buttons as seen in the figma design - 3 rows of 24, with the addresses going from 1 to 72. But if this will take too long don't worry about it, we'll save it for another ticket

Minor Update: Clean up confetti

Right now, once the confetti goes, it stays at the "bottom" of the page like this, We want to clean this up and make it disappear.
This may go along with #152 and conditionally rendering the box and confetti.
image

Feature: Make Hint Box Component

Make a hint box that looks roughly like this:
image

You can just have it say:
Click on the first address occupied by the box (the leftmost one). (I formatted like this in case you want to copy + paste)
for now. Does not have to turn green/red dynamically yet, just leave it static white for now.
Note: the shadow around the box is the box-shadow attribute in css. You can see the Figma for details.

Feature: Make Lesson 6 Page- Pointer Reassignment

Make the Lesson 6 Page based off the Figma:
image
image
The slideshow component is used here, so just leave a comment for where it should go. This refers to the middle part where there is the image of code tracing.

Feature: Implement front page

image

Implement the front page in the Home.tsx file, according to the figma design
You don't need to worry about the little sidebar at the top, since someone else should be taking care of that for you
You can leave the "let's go" button as just a normal button where nothing happens if you click on it, but if you feel up to a challenge you can try redirecting the user to the lesson-1 page if they click on it!
Apart from that, this page shouldn't be dependent on any of the other pages, so don't worry about how any of the other code is going to affect your Home.tsx file

If you happen to think of a snappy description to put on the home page, feel free to add it!
And of course, if you have any questions feel free to reach out to any of us! Good luck!

Feature: Make lesson two page

Make the lesson two page look like this:
image
Just do the first page of lesson two for now. All the text should be fairly straightforward to copy + paste, then I think you can just copy and paste the images from the figma, but let me know if you need any help with this! Don't worry too much about the styling for now. Getting everything on the screen is most important!

Feature: Drag and drop component

image

Implement drag and drop section, using whatever libraries you need. Start by creating an "exercise-1" page, so you can work on this page. At the moment we haven't fleshed out the exercise page yet, so you don't need to worry about styling since we'll have to go back and format the whole page later anyway. We'll save styling for another ticket, so for this one you should focus on just getting as much functionality done as you can

Desired behaviors for the drag and drop (do as much of this as you want, if you decide that you've spent too long working on this ticket and want to move on to something else that's fine too, we can save the rest for another ticket) -

  • Users can drag the items to the boxes, and as long as they drop it somewhere near the box, the item should click into place
  • If the user drops the item in a place that is not near a box, then the item should not be placed down and it should return to the original position that the user picked it up from, so the user knows they need to try again
  • If the user drops an item onto a box that already has an item in it, the box should be replaced with the new item
  • If a box already contains an answer, the user can remove the answer by dragging the item out of the box and dropping it somewhere not near the box. It should be returned to the selection area, next to the other items

Honestly I'm not sure how feasible a lot of this is since I don't know too much about the library, so message me in discord with any questions/updates you have
Good luck!

Feature: implement next and back buttons

image

Following the figma design, we need to have next and back buttons on every page so that we can progress through the app. Implement the component for this. To make it more reusable, see if you can pass in the url as props to the component so we can use this same component to link to different pages. To test, try putting your buttons on one of the pages, and try clicking on it to navigate to another page. The buttons should be on the bottom of the page, as seen in the figma design

Feature: Make Submission Button and Checker Function

Make a button that checks the state of the dropdowns and updates the state based on if they are right or wrong. Don't worry about explanations, maybe just highlight green for correct and red for wrong for now.

Minor Update: Fix Pointer Motivation Styling

Pointer Motivation page does not have the "page-wrapper" styling, this should be added.

  • remove "lesson", "title", "description" id's
  • add div with "page-wrapper" class name inside AppWrapper component

Pointer Motivation:
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.