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 all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ $RECYCLE.BIN/
# Others
data/
.next/
out/
19 changes: 16 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ sudo: required
dist: trusty
language: node_js
node_js:
- "7.7"
- '8.6'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5
- export PATH="$HOME/.yarn/bin:$PATH"
- 'curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5'
- 'export PATH="$HOME/.yarn/bin:$PATH"'
cache: yarn
after_script:
- >-
yarn export && cd out && NOW_ALIAS=coderplex-app.now.sh node
../scripts/now.js -p
branches:
only:
- master
env:
global:
- secure: >-
nDYIe5Cw1FgD1Iqv2FKRG5Q6Jvvml4ovKPjMRD3BBWinPHe6xbZGtPi0P/Jqt6PFmu5o3aiWQO4ffYnFYUW8N8Tu86RMr0sLQ7Sv6MiE0JxL+7Y+VBZ9h1i9MARiTFQRUw9lrToNa13bnuGy5YNfx4nVUo63vluRTCW6AZd0h01tgEjbhTAamWf1z/n26ACMNJSr2iQ7coakLwpsQvdXMcUe5tAduzoQtLb8DiXdbXO+D7Oepl4dQvOfosa14wW5Z6MN6Y/AxxJ246Cngm3hgZF7IpLCD49H7shXHHSaIcYkJtnSRozKSBEdz34+Jqw+278vcWOA4n2advAhWd2oCAUa0drmu8Nu2Obtrx4oAUQhDwBxfQhbmXpen2Ry5DKp86AurTxgXc+n6bPfjwGdjha2u6cd1fCwpTu5pgnOeX101U/Bu68tAz/EIErCDxHDW/WyrBkVKG3rkABjv3pse4ZJuMy3eeKp+8o2P29b77GHxhKdEw4SvZSfdfnVooABcC6p/sqcumuTvJn20AZkBdhuxGDYSEfNecKPAEHRV8nUQUbMVT7bImQAgl4O4QhHcOfrthbNnQJM94DX0Z2xRQ5sdRmzhe4Ob771EUByNdMO7k2O1KsJAWQ78KhTdOJKoiIp2sH9zRGCTjnTIoCDJx4zBTGHpqV0+R4ltth7T4Q=
- secure: >-
Gj+PgZbNTBJ4C/5WZPjMicUWYJCt+gVnuDNjJCyahqFOOHvTowl3WKoeRwxSf/it9xqW/su6JrehgQixn0OVhkVWL8FVgs5TCvFtFBdYTHTrPIi+2T0sulp/NscsDG2hh3d6WD+AnC4u5QtRkTuh7IZEpLkRTHBwedRhfjvPOQaaT5wZCVMiPrscRhsNHJ4pTl2lEyU0BaLCxWkuAysWw5i7ZhxwtDNZroDuyIqhtJbJIXD9DkPQOuekJGyk+hqXJ7EdtHudltnh4M3Q44799k6n0NQIhjmkF5IZHnZVCKrZh+L0I/xyLU1WbY1uU4fShneryziFzKSAuDobmMC/z/kq/apSbPWuILeY5IMR/33NCz4dcb1bJG5IwCo35NHrqwfxElCkX9L1IyodCVXnZbC5jmwbbqyFHIPlmIUGhRxQyebZrXVGbJe8gHx4aMLpWeDrKL2PqbPOZkwfdDX/sbxhLjChUF6Pr9xFSQ12K/k17peE7KtpHpeIzDs2W0suQlm+/yH9auqUKXrrPp63U61gEY5TQzvBoUa7eTCOxdhTJqFhQw6DmFNDT2Qv06XiSbRt+L+N/EHQDljOADaw+0Z8LbOWa90l8klLIgsNvy8mzPx+kFieLeSh5ShlTguvNBQBK+bsLigc1/5Q3B62HEqLzY8piw+X4SLaHvdTeK8=
64 changes: 9 additions & 55 deletions components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import Headroom from 'react-headroom';
import NProgress from 'nprogress';
import Router from 'next/router';
import Link from 'next/link';
import { Dropdown } from 'semantic-ui-react';

import { logout } from '../utils/authenticate';
import GlobalStyles from './global-styles';
import Head from './head';

