Skip to content

Commit

Permalink
Merge pull request #17 from aj-rom/seperate-neo-concerns
Browse files Browse the repository at this point in the history
Separate neo concerns #8
  • Loading branch information
aj-rom authored Dec 10, 2021
2 parents 509b1df + c189f7b commit 22f0484
Show file tree
Hide file tree
Showing 20 changed files with 368 additions and 289 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

22 changes: 22 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
env:
browser: true
es2021: true
extends:
- "eslint:recommended"
- "next"
- google
parserOptions:
ecmaVersion: 12
sourceType: module
rules:
camelcase: off
linebreak-style: off
object-curly-spacing:
- error
- "always"
require-jsdoc: off
semi: ["error", "never"]
no-invalid-this: off
max-len:
- error
- ignoreStrings: true
25 changes: 23 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
},
"devDependencies": {
"cypress": "^8.7.0",
"eslint": "7.32.0",
"eslint-config-next": "12.0.2"
"eslint": "^7.32.0",
"eslint-config-google": "^0.14.0",
"eslint-config-next": "12.0.2",
"eslint-plugin-react": "^7.27.1"
}
}
14 changes: 7 additions & 7 deletions src/components/Error/Error.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import styles from './Error.module.css'

export default function Error(props) {
const { error } = props
const { error } = props

return (
<div className={styles.error}>
{ error }
</div>
)
}
return (
<div className={styles.error}>
{ error }
</div>
)
}
14 changes: 7 additions & 7 deletions src/components/Footer/Footer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import footerStyles from "./Footer.module.css";
import footerStyles from './Footer.module.css'

export default function Footer() {
return (
<footer className={footerStyles.footer}>
return (
<footer className={footerStyles.footer}>
Made by <a href='https://github.com/aj-rom'>A.J. Romaniello</a> | <a href='https://github.com/aj-rom/neow-browser'>Source Code</a>
<br/>
<br/>
API Services by <a href='https://github.com/SpaceRocks/'>The SpaceRocks Team</a>
</footer>
)
}
</footer>
)
}
15 changes: 7 additions & 8 deletions src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import styles from './Loading.module.css'

export default function Loading() {
return (

return (

<div id='loading' className={styles.center}>
<div className={styles.loading}/>
<p>Loading</p>
</div>
)
}
<div id='loading' className={styles.center}>
<div className={styles.loading}/>
<p>Loading</p>
</div>
)
}
27 changes: 13 additions & 14 deletions src/components/Meta/Meta.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import Head from 'next/head'

export default function Meta(props) {
function getMeta() {
const { meta } = props

function getMeta() {
const { meta } = props
return Object.entries(meta).map( (arr, idx) => {
return <meta key={idx} name={arr[0]} content={arr[1]}/>
})
}

return Object.entries(meta).map( (arr, idx) => {
return <meta key={idx} name={arr[0]} content={arr[1]}/>
})
}

return (
<Head>
<title>NeoW Browser - {props.title}</title>
{getMeta()}
</Head>
)
}
return (
<Head>
<title>NeoW Browser - {props.title}</title>
{getMeta()}
</Head>
)
}
32 changes: 32 additions & 0 deletions src/components/NEO/CloseApproachTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import BootstrapTable from '../Table/Table'

export default function CloseApproachTable(props) {
function renderTableBody() {
return props.data.map((e, idx) => {
return (
<tr key={idx}>
<td>{e.close_approach_date}</td>
<td>{e.orbiting_body}</td>
<td>{e.relative_velocity.kilometers_per_second}</td>
<td>{e.miss_distance.lunar}</td>
</tr>
)
})
}

return (
<BootstrapTable>
<thead>
<tr>
<th>Date</th>
<th>Orbiting</th>
<th>Relative Velocity (km/s)</th>
<th>Miss Distance (lunar)</th>
</tr>
</thead>
<tbody>
{ renderTableBody() }
</tbody>
</BootstrapTable>
)
}
47 changes: 47 additions & 0 deletions src/components/NEO/DiameterTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import BootstrapTable from '../Table/Table'

