Giter Site home page Giter Site logo

yothu / space-travelers-hub Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 1.17 MB

A Web application that showcases Rockets and Missions from the SpaceX API, you can reserve Rockets and join Missions to your profile.

Home Page: https://cosmos-travelers-hub.netlify.app/

HTML 7.97% JavaScript 90.44% CSS 1.60%
reactjs redux api-client spacex-api web-application

space-travelers-hub's Introduction

Space Travelers' Hub

Project that showcases Rockets and missions from the SpaceX API, the user can reserve Rockets and join Missions, and save them in his profile.

screenshot

Built With

  • JavaScript, CSS
  • React, Redux
  • Webpack

Live Demo

Check the live demo for this project here.

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

You need to be able to use Node Package Manager, or also called, the npm command. If you dont have it, install it with these commands in the CLI (for Linux):

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

sudo apt install nodejs

Then, run this command in the CLI:

npm --version

If the previous command prints a single line with a version number on screen, npm was installed.

Install

First you need to clone the repository into the folder of your choice with this command:

git clone https://github.com/Yothu/space-travelers-hub.git

Then go inside the repository foler with this command:

cd space-travelers-hub

After you are inside, download the npm dependecies with this command:

npm install

Finally, show the project through the browser with this command:

npm start

Usage

  • Once in the browser, you will see the Rockets page, in it you can click on the Reserve Rocket button to reserve a rocket, once a rocket is reserved, you can click on the Cancel Reservation button to cancel the reservation of the selected rocket.
  • Once you click on missions in the header you will be in the Missions page, in it you can click on the Join Mission button to join a mission,then you can click on the Leave Mission button to leave joined mission.
  • If you click on My Profile in the header you will be in your Profile page, there you will se the Rockets that you have reserved and the missions that you have joined.

Author

๐Ÿ‘ค David Vergaray

๐Ÿ“ License

This project is MIT licensed.

Show your support

Give a โญ๏ธ if you like this project!

space-travelers-hub's People

Contributors

yothu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lisaterumi

space-travelers-hub's Issues

[3pt] Implement mission joining - Actions

  • When a user clicks the "Join Mission" button, action needs to be dispatched to update the store. You need to get the ID of the selected mission and update the state. Remember you mustn't mutate the state. Instead, you need to return a new state object with all missions, but the selected mission will have an extra key reserved with its value set to true. You could use a JS filter() or map() to set the value of the new state - i.e.:
const newState = state.map(rocket => {
    if(mission.id !== id) 
        return mission;
    return { ...mission, reserved: true };
});
  • Regardless of which method you choose, make sure you place all your logic in the reducer. In the React view file, you should only dispatch the action with the correct rocket ID as an argument.

[1pt] Create basic structure for Rockets - Setup

  • Create a route and a view component. Use <NavLink /> for the page navigation links and style active class to indicate which section/page the user is currently on (underline active navigation link).
  • Create a directory for all Redux state slice files.

Team3 [1pt] Create basic structure for Dragons - Setup

  • Create a route and a view component. Use <NavLink /> for the page navigation links and style active class to indicate which section/page the user is currently on (underline active navigation link).
  • Create a directory for all Redux state slice files.

[4pt] Display missions - Lists render

  • Use useSelector() Redux Hook to select the state slices and render lists of missions in corresponding routes. i.e.:
// get rockets data from the store
const rockets = useSelector(state => state.rockets);
  • You can style the whole application "by hand" or you could use React Bootstrap, a UI library that could speed up the process. This is a popular library and working with its components would be good practice.
  • Render a table with the missions' data (as per design).

Team3 [4pt] Fetch dragons - Fetch data

