From 2a0ba501e06f946c0c82992dfa4457c84befa630 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 17 Dec 2018 11:47:51 -0800 Subject: feature(website): implement loading jobs from greenhouse in jobs page --- packages/website/ts/@next/pages/about/jobs.tsx | 248 +++++++++++++++---------- 1 file changed, 149 insertions(+), 99 deletions(-) diff --git a/packages/website/ts/@next/pages/about/jobs.tsx b/packages/website/ts/@next/pages/about/jobs.tsx index e4a9bb1ad..1e9d54609 100644 --- a/packages/website/ts/@next/pages/about/jobs.tsx +++ b/packages/website/ts/@next/pages/about/jobs.tsx @@ -3,9 +3,12 @@ import * as React from 'react'; import styled from 'styled-components'; import { AboutPageLayout } from 'ts/@next/components/aboutPageLayout'; -import { Link } from 'ts/@next/components/link'; import { Column, FlexWrap, Section } from 'ts/@next/components/newLayout'; import { Heading, Paragraph } from 'ts/@next/components/text'; +import { WebsiteBackendJobInfo } from 'ts/types'; +import { backendClient } from 'ts/utils/backend_client'; + +const OPEN_POSITIONS_HASH = 'positions'; interface PositionProps { title: string; @@ -17,118 +20,165 @@ interface PositionItemProps { position: PositionProps; } -const positions: PositionProps[] = [ - { - title: 'Product Designer', - location: 'San Francisco, Remote', - href: '#', - }, - { - title: 'Product Designer', - location: 'San Francisco, Remote', - href: '#', - }, - { - title: 'Product Designer', - location: 'San Francisco, Remote', - href: '#', - }, - { - title: 'Open Positition', - location: "We're always interested in talking to talented people. Send us an application if you think you're the right fit.", - href: '#', - }, -]; - -export const NextAboutJobs = () => ( - - - To create a tokenized world where all value can flow freely. - - - We are growing an ecosystem of businesses and projects by solving difficult challenges to make our technology intuitive, flexible, and accessible to all. Join us in building infrastructure upon which the exchange of all assets will take place. - - - } - linkLabel="Our mission and values" - linkUrl="/about/mission" - > -
- - - Powered by a Diverse, Global Community - - - - We're a highly technical team with varied backgrounds in engineering, science, business, finance, and research. While the Core Team is headquartered in San Francisco, there are 30+ teams building on 0x and hundreds of thousands of participants behind our efforts worldwide. We're passionate about open-source software and decentralized technology's potential to act as an equalizing force in the world. - - - - - - Map of community - - -
- -
- - Benefits - - - - -
  • Comprehensive Insurance
  • -
  • Unlimited Vacation
  • -
  • Meals and snacks provided daily
  • -
  • Flexible hours and liberal work-from-home-policy
  • -
  • Supportive of remote working
  • -
  • Transportation, phone, and wellness expense
  • -
  • Relocation assistance
  • -
  • Optional team excursions
  • -
  • Competitive salary
  • -
  • Cryptocurrency based compensation
  • -
    -
    -
    - -
    - - Current
    Openings
    -
    - - - - {_.map(positions, (position, index) => ( - - ))} - -
    -
    -); - -export const Position: React.FunctionComponent = (props: PositionItemProps) => { +const Position: React.FunctionComponent = (props: PositionItemProps) => { const { position } = props; return ( - {position.title} + + + {position.title} + + - {position.location} + + {position.location} + - Apply + + + Apply + + ); }; +export interface NextAboutJobsProps {} +interface NextAboutJobsState { + jobInfos: WebsiteBackendJobInfo[]; +} + +export class NextAboutJobs extends React.Component { + private _isUnmounted: boolean; + private static _convertJobInfoToPositionProps(jobInfo: WebsiteBackendJobInfo): PositionProps { + return { + title: jobInfo.title, + location: jobInfo.office, + href: jobInfo.url, + }; + } + constructor(props: NextAboutJobsProps) { + super(props); + this.state = { + jobInfos: [], + }; + } + + public componentWillMount(): void { + // tslint:disable-next-line:no-floating-promises + this._fetchJobInfosAsync(); + } + public componentWillUnmount(): void { + this._isUnmounted = true; + } + public render(): React.ReactNode { + const positions = this.state.jobInfos.map(jobInfo => NextAboutJobs._convertJobInfoToPositionProps(jobInfo)); + return ( + + + To create a tokenized world where all value can flow freely. + + + We are growing an ecosystem of businesses and projects by solving difficult challenges to + make our technology intuitive, flexible, and accessible to all. Join us in building + infrastructure upon which the exchange of all assets will take place. + + + } + linkLabel="Our mission and values" + linkUrl="/about/mission" + > +
    + + + Powered by a Diverse, Global Community + + + + We're a highly technical team with varied backgrounds in engineering, science, business, + finance, and research. While the Core Team is headquartered in San Francisco, there are 30+ + teams building on 0x and hundreds of thousands of participants behind our efforts worldwide. + We're passionate about open-source software and decentralized technology's potential to act + as an equalizing force in the world. + + + + + + Map of community + + +
    + +
    + + Benefits + + + + +
  • Comprehensive Insurance
  • +
  • Unlimited Vacation
  • +
  • Meals and snacks provided daily
  • +
  • Flexible hours and liberal work-from-home-policy
  • +
  • Supportive of remote working
  • +
  • Transportation, phone, and wellness expense
  • +
  • Relocation assistance
  • +
  • Optional team excursions
  • +
  • Competitive salary
  • +
  • Cryptocurrency based compensation
  • +
    +
    +
    + +
    + + + Current
    Openings +
    +
    + + + {_.map(positions, (position, index) => ( + + ))} + +
    +
    + ); + } + private async _fetchJobInfosAsync(): Promise { + try { + if (!this._isUnmounted) { + this.setState({ + jobInfos: [], + }); + } + const jobInfos = await backendClient.getJobInfosAsync(); + if (!this._isUnmounted) { + this.setState({ + jobInfos, + }); + } + } catch (error) { + if (!this._isUnmounted) { + this.setState({ + jobInfos: [], + }); + } + } + } +} + const BenefitsList = styled.ul` color: #000; font-weight: 300; @@ -173,6 +223,6 @@ const PositionWrap = styled(FlexWrap)` bottom: 0; left: 0; height: 1px; - background-color: #E3E3E3; + background-color: #e3e3e3; } `; -- cgit