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
Show file tree
Hide file tree
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
use unfeth instead of axios
  • Loading branch information
vinaypuppal committed Oct 18, 2017
commit 156112df5945a8bf5d2eca3d8880dfc4a9bdf7ce
20 changes: 14 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"main": "index.js",
"scripts": {
"test": "xo",
"lint":
"prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write --single-quote --print-width='80' --trailing-comma='all' && xo --fix",
"lint": "prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write --single-quote --print-width='80' --trailing-comma='all' && xo --fix",
"precommit": "lint-staged",
"analyze": "cross-env ANALYZE=1 next build",
"dev": "cross-env NODE_ENV=development next",
Expand All @@ -15,15 +14,24 @@
},
"xo": {
"parser": "babel-eslint",
"extends": ["prettier", "prettier/react", "plugin:react/recommended"],
"env": ["browser", "node"],
"extends": [
"prettier",
"prettier/react",
"plugin:react/recommended"
],
"env": [
"browser",
"node"
],
"rules": {
"linebreak-style": 0,
"react/display-name": 0,
"react/prop-types": 0
},
"space:": 2,
"ignores": ["next.config.js"]
"ignores": [
"next.config.js"
]
},
"lint-staged": {
"*.js": [
Expand All @@ -36,8 +44,8 @@
"author": "Vinay Puppal <[email protected]> (https://www.vinaypuppal.com/)",
"license": "BSD",
"dependencies": {
"axios": "^0.16.2",
"feathers-rest": "^1.8.0",
"isomorphic-unfetch": "2.0.0",
"moment": "^2.19.1",
"next": "^4.1.0",
"nprogress": "^0.2.0",
Expand Down
196 changes: 102 additions & 94 deletions pages/events.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import axios from 'axios';
import fetch from 'isomorphic-unfetch';
import { Card } from 'semantic-ui-react';

import publicPage from '../hocs/public-page';
Expand All @@ -10,100 +10,108 @@ import {
} from '../utils/urls';
import RowEvent from '../components/row-events';

export default publicPage(
class Events extends React.Component {
static async getInitialProps() {
try {
const requestPastEvents = await axios.get(
`${reverseProxyCORS}${pastEventsMeetupURL}`,
);
const requestFutureEvents = await axios.get(
`${reverseProxyCORS}${futureEventsMeetupURL}`,
);
return {
pastEvents: requestPastEvents.data,
futureEvents: requestFutureEvents.data,
};
} catch (err) {
return {
pastEvents: 'err',
futureEvents: 'err',
};
}
class Events extends React.Component {
static async getInitialProps() {
try {
const pastEvents = await fetch(
`${reverseProxyCORS}${pastEventsMeetupURL}`,
).then(res => {
if (res.ok) return res.json();
throw new Error('Failed to Retrieve Events');
});
const futureEvents = await fetch(
`${reverseProxyCORS}${futureEventsMeetupURL}`,
).then(res => {
if (res.ok) return res.json();
throw new Error('Failed to Retrieve Events');
});
return {
pastEvents,
futureEvents,
fetchError: null,
};
} catch (err) {
console.log(err);
return {
pastEvents: null,
futureEvents: null,
fetchError: err.message,
};
}
}

render() {
return (
<div>
<div className="top_banner_root">
<h1 className="top_banner_headline">Events</h1>
<h2>Because you cannot change the world alone</h2>
</div>
<main>
{this.props.pastEvents !== 'err' &&
this.props.futureEvents !== 'err' ? (
render() {
return (
<div>
<div className="top_banner_root">
<h1 className="top_banner_headline">Events</h1>
<h2>Because you cannot change the world alone</h2>
</div>
<main>
{this.props.fetchError ? (
<div>{this.props.fetchError}</div>
) : (
<div>
<h4>Upcoming events</h4>
<div>
<h4>Upcoming events</h4>
<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}
/>
</Card.Group>
))}
</div>
<h4>Recent events</h4>
<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}
/>
</Card.Group>
))}
</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}
/>
</Card.Group>
))}
</div>
) : (
<div>Failed to Retrieve Events</div>
)}
</main>
<style jsx>{`
main {
background-color: #ffffff;
padding-top: 30px;
padding-bottom: 30px;
padding-left: 30px;
padding-right: 30px;
min-height: calc(100vh - 70px);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.top_banner_root {
background-color: #f4f7fb;
min-height: 200px;
text-align: center;
}
.top_banner_headline {
padding-top: 20px;
font-size: 4em;
color: #df1cb5;
font-weight: 900;
}
`}</style>
</div>
);
}
},
);
<h4>Recent events</h4>
<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}
/>
</Card.Group>
))}
</div>
</div>
)}
</main>
<style jsx>{`
main {
background-color: #ffffff;
padding-top: 30px;
padding-bottom: 30px;
padding-left: 30px;
padding-right: 30px;
min-height: calc(100vh - 70px);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.top_banner_root {
background-color: #f4f7fb;
min-height: 200px;
text-align: center;
}
.top_banner_headline {
padding-top: 20px;
font-size: 4em;
color: #df1cb5;
font-weight: 900;
}
`}</style>
</div>
);
}
}

export default publicPage(Events);
26 changes: 10 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,6 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"

axios@^0.16.2:
version "0.16.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d"
dependencies:
follow-redirects "^1.2.3"
is-buffer "^1.1.5"

babel-code-frame@^6.16.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
Expand Down Expand Up @@ -1799,7 +1792,7 @@ dateformat@^1.0.11, dateformat@^1.0.12:
get-stdin "^4.0.1"
meow "^3.3.0"

debug@2, [email protected], debug@^2.1.1, debug@^2.2.0, debug@^2.6.8, debug@^2.6.9:
debug@2, [email protected], debug@^2.1.1, debug@^2.2.0, debug@^2.6.8:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies:
Expand Down Expand Up @@ -2713,12 +2706,6 @@ [email protected]:
debug "^2.2.0"
stream-consume "^0.1.0"

follow-redirects@^1.2.3:
version "1.2.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.5.tgz#ffd3e14cbdd5eaa72f61b6368c1f68516c2a26cc"
dependencies:
debug "^2.6.9"

for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
Expand Down Expand Up @@ -3716,6 +3703,13 @@ isomorphic-fetch@^2.1.1:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-2.0.0.tgz#f50140a4c163d7582b5f37f1591968c4f809a645"
dependencies:
node-fetch "^1.7.1"
unfetch "^3.0.0"

isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
Expand Down Expand Up @@ -4461,7 +4455,7 @@ next@^4.1.0:
write-file-webpack-plugin "4.2.0"
xss-filters "1.2.7"

node-fetch@^1.0.1, node-fetch@^1.6.3:
node-fetch@^1.0.1, node-fetch@^1.6.3, node-fetch@^1.7.1:
version "1.7.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
dependencies:
Expand Down Expand Up @@ -6553,7 +6547,7 @@ underscore.string@~2.2.0rc:
version "2.2.1"
resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-2.2.1.tgz#d7c0fa2af5d5a1a67f4253daee98132e733f0f19"

[email protected]:
[email protected], unfetch@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-3.0.0.tgz#8d1e0513a4ecd0e5ff2d41a6ba77771aae8b6482"

Expand Down