Skip to content

Small App using real live data from the SpaceX API. Your task is to build a web application for a company that provides commercial and scientific space travel services. The application will allow users to book rockets and join selected space missions.

License

Notifications You must be signed in to change notification settings

Hombre2014/Space-Travelers

Repository files navigation

Charles Gobina and Yuriy Chamkoriyski Space Travelers' Hub project

React app

screenshot

Description

In this task, you will be working with the real live data from the SpaceX API. Your task is to build a web application for a company that provides commercial and scientific space travel services. The application will allow users to book rockets and join selected space missions.

Requirements:

Phase 1, config and basic setup

  • Create React App.
  • Install React Redux, Redux Logger and React Router.
  • Download the free image for the app logo.
  • Create routes and view components (Rockets, Missions, My Profile, Dragons [only if your team has 3 members]). Use <NavLink /> for the page navigation links and style active class to indicate which section/page user is currently on (underline active navigation link).
  • Create directories for all Redux state slice files (rockets, missions, dragons [only if your team has 3 members]).

Phase 2, Redux: Fetch data and update Redux store

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).

NOTE: Rockets is the default view, so you must fetch rockets data when the application starts. However, the missions data should only be fetched (once) when a user navigates to the Missions section.

Phase 3, Render UI:lists

  • Use useSelector() Redux Hook to select the state slices and render lists of rockets and 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 list of rockets (as per design). For the image of a rocket use the first image in the array of flickr_images.
  • Render a table with the missions' data (as per design).

Phase 4, Redux: Write actions and reducers for booking rockets and joining missions

  • When a user clicks the "Reserve rocket" button or "Reserve dragon" button [only if your team has 3 members], 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.

  • Create a reducer and action dispatcher for the "Join Mission" button. The logic here is practically the same as with rockets - you need to pass the mission's ID to the corresponding action and update the missions' state with the selected mission having a new key/value - reserved: true.

Phase 5, Redux: Write actions and reducers for canceling rockets/dragons and leaving missions

  • Here you need to follow the same logic as with the "Reserve rocket"/"Reserve dragon" and "Join mission" - but you need to set the reserved key to false.
  • Dispatch these actions upon click on the corresponding buttons.

Phase 6, Render UI: conditional components rendering

  • Rockets that have already been reserved should show a "Reserved" badge and "Cancel reservation" button instead of the default "Reserve rocket" (as per design).
  • 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).
  • Rockets/Dragons and Missions should use the React conditional rendering syntax:

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

Phase, 6, Render UI: My Profile section

  • Compose two/three column layout and list ONLY the rockets/dragons reserved and missions joined by the user (as per design):
  • Render a list of all joined missions (use filter()).
  • Render a list of all reserved rockets (use filter()).

Built With

  • Major languages: Javascript
  • Frameworks: React.js, Redux
  • Technologies used: Node.js, Babel, webpack
  • Tested with: - ESLint (JavaScript linting), Stylelint (style linting) Jest (React snapshot testing)

Live Demo

Live demo

Prerequisites

  • Internet connection and browser
  • A text editor(preferably Visual Studio Code)
  • Browser

Setup

Install

Usage

  • Clone the repository using git clone https://github.com/Hombre2014/space-travelers
  • Change directory into the project folder: cd space-travelers
  • Run npm install
  • Run npm start
  • A new browser will open automatically with application loaded

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Deployment

With Netlify

Authors

👤 Charles Gobina

👤 Yuriy Chamkoriyski

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

📝 License

This project is MIT licensed.

About

Small App using real live data from the SpaceX API. Your task is to build a web application for a company that provides commercial and scientific space travel services. The application will allow users to book rockets and join selected space missions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published