Fetch data from the Dragons endpoint (https://api.spacexdata.com/v3/dragons) when a user navigates to the Dragons section.

Once the data are fetched, dispatch an action to store the selected data in Redux store:

  • id
  • name
  • type
  • flickr_images

NOTE: Make sure you only dispatch those actions once and do not add data to store on every re-render (i.e. when changing views / using navigation).

[1pt] Switch badges for Rockets - Conditional components

Rockets that have already been reserved should show a "Reserved" badge and "Cancel reservation" button instead of the default "Reserve rocket" (as per design)

Use the React conditional rendering syntax:

{rocket.reserved && ( 
    // render Cancel Rocket button
)}

[4pt] Display rockets - Lists render

  • Use useSelector() Redux Hook to select the state slices and render lists of rockets in corresponding routes. i.e.:
// get rockets data from the store
const rockets = useSelector(state => state.rockets);
  • You can style the whole application "by hand" or you could use React Bootstrap, a UI library that could speed up the process. This is a popular library and working with its components would be good practice.
  • Render a list of rockets (as per design). For the image of a rocket use the first image in the array of flickr_images.

[1pt] Create basic structure for Missions - Setup

  • Create a route and a view component. Use <NavLink /> for the page navigation links and style active class to indicate which section/page the user is currently on (underline active navigation link).
  • Create a directory for all Redux state slice files.

Team3 [3pt] Implement dragon booking - Actions

  • When a user clicks the "Reserve dragon" button, action needs to be dispatched to update the store. You need to get the ID of the reserved dragon and update the state. Remember you mustn't mutate the state. Instead, you need to return a new state object with all dragons, but the selected rocket will have an extra key reserved with its value set to true. You could use a JS filter() or map() to set the value of the new state - i.e.:
const newState = state.map(rocket => {
    if(dragon.id !== id) 
        return dragon;
    return { ...dragon, reserved: true };
});
  • Regardless of which method you choose, make sure you place all your logic in the reducer. In the React view file, you should only dispatch the action with the correct dragon ID as an argument.

[3pt] Implement rocket booking - Actions

  • When a user clicks the "Reserve rocket" button, action needs to be dispatched to update the store. You need to get the ID of the reserved rocket and update the state. Remember you mustn't mutate the state. Instead, you need to return a new state object with all rockets, but the selected rocket will have an extra key reserved with its value set to true. You could use a JS filter() or map() to set the value of the new state - i.e.:
const newState = state.map(rocket => {
    if(rocket.id !== id) 
        return rocket;
    return { ...rocket, reserved: true };
});
  • Regardless of which method you choose, make sure you place all your logic in the reducer. In the React view file, you should only dispatch the action with the correct rocket ID as an argument.

[1pt] Create empty My profile - Setup (group task)

  • Create a route and a view component. Use <NavLink /> for the page navigation links and style active class to indicate which section/page the user is currently on (underline active navigation link).
  • This view should be empty - you will add content in separate tasks.

Team3 [1pt] Switch badges for Dragons - Conditional components

Dragons that have already been reserved should show a "Reserved" badge and "Cancel reservation" button instead of the default "Reserve dragon" (as per design).

Use the React conditional rendering syntax:

{rocket.reserved && ( 
    // render Cancel Rocket button
)}

[4pt] Fetch missions - Fetch data

Fetch data from the Missions endpoint (https://api.spacexdata.com/v3/missions) when a user navigates to the Missions section.

Once the data are fetched, dispatch an action to store the selected data in Redux store:

  • mission_id
  • mission_name
  • description

NOTE: Make sure you only dispatch those actions once and do not add data to store on every re-render (i.e. when changing views / using navigation).

[1pt] Switch badges for Missions - Conditional components

Missions that the user has joined already should show a badge "Active Member" instead of the default "NOT A MEMBER" and a button "Leave Mission" instead of the "Join Mission" button (as per design).

Use the React conditional rendering syntax:

{rocket.reserved && ( 
    // render Cancel Rocket button
)}

[1pt] Implement mission leaving - Actions

  • Follow the same logic as with the "Join mission" - but you need to set the reserved key to false.
  • Dispatch these actions upon click on the corresponding buttons.

[4pt] Fetch rockets - Fetch data

Fetch data from the Rockets endpoint (https://api.spacexdata.com/v3/rockets) when the application starts (as Rockets is the default view).

Once the data are fetched, dispatch an action to store the selected data in Redux store:

  • id
  • name
  • type
  • flickr_images

NOTE: Make sure you only dispatch those actions once and do not add data to store on every re-render (i.e. when changing views / using navigation).

Team3 [4pt] Display dragons - Lists render

  • Use useSelector() Redux Hook to select the state slices and render lists of dragons in corresponding routes. i.e.:
// get rockets data from the store
const rockets = useSelector(state => state.rockets);
  • You can style the whole application "by hand" or you could use React Bootstrap, a UI library that could speed up the process. This is a popular library and working with its components would be good practice.

  • Render a list of dragons (as per design). For the image of a dragon use the first image in the array of flickr_images.

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.