diff --git a/.gitignore b/.gitignore index b997939..fbb2771 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store +.netlify/ npm-debug.log node_modules/ diff --git a/app/screens/Home/index.js b/app/screens/Home/index.js index 5111881..c4bd04a 100644 --- a/app/screens/Home/index.js +++ b/app/screens/Home/index.js @@ -1,5 +1,6 @@ -import React from 'react'; +import React, {useEffect, useState} from 'react'; import {Link} from 'react-router'; +import axios from 'axios'; import moment from 'moment'; import cx from 'classnames'; import constants from 'helpers/constants'; @@ -8,7 +9,6 @@ import About from 'components/About'; import Button from 'components/Button'; import Person from 'components/Person'; import SpeakerData from '../../../api/speakers'; -import Tickets from '../../../api/tickets'; const {Dates} = constants; @@ -34,25 +34,31 @@ const UpcomingDate = ({timestamp, description}) => { ); }; -const TicketCard = ({name, description, price, soldOut}) => { +const TicketCard = ({ticket}) => { + const price = (isNaN(ticket.price) ? '' : '$') + parseInt(ticket.price, 10); + const isOnSale = moment.utc().isAfter(moment.utc(ticket.start_at)); + const buttonLabel = ticket.sold_out + ? 'Sold Out' + : isOnSale + ? 'Buy Now' + : 'Coming Soon'; + return (
{description}
+{ticket.description}