Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Remove user login and profile functionality #24

Merged
merged 23 commits into from
Oct 19, 2017
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6f00f81
integrate now-travis
vinaypuppal Oct 18, 2017
5b387f7
remove login, jobs, projects, profile functionality and pages
vinaypuppal Oct 18, 2017
4212087
remove image load flickering
vinaypuppal Oct 18, 2017
156112d
use unfeth instead of axios
vinaypuppal Oct 18, 2017
1d245f3
merge remote master
vinaypuppal Oct 18, 2017
7c30a16
remove moment.js and use date-fns
vinaypuppal Oct 18, 2017
17d4e89
visually seperate upcoming and past events
vinaypuppal Oct 18, 2017
8920f9b
remove projects page
vinaypuppal Oct 18, 2017
4341505
add travis deploy script
vinaypuppal Oct 18, 2017
c97f7f2
add export map
vinaypuppal Oct 18, 2017
cfa1ee8
move event fetch logic to componentDidMount for static export
vinaypuppal Oct 18, 2017
3af59eb
fix travis error
vinaypuppal Oct 18, 2017
39581c7
fix typo
vinaypuppal Oct 18, 2017
8bbcfda
allow travis to comment with deployed url after build succeded
vinaypuppal Oct 18, 2017
4fd07c6
remove commitId to check if it creates comment
vinaypuppal Oct 18, 2017
715048a
add some debug info for travis logs
vinaypuppal Oct 18, 2017
2c69ae1
test again if comment works from travis
vinaypuppal Oct 18, 2017
b94be17
test again if comment works from travis
vinaypuppal Oct 18, 2017
1e4ee11
add missing in_reply_to field for creating comments
vinaypuppal Oct 18, 2017
9a839e0
test again if comment works from travis
vinaypuppal Oct 18, 2017
41caf4e
test again if comment works from travis
vinaypuppal Oct 18, 2017
2661437
add coderplex-bot and test finally
vinaypuppal Oct 19, 2017
d2a7ebc
update blog url
vinaypuppal Oct 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move event fetch logic to componentDidMount for static export
  • Loading branch information
vinaypuppal committed Oct 18, 2017
commit cfa1ee820d154d43fb5864e18db725913d24d51a
119 changes: 69 additions & 50 deletions pages/events.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import fetch from 'isomorphic-unfetch';
import { Card, Divider } from 'semantic-ui-react';
import { Card, Divider, Dimmer, Loader } from 'semantic-ui-react';

import publicPage from '../hocs/public-page';
import {
Expand All @@ -11,7 +11,13 @@ import {
import RowEvent from '../components/row-events';

class Events extends React.Component {
static async getInitialProps() {
state = {
pastEvents: null,
futureEvents: null,
fetchError: null,
loading: true,
};
async componentDidMount() {
try {
const pastEvents = await fetch(
`${reverseProxyCORS}${pastEventsMeetupURL}`,
Expand All @@ -25,21 +31,72 @@ class Events extends React.Component {
if (res.ok) return res.json();
throw new Error('Failed to Retrieve Events');
});
return {
await this.setState({
pastEvents,
futureEvents,
fetchError: null,
};
loading: false,
});
} catch (err) {
console.log(err);
return {
await this.setState({
pastEvents: null,
futureEvents: null,
fetchError: err.message,
};
loading: false,
});
}
}

renderEvents() {
if (this.state.fetchError) {
return <div>{this.state.fetchError}</div>;
}
return (
<div>
<section>
<h2>Upcoming events</h2>
<div>
{this.state.futureEvents.map(event => (
<Card.Group key={event.id}>
<RowEvent
name={event.name}
yesCount={event.yes_rsvp_count}
time={event.time}
venue={event.venue}
link={event.link}
status={event.status}
/>
</Card.Group>
))}
</div>
</section>
<Divider />
<section>
<h2>Recent events</h2>
<div>
{this.state.pastEvents.map(event => (
<Card.Group key={event.id}>
<RowEvent
key={event.id}
name={event.name}
yesCount={event.yes_rsvp_count}
time={event.time}
venue={event.venue}
link={event.link}
status={event.status}
/>
</Card.Group>
))}
</div>
</section>
<style jsx>{`
section {
margin: 50px 0;
}
`}</style>
</div>
);
}
render() {
return (
<div>
Expand All @@ -48,47 +105,12 @@ class Events extends React.Component {
<h2>Because you cannot change the world alone</h2>
</div>
<main>
{this.props.fetchError ? (
<div>{this.props.fetchError}</div>
{this.state.loading ? (
<Dimmer active>
<Loader indeterminate>Fetching Events</Loader>
</Dimmer>
) : (
<div>
<section>
<h2>Upcoming events</h2>
<div>
{this.props.futureEvents.map(event => (
<Card.Group key={event.id}>
<RowEvent
name={event.name}
yesCount={event.yes_rsvp_count}
time={event.time}
venue={event.venue}
link={event.link}
status={event.status}
/>
</Card.Group>
))}
</div>
</section>
<Divider />
<section>
<h2>Recent events</h2>
<div>
{this.props.pastEvents.map(event => (
<Card.Group key={event.id}>
<RowEvent
key={event.id}
name={event.name}
yesCount={event.yes_rsvp_count}
time={event.time}
venue={event.venue}
link={event.link}
status={event.status}
/>
</Card.Group>
))}
</div>
</section>
</div>
this.renderEvents()
)}
</main>
<style jsx>{`
Expand All @@ -115,9 +137,6 @@ class Events extends React.Component {
color: #df1cb5;
font-weight: 900;
}
section {
margin: 50px 0;
}
`}</style>
</div>
);
Expand Down