diff --git a/components/header.js b/components/header.js index 5951ba474..4ed696ad1 100644 --- a/components/header.js +++ b/components/header.js @@ -30,11 +30,6 @@ export default props => { path: '/', external: false, }, - { - title: 'Events', - path: '/events', - external: false, - }, { title: 'Learn', path: '/learn', @@ -45,10 +40,15 @@ export default props => { path: '/space', external: false, }, + { + title: 'Events', + path: '/events', + external: false, + }, { title: 'Blog', path: 'https://medium.com/coderplex', - external: true, + external: false, }, ]; return ( @@ -134,9 +134,8 @@ export default props => { } .nav__link { text-decoration: none; - text-transform: uppercase; color: #666; - font-size: 12px; + font-size: 14px; padding-bottom: 4px; } .nav__link:hover { diff --git a/components/row-events.js b/components/row-events.js index 6a3ae1bca..258150198 100644 --- a/components/row-events.js +++ b/components/row-events.js @@ -1,10 +1,21 @@ import React from 'react'; -import { Card, Icon } from 'semantic-ui-react'; +import { Card, Icon, Image } from 'semantic-ui-react'; import format from 'date-fns/format'; +import PropTypes from 'prop-types'; + +const extractImageUrl = input => { + const regex = / { return ( - + + {props.description ? ( + + ) : ( +
+ )} {props.name}
@@ -46,4 +57,19 @@ const RowEvent = props => { ); }; +RowEvent.defaultProps = { + fluid: false, +}; + +RowEvent.propTypes = { + fluid: PropTypes.bool, + link: PropTypes.string, + description: PropTypes.string, + name: PropTypes.string, + venue: PropTypes.object, + time: PropTypes.number, + yesCount: PropTypes.number, + status: PropTypes.string, +}; + export default RowEvent; diff --git a/pages/events.js b/pages/events.js index 4643fcf8b..57b73ab02 100644 --- a/pages/events.js +++ b/pages/events.js @@ -65,6 +65,7 @@ class Events extends React.Component { venue={event.venue} link={event.link} status={event.status} + fluid={true} /> ))} @@ -84,6 +85,7 @@ class Events extends React.Component { venue={event.venue} link={event.link} status={event.status} + fluid={true} /> ))} diff --git a/pages/index.js b/pages/index.js index 4023f81ca..4a4c5403f 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,8 +1,69 @@ import React from 'react'; +import Link from 'next/link'; +import { Card, Button, Divider } from 'semantic-ui-react'; +import { indexPageMeetupURL, reverseProxyCORS } from '../utils/urls'; +import RowEvent from '../components/row-events'; import publicPage from '../hocs/public-page'; +const indexPageLearns = [ + { + link: '#', + title: 'ReactJS', + subject: 'Frontend Web Development', + image: '', + }, + { + link: '#', + title: 'Laravel', + subject: 'Backend Web Development', + image: '', + }, + { + link: '#', + title: 'Go', + subject: 'Programming Language', + image: '', + }, + { + link: '#', + title: 'Security', + subject: 'Networking', + image: '', + }, + { + link: '#', + title: 'Blockchain', + subject: 'Distributed Computing', + image: '', + }, + { + link: '#', + title: 'Android', + subject: 'Mobile Development', + image: '', + }, +]; + class Home extends React.Component { + state = { + indexPageEvent: '', + }; + + async componentDidMount() { + try { + const requestEvent = await fetch( + `${reverseProxyCORS}${indexPageMeetupURL}`, + ); + const requestEventJson = await requestEvent.json(); + await this.setState({ + indexPageEvent: requestEventJson[0], + }); + } catch (err) { + console.log(err); + } + } + render() { return (
@@ -10,27 +71,151 @@ class Home extends React.Component {
- words + words +
+

+ On a mission to improve the state of tech in India +

+
+ +
+
+
+

Open Source Learing Guides

+

+ Our guides are crowd-sourced recommendations of free online + resource to learn any technology +

+
+ + {indexPageLearns.map(learn => ( + + ))} + +
+ + + +
+
+ +
+
+

Offline Co-Learning Spaces

+

+ Physical spaces where you can come down to engage in self + learing, peer-learning and collaboration. +

+
+
+ These are dynamic learning environment where everyone learns + at their own pace and compliments each other. We also organize + weekly group activities like Open source evenings, casual + hackathons etc. +
+
+ + + +
+
+ +
+
+

Online & Offline Events

+

+ We do frequent online and offline events, covering broad range + of topics. +

+
+ {this.state.indexPageEvent ? ( + + ) : ( +
+ )} +
+ + +
); diff --git a/scripts/deploy.js b/scripts/deploy.js index 9c4481007..ad756a6ac 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -50,8 +50,6 @@ if (!process.env.CI || !process.env.TRAVIS) { const githubToken = process.env.GH_TOKEN; const nowToken = process.env.NOW_TOKEN; const discordHook = process.env.DISCORD_HOOK; -const prSha = process.env.TRAVIS_PULL_REQUEST_SHA; -const commitSha = process.env.TRAVIS_COMMIT; const repoSlug = process.env.TRAVIS_REPO_SLUG; const aliasUrl = process.env.NOW_ALIAS; @@ -116,7 +114,7 @@ function notifyInDiscord(err, res) { content: buildComment(res.context, res.url, 'https://coderplex.org'), }) .then(() => { - console.log(`Error posted to discord`); + console.log(`Success posted to discord`); }) .catch(console.log.bind(console)); } @@ -128,6 +126,8 @@ function buildComment(context, url, aliasUrl) { } function deploy(context, sha) { + console.log(`context: ${context}`); + console.log(`sha: ${sha}`); if (context === 'staging') { // Send error status to github PR ghRepo.status( @@ -163,7 +163,7 @@ function deploy(context, sha) { // Retrieve now.sh unique url from stdOut const deployedUrl = getUrl(res); - + console.log(`deployedUrl: ${deployedUrl}`); if (context === 'staging') { // Send success status to github PR ghRepo.status( @@ -177,14 +177,12 @@ function deploy(context, sha) { console.log.bind(console), ); // Check and create comment on github PR abot deployment results - if (argv.comment && context === 'staging') { - ghIssue.createComment( - { - body: buildComment(context, deployedUrl), - }, - console.log.bind(console), - ); - } + ghIssue.createComment( + { + body: buildComment(context, deployedUrl), + }, + console.log.bind(console), + ); return; } // In production alias deployment to specified alias url from now.json file or from env variable @@ -207,9 +205,9 @@ travisAfterAll((code, err) => { if (err || code) return; switch (process.env.TRAVIS_EVENT_TYPE) { case 'pull_request': - return deploy('staging', prSha); + return deploy('staging', process.env.TRAVIS_PULL_REQUEST_SHA); case 'push': - return deploy('production', commitSha); + return deploy('production', process.env.TRAVIS_COMMIT); default: break; } diff --git a/static/banner1280x370.png b/static/banner1280x370.png new file mode 100644 index 000000000..d1fb5275e Binary files /dev/null and b/static/banner1280x370.png differ diff --git a/utils/urls.js b/utils/urls.js index 068bd6d45..c6fac13a6 100644 --- a/utils/urls.js +++ b/utils/urls.js @@ -4,4 +4,7 @@ export const pastEventsMeetupURL = export const futureEventsMeetupURL = 'https://api.meetup.com/coderplex/events?only=id%2Cname%2Ctime%2Cyes_rsvp_count%2Cdescription%2Cvenue%2Cstatus%2Clink'; +export const indexPageMeetupURL = + 'https://api.meetup.com/coderplex/events?scroll=future_or_past&photo-host=public&page=1&sig_id=216741149&only=id%2Ctime%2Cyes_rsvp_count%2Cvenue%2Clink%2Cstatus%2Cname%2Cdescription&sig=fabc8645c9e317083cc1f29ff0e8292b88b5e515'; + export const reverseProxyCORS = 'https://cors.now.sh/';