Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setuped route and made navbar divided launches screen into 3 parts #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/.vscode

# misc
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1025/142440.801:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
14,068 changes: 14,068 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"leaflet": "^1.7.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-icons": "^3.11.0",

"react-leaflet": "^2.8.0",
"react-particles-js": "^3.4.0",
"react-query": "^2.23.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3"
},
"scripts": {
Expand Down
Binary file added public/home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/home1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#5dbcd2">
<meta name="description" content="Your personal SpaceX console" />
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""
/>
<title>My SpaceX Console</title>
</head>

Expand Down
45 changes: 0 additions & 45 deletions src/App.css

This file was deleted.

50 changes: 37 additions & 13 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import React from 'react';
import logo from './assets/logo.svg';
import './App.css';
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import './css/App.css';
import Home from './screens/home'
import Navbar from './components/navbar'
import Launches from './screens/launches';
import LaunchDetails from './screens/launch-detail';
import LaunchpadMap from './screens/launchpad-map';
import Particles from 'react-particles-js';

function App() {
return (
<div className="App">
<header className="App-header">
<div className="App-logo-container">
<img src={logo} className="App-logo" alt="logo" />
</div>
<h3>WELCOME TO SPACEX CONSOLE</h3>
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
</header>
</div>
<React.StrictMode>
<Router>
<Navbar />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/launches" component={Launches} />

<Route exact path="/launchpad-map" component={LaunchpadMap} />
<Route path='/launches/:id' component={LaunchDetails}/>

</Switch>

</Router>
<div className="par-background"><Particles
height={window.outerHeight}
params={{
particles: {
number: {
value: 50
},
size: {
value: 3
}
},
}}
/>
</div>

</React.StrictMode>
);
}

Expand Down
5 changes: 5 additions & 0 deletions src/api/LatestLaunches.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const getLatestLaunches= async ()=>{
const latestLaunches= await (await fetch('https://api.spacexdata.com/v3/launches/latest')).json();
console.log(latestLaunches);
return latestLaunches;
}
5 changes: 5 additions & 0 deletions src/api/LatestNextLaunch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const getlatestNextLaunches= async ()=>{
const latestNextLaunches= await (await fetch('https://api.spacexdata.com/v3/launches/next')).json();
console.log(latestNextLaunches);
return latestNextLaunches;
}
6 changes: 6 additions & 0 deletions src/api/LaunchDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export const getlatestNextLaunches= async flight_number=>{
const latestNextLaunches= await (await fetch(`https://api.spacexdata.com/v3/launches/${flight_number}`)).json();
console.log(latestNextLaunches);
return latestNextLaunches;
}
5 changes: 5 additions & 0 deletions src/api/LaunchPadMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const getLaunchPadMap= async ()=>{
const latestLaunches= await (await fetch('https://api.spacexdata.com/v4/launchpads')).json();
console.log(latestLaunches);
return latestLaunches;
}
6 changes: 6 additions & 0 deletions src/api/PastLaunchesAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const getPastLaunches= async page=>{
const pastLaunches= await (await fetch(`https://api.spacexdata.com/v4/launches/past`)).json();
console.log(pastLaunches);
return pastLaunches;
}
//?limit=30&offset=${10*(page-1)}`
5 changes: 5 additions & 0 deletions src/api/UpcomingLaunches.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const getUpcomingLaunches= async ()=>{
const upcomingLaunches= await (await fetch('https://api.spacexdata.com/v4/launches/upcoming')).json();

return upcomingLaunches;
}
1 change: 1 addition & 0 deletions src/assets/Asset 5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/assets/logo2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/assets/logo_x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/spacexconsole_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/components/latest-launches.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'
import { getLatestLaunches } from '../api/LatestLaunches'
import { useQuery } from 'react-query';
import '../css/latestLaunches.css'
export default function LatestLaunches() {

const { isLoading, isError, data, }=useQuery('LatestLaunches',getLatestLaunches);
console.log(data);
return (
<div className="launches latest-launches card">
{isLoading &&
<div className="loading-box">
<div className="loading-conponents loading1"></div>
<div className="loading-conponents loading2"></div>
<div className="loading-conponents loading3"></div>


</div>
}
{!isLoading&& !isError && <>
<h1>latest launches</h1>
<p className='latest-launches-title'>{data.mission_name} <span className="new">NEW</span> </p>
<img className='latest-launches-image' src={data.links.mission_patch_small} alt=""/>
<p className="details">{data.details}</p>
</>
}
</div>
)
}
36 changes: 36 additions & 0 deletions src/components/navbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, {useState} from 'react'
import { NavLink,Link } from 'react-router-dom';
import Logo from '../assets/spacexconsole_logo.svg';
import logo from '../assets/logo.svg';
import {FaStream,FaTimesCircle} from 'react-icons/fa'
import '../css/navbar.css'

function Navbar() {

const [clicked, setClicked] = useState(false);

return (
<>
<nav className="navbar ">
<Link to="/" className="logo"><img src={logo} alt=""/><img src={Logo} alt=""/> </Link>
<ul className="nav-links hide-on-phone" id="nav-links">
<li><NavLink exact to="/" className='nav-links'>Home</NavLink></li>
<li><NavLink to="/launches" className='nav-links'>Launches</NavLink></li>
<li><NavLink to="/launchpad-map" className='nav-links'>Launchpad map</NavLink></li>
</ul>
<li className="mob-menue show-on-phone hide" onClick={()=>setClicked(!clicked)}> {clicked?<FaTimesCircle />:<FaStream />}</li>
</nav>
<nav className={clicked ? 'nav-menu active' : 'nav-menu'}>
<ul className='nav-menu-items' onClick={()=>setClicked(!clicked)}>

<li><NavLink exact to="/" className='nav-links'>Home</NavLink></li>
<li><NavLink to="/launches" className='nav-links'>Launches</NavLink></li>
<li><NavLink to="/launchpad-map" className='nav-links'>Launchpad map</NavLink></li>

</ul>
</nav>
</>
)
}

export default Navbar
Loading