export default function DiameterTable(props) {
const { feet, meters, kilometers, miles } = props.diameter

function getMin(unit) {
return unit.estimated_diameter_min
}

function getMax(unit) {
return unit.estimated_diameter_max
}

return (
<BootstrapTable>
<thead>
<tr>
<th>Unit</th>
<th>Min</th>
<th>Max</th>
</tr>
</thead>
<tbody>
<tr>
<td>ft</td>
<td>{getMin(feet)}</td>
<td>{getMax(feet)}</td>
</tr>
<tr>
<td>meters</td>
<td>{getMin(meters)}</td>
<td>{getMax(meters)}</td>
</tr>
<tr>
<td>km</td>
<td>{getMin(kilometers)}</td>
<td>{getMax(kilometers)}</td>
</tr>
<tr>
<td>miles</td>
<td>{getMin(miles)}</td>
<td>{getMax(miles)}</td>
</tr>
</tbody>
</BootstrapTable>
)
}
113 changes: 35 additions & 78 deletions src/components/NEO/NEO.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,42 @@
import styles from './NEO.module.css'
import BootstrapTable from "../Table/Table"
import DiameterTable from './DiameterTable'
import CloseApproachTable from './CloseApproachTable'

export default function NEO(props) {
const { data } = props
const {
absolute_magnitude_h,
is_sentry_object,
is_potentially_hazardous_asteroid,
close_approach_data,
estimated_diameter,
} = data

const { data } = props
const diameter = data.estimated_diameter

return (
<article className={styles.neo}>
<header>
<h5 className={styles.h6}>{data.name}</h5>
<p>
return (
<article className={styles.neo}>
<header>
<h5 className={styles.h6}>{data.name}</h5>
<p>
| <a href={data.links.self}>API Response</a> |
</p>
</header>
<details>
<summary>More Info</summary>
<ul>
<li><b>ID</b>: {data.id}</li>
<li><b>Absolute Magnitude</b>: {data.absolute_magnitude_h}</li>
<li><b>Sentry Object</b>: {data.is_sentry_object.toString()}</li>
<li><b>Hazardous</b>: {data.is_potentially_hazardous_asteroid.toString()}</li>
</ul>
</p>
</header>
<details>
<summary>More Info</summary>
<ul>
<li><b>ID</b>: {data.id}</li>
<li><b>Absolute Magnitude</b>: {absolute_magnitude_h}</li>
<li><b>Sentry Object</b>: {is_sentry_object.toString()}</li>
<li>
<b>Hazardous</b>: {is_potentially_hazardous_asteroid.toString()}
</li>
</ul>

<h6 className={styles.h6}>Estimated Diameter</h6>
<BootstrapTable striped bordered hover>
<thead>
<tr>
<th>Unit</th>
<th>Min</th>
<th>Max</th>
</tr>
</thead>
<tbody>
<tr>
<td>ft</td>
<td>{diameter.feet.estimated_diameter_min}</td>
<td>{diameter.feet.estimated_diameter_max}</td>
</tr>
<tr>
<td>meters</td>
<td>{diameter.meters.estimated_diameter_min}</td>
<td>{diameter.meters.estimated_diameter_max}</td>
</tr>
<tr>
<td>km</td>
<td>{diameter.kilometers.estimated_diameter_min}</td>
<td>{diameter.kilometers.estimated_diameter_max}</td>
</tr>
<tr>
<td>miles</td>
<td>{diameter.miles.estimated_diameter_min}</td>
<td>{diameter.miles.estimated_diameter_max}</td>
</tr>
</tbody>
</BootstrapTable>
<h6 className={styles.h6}>Estimated Diameter</h6>
<DiameterTable diameter={estimated_diameter}/>

<h6 className={styles.h6}>Close Approach Data</h6>
<BootstrapTable>
<thead>
<tr>
<th>Date</th>
<th>Orbiting</th>
<th>Relative Velocity (km/s)</th>
<th>Miss Distance (lunar)</th>
</tr>
</thead>
<tbody>
{data.close_approach_data.map((e, idx) => {
return (
<tr key={idx}>
<td>{e.close_approach_date}</td>
<td>{e.orbiting_body}</td>
<td>{e.relative_velocity.kilometers_per_second}</td>
<td>{e.miss_distance.lunar}</td>
</tr>
)
})}
</tbody>
</BootstrapTable>
</details>
</article>
)
}
<h6 className={styles.h6}>Close Approach Data</h6>
<CloseApproachTable data={close_approach_data}/>
</details>
</article>
)
}
Loading

1 comment on commit 22f0484

@vercel
Copy link

@vercel vercel bot commented on 22f0484 Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.