{"size": 1174, "ext": "js", "max_stars_repo_path": "src/components/pages/Status.js", "max_stars_repo_name": "therise3107/falcon-frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/pages/Status.js", "max_issues_repo_name": "therise3107/falcon-frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/pages/Status.js", "max_forks_repo_name": "therise3107/falcon-frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.9591836735, "max_line_length": 98, "alphanum_fraction": 0.5212947189}
import React, { Fragment } from 'react'
import { Redirect } from 'react-router-dom'

import Button from '../buttons/Button'
import Headline from '../typography/Headline'
import Flex from '../Flex'
import Spacer from '../Spacer'

const Status = ({ location }) => {
  const { state } = location

  if (!state) {
    return <Redirect to="/" />
  }

  const { planetName, status } = state

  return (
    <Flex reversed justify="center">
      {
        status === 'success' && (
          <Fragment>
            <Headline as="h1" size="lg">
              Success! Congratulations on Finding Falcon. King Shan is mighty pleased.
            </Headline>
            <Spacer height={20} />
            <Headline as="h2" size="lg">
              Planet found:
              {' '}
              {planetName}
            </Headline>
          </Fragment>
        )
      }
      {
        status === 'false' && (
          <Headline>Failure! You failed the task of Finding Falcon. King Shan is angry.</Headline>
        )
      }
      <Spacer height={30} />
      <a href="/">
        <Button type="button" label="Start again" />
      </a>
    </Flex>
  )
}

export default Status