Expand All @@ -30,36 +28,29 @@ export default props => {
{
title: 'Home',
path: '/',
external: false,
},
{
title: 'Events',
path: '/events',
external: false,
},
{
title: 'Learn',
path: '/learn',
external: false,
},
{
title: 'Space',
path: '/space',
},
{
title: 'Jobs',
path: '/jobs',
},
{
title: 'Projects',
path: '/projects',
external: false,
},
{
title: 'Blog',
path: 'https://medium.com/freecodecamp-hyderabad',
},
{
title: 'Login/Register',
path: '/login',
path: 'https://medium.com/coderplex',
external: true,
},
].filter(item => (props.username ? item.path !== '/login' : true));
];
return (
<Headroom>
<header>
Expand All @@ -73,44 +64,20 @@ export default props => {
<ul className="nav__links">
{navItems.map(item => {
return (
<li
key={item.title}
className={`nav__linkItem ${item.path === '/login'
? 'login__btn'
: ''}`}
>
<li key={item.title} className="nav__linkItem">
<Link href={item.path}>
<a
className={`nav__link ${props.url.pathname === item.path
? 'nav__link--active'
: ''}`}
target={item.external ? '_blank' : '_self'}
>
{item.title}
</a>
</Link>
</li>
);
})}
{props.username && (
<li className="nav__linkItem">
<img src={props.avatarUrl} alt="avatar_img" />
<Dropdown
inline
text={`${props.username}`}
pointing
className="dropdown__linkItem"
>
<Dropdown.Menu>
<Link href="/profile">
<Dropdown.Item as="a">Profile</Dropdown.Item>
</Link>
<Dropdown.Item onClick={() => logout()}>
Logout
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</li>
)}
</ul>
</nav>
</div>
Expand Down Expand Up @@ -180,19 +147,6 @@ export default props => {
border-bottom: 2px solid #314159;
pointer-events: none;
}
.login__btn .nav__link {
font-weight: bold;
color: #00df90;
}
.login__btn .nav__link:hover {
font-weight: bold;
color: #01bf7c;
}
.login__btn .nav__link--active {
color: #01bf7c;
border-bottom: 2px solid #00df90;
pointer-events: none;
}
@media (max-width: 700px) {
nav {
justify-content: center;
Expand Down
4 changes: 2 additions & 2 deletions components/row-events.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Card, Icon } from 'semantic-ui-react';
import moment from 'moment';
import format from 'date-fns/format';

const RowEvent = props => {
return (
Expand All @@ -16,7 +16,7 @@ const RowEvent = props => {
<Card.Content extra>
<span className="card_icons">
<Icon name="clock" />
{moment(props.time).format("h:mm A, ddd MMM Do 'YY")}
{format(props.time, "h:mm A, ddd MMM Do 'YY")}
</span>
<span className="card_icons">
<Icon name="users" />
Expand Down
28 changes: 1 addition & 27 deletions hocs/public-page.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
import React from 'react';

import redirect from '../utils/redirect';
import { authenticate } from '../utils/authenticate';
import Header from '../components/header';
import Footer from '../components/footer';

export default Page => {
return class PublicPage extends React.Component {
static async getInitialProps(ctx) {
let authData;
let initialProps = {};
const pathName = ctx.req ? ctx.req.url : ctx.pathname;
if (ctx.req && ctx.req.user) {
authData = ctx.req.user;
} else {
try {
authData = await authenticate(ctx);
} catch (err) {
console.error(err);
if (Page.getInitialProps) {
initialProps = await Page.getInitialProps(ctx);
}
return { ...initialProps };
}
}

if (authData) {
if (pathName === '/login') {
return redirect(ctx, '/profile');
}
}
if (Page.getInitialProps) {
initialProps = await Page.getInitialProps(ctx);
}
if (!authData) {
return { ...initialProps };
}
return { ...authData, ...initialProps };
return { ...initialProps };
}
render() {
return (
Expand Down
54 changes: 0 additions & 54 deletions hocs/secret-page.js

This file was deleted.

14 changes: 8 additions & 6 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module.exports = {
webpack: (config, { dev }) => {
/* Enable only in Production */
if (!dev) {
// Preact
console.log('> Using Preact instead of React');
config.resolve.alias = {
react: 'preact-compat/dist/preact-compat',
'react-dom': 'preact-compat/dist/preact-compat',
};
if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
config.plugins.push(
Expand All @@ -23,4 +17,12 @@ module.exports = {
}
return config;
},
exportPathMap() {
return {
'/': { page: '/' },
'/events': { page: '/events' },
'/learn': { page: '/learn' },
'/space': { page: '/space' },
};
},
};
50 changes: 19 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,26 @@
"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 nodemon server.js -w server.js",
"dev:with-api": "cross-env WITH_API=1 nodemon server.js -w server.js",
"start": "cross-env NODE_ENV=production node server",
"dev": "cross-env NODE_ENV=development next",
"start": "cross-env NODE_ENV=production next start",
"build": "next build",
"heroku-postbuild": "next build"
"export": "cross-env NODE_ENV=production yarn build && next export"
},
"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 @@ -44,22 +35,13 @@
},
"keywords": [],
"author": "Vinay Puppal <[email protected]> (https://www.vinaypuppal.com/)",
"license": "MIT",
"license": "BSD",
"dependencies": {
"axios": "^0.16.2",
"cookie-parser": "^1.4.3",
"express": "^4.15.3",
"feathers": "^2.1.7",
"feathers-authentication-client": "^0.3.3",
"feathers-hooks": "^2.0.2",
"date-fns": "1.29.0",
"feathers-rest": "^1.8.0",
"isomorphic-unfetch": "^2.0.0",
"js-cookie": "^2.1.4",
"moment": "^2.19.1",
"isomorphic-unfetch": "2.0.0",
"next": "^4.1.0",
"nprogress": "^0.2.0",
"preact": "^8.2.1",
"preact-compat": "^3.16.0",
"prop-types": "^15.5.10",
"react": "^16.0.0",
"react-count-down": "^1.1.0",
Expand All @@ -74,13 +56,19 @@
"babel-eslint": "^7.2.3",
"babel-plugin-lodash": "^3.2.11",
"cross-env": "^5.0.2",
"cross-spawn": "5.1.0",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-react": "^7.1.0",
"husky": "^0.14.3",
"lint-staged": "^4.0.2",
"nodemon": "^1.11.0",
"normalize-url": "1.9.1",
"now": "8.3.10",
"octonode": "0.9.1",
"prettier": "^1.7.0",
"travis-after-all": "1.4.5",
"url-regex": "4.1.1",
"webpack-bundle-analyzer": "^2.8.3",
"xo": "^0.18.2"
"xo": "^0.18.2",
"yargs": "9.0.1"
}
}
Loading