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

Commit ec75b42

Browse files
vinaypuppalZubair Ahmed
authored andcommitted
Remove user login and profile functionality (#24)
* integrate now-travis * remove login, jobs, projects, profile functionality and pages * remove image load flickering * use unfeth instead of axios * remove moment.js and use date-fns * visually seperate upcoming and past events * remove projects page * add travis deploy script * add export map * move event fetch logic to componentDidMount for static export * fix travis error * fix typo * allow travis to comment with deployed url after build succeded * remove commitId to check if it creates comment * add some debug info for travis logs * test again if comment works from travis * test again if comment works from travis * add missing in_reply_to field for creating comments * test again if comment works from travis * test again if comment works from travis * add coderplex-bot and test finally * update blog url
1 parent ab99348 commit ec75b42

23 files changed

+442
-2198
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,4 @@ $RECYCLE.BIN/
117117
# Others
118118
data/
119119
.next/
120+
out/

.travis.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ sudo: required
22
dist: trusty
33
language: node_js
44
node_js:
5-
- "7.7"
5+
- '8.6'
66
before_install:
7-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5
8-
- export PATH="$HOME/.yarn/bin:$PATH"
7+
- 'curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5'
8+
- 'export PATH="$HOME/.yarn/bin:$PATH"'
99
cache: yarn
10+
after_script:
11+
- >-
12+
yarn export && cd out && NOW_ALIAS=coderplex-app.now.sh node
13+
../scripts/now.js -p
14+
branches:
15+
only:
16+
- master
17+
env:
18+
global:
19+
- secure: >-
20+
nDYIe5Cw1FgD1Iqv2FKRG5Q6Jvvml4ovKPjMRD3BBWinPHe6xbZGtPi0P/Jqt6PFmu5o3aiWQO4ffYnFYUW8N8Tu86RMr0sLQ7Sv6MiE0JxL+7Y+VBZ9h1i9MARiTFQRUw9lrToNa13bnuGy5YNfx4nVUo63vluRTCW6AZd0h01tgEjbhTAamWf1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2Qv06XiSbRt+L+N/EHQDljOADaw+0Z8LbOWa90l8klLIgsNvy8mzPx+kFieLeSh5ShlTguvNBQBK+bsLigc1/5Q3B62HEqLzY8piw+X4SLaHvdTeK8=

components/header.js

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import Headroom from 'react-headroom';
33
import NProgress from 'nprogress';
44
import Router from 'next/router';
55
import Link from 'next/link';
6-
import { Dropdown } from 'semantic-ui-react';
76

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

@@ -30,36 +28,29 @@ export default props => {
3028
{
3129
title: 'Home',
3230
path: '/',
31+
external: false,
3332
},
3433
{
3534
title: 'Events',
3635
path: '/events',
36+
external: false,
3737
},
3838
{
3939
title: 'Learn',
4040
path: '/learn',
41+
external: false,
4142
},
4243
{
4344
title: 'Space',
4445
path: '/space',
45-
},
46-
{
47-
title: 'Jobs',
48-
path: '/jobs',
49-
},
50-
{
51-
title: 'Projects',
52-
path: '/projects',
46+
external: false,
5347
},
5448
{
5549
title: 'Blog',
56-
path: 'https://medium.com/freecodecamp-hyderabad',
57-
},
58-
{
59-
title: 'Login/Register',
60-
path: '/login',
50+
path: 'https://medium.com/coderplex',
51+
external: true,
6152
},
62-
].filter(item => (props.username ? item.path !== '/login' : true));
53+
];
6354
return (
6455
<Headroom>
6556
<header>
@@ -73,44 +64,20 @@ export default props => {
7364
<ul className="nav__links">
7465
{navItems.map(item => {
7566
return (
76-
<li
77-
key={item.title}
78-
className={`nav__linkItem ${item.path === '/login'
79-
? 'login__btn'
80-
: ''}`}
81-
>
67+
<li key={item.title} className="nav__linkItem">
8268
<Link href={item.path}>
8369
<a
8470
className={`nav__link ${props.url.pathname === item.path
8571
? 'nav__link--active'
8672
: ''}`}
73+
target={item.external ? '_blank' : '_self'}
8774
>
8875
{item.title}
8976
</a>
9077
</Link>
9178
</li>
9279
);
9380
})}
94-
{props.username && (
95-
<li className="nav__linkItem">
96-
<img src={props.avatarUrl} alt="avatar_img" />
97-
<Dropdown
98-
inline
99-
text={`${props.username}`}
100-
pointing
101-
className="dropdown__linkItem"
102-
>
103-
<Dropdown.Menu>
104-
<Link href="/profile">
105-
<Dropdown.Item as="a">Profile</Dropdown.Item>
106-
</Link>
107-
<Dropdown.Item onClick={() => logout()}>
108-
Logout
109-
</Dropdown.Item>
110-
</Dropdown.Menu>
111-
</Dropdown>
112-
</li>
113-
)}
11481
</ul>
11582
</nav>
11683
</div>
@@ -180,19 +147,6 @@ export default props => {
180147
border-bottom: 2px solid #314159;
181148
pointer-events: none;
182149
}
183-
.login__btn .nav__link {
184-
font-weight: bold;
185-
color: #00df90;
186-
}
187-
.login__btn .nav__link:hover {
188-
font-weight: bold;
189-
color: #01bf7c;
190-
}
191-
.login__btn .nav__link--active {
192-
color: #01bf7c;
193-
border-bottom: 2px solid #00df90;
194-
pointer-events: none;
195-
}
196150
@media (max-width: 700px) {
197151
nav {
198152
justify-content: center;

components/row-events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { Card, Icon } from 'semantic-ui-react';
3-
import moment from 'moment';
3+
import format from 'date-fns/format';
44

55
const RowEvent = props => {
66
return (
@@ -16,7 +16,7 @@ const RowEvent = props => {
1616
<Card.Content extra>
1717
<span className="card_icons">
1818
<Icon name="clock" />
19-
{moment(props.time).format("h:mm A, ddd MMM Do 'YY")}
19+
{format(props.time, "h:mm A, ddd MMM Do 'YY")}
2020
</span>
2121
<span className="card_icons">
2222
<Icon name="users" />

hocs/public-page.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
11
import React from 'react';
22

3-
import redirect from '../utils/redirect';
4-
import { authenticate } from '../utils/authenticate';
53
import Header from '../components/header';
64
import Footer from '../components/footer';
75

86
export default Page => {
97
return class PublicPage extends React.Component {
108
static async getInitialProps(ctx) {
11-
let authData;
129
let initialProps = {};
13-
const pathName = ctx.req ? ctx.req.url : ctx.pathname;
14-
if (ctx.req && ctx.req.user) {
15-
authData = ctx.req.user;
16-
} else {
17-
try {
18-
authData = await authenticate(ctx);
19-
} catch (err) {
20-
console.error(err);
21-
if (Page.getInitialProps) {
22-
initialProps = await Page.getInitialProps(ctx);
23-
}
24-
return { ...initialProps };
25-
}
26-
}
27-
28-
if (authData) {
29-
if (pathName === '/login') {
30-
return redirect(ctx, '/profile');
31-
}
32-
}
3310
if (Page.getInitialProps) {
3411
initialProps = await Page.getInitialProps(ctx);
3512
}
36-
if (!authData) {
37-
return { ...initialProps };
38-
}
39-
return { ...authData, ...initialProps };
13+
return { ...initialProps };
4014
}
4115
render() {
4216
return (

hocs/secret-page.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

next.config.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ module.exports = {
44
webpack: (config, { dev }) => {
55
/* Enable only in Production */
66
if (!dev) {
7-
// Preact
8-
console.log('> Using Preact instead of React');
9-
config.resolve.alias = {
10-
react: 'preact-compat/dist/preact-compat',
11-
'react-dom': 'preact-compat/dist/preact-compat',
12-
};
137
if (ANALYZE) {
148
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
159
config.plugins.push(
@@ -23,4 +17,12 @@ module.exports = {
2317
}
2418
return config;
2519
},
20+
exportPathMap() {
21+
return {
22+
'/': { page: '/' },
23+
'/events': { page: '/events' },
24+
'/learn': { page: '/learn' },
25+
'/space': { page: '/space' },
26+
};
27+
},
2628
};

package.json

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,26 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "xo",
8-
"lint": "prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write --single-quote --print-width='80' --trailing-comma='all' && xo --fix",
8+
"lint":
9+
"prettier 'utils/**/*.js' 'components/**/*.js' 'pages/**/*.js' 'lib/**/*.js' 'hocs/**/*.js' '*.js' --write --single-quote --print-width='80' --trailing-comma='all' && xo --fix",
910
"precommit": "lint-staged",
1011
"analyze": "cross-env ANALYZE=1 next build",
11-
"dev": "cross-env NODE_ENV=development nodemon server.js -w server.js",
12-
"dev:with-api": "cross-env WITH_API=1 nodemon server.js -w server.js",
13-
"start": "cross-env NODE_ENV=production node server",
12+
"dev": "cross-env NODE_ENV=development next",
13+
"start": "cross-env NODE_ENV=production next start",
1414
"build": "next build",
15-
"heroku-postbuild": "next build"
15+
"export": "cross-env NODE_ENV=production yarn build && next export"
1616
},
1717
"xo": {
1818
"parser": "babel-eslint",
19-
"extends": [
20-
"prettier",
21-
"prettier/react",
22-
"plugin:react/recommended"
23-
],
24-
"env": [
25-
"browser",
26-
"node"
27-
],
19+
"extends": ["prettier", "prettier/react", "plugin:react/recommended"],
20+
"env": ["browser", "node"],
2821
"rules": {
2922
"linebreak-style": 0,
3023
"react/display-name": 0,
3124
"react/prop-types": 0
3225
},
3326
"space:": 2,
34-
"ignores": [
35-
"next.config.js"
36-
]
27+
"ignores": ["next.config.js"]
3728
},
3829
"lint-staged": {
3930
"*.js": [
@@ -44,22 +35,13 @@
4435
},
4536
"keywords": [],
4637
"author": "Vinay Puppal <me@vinaypuppal.com> (https://www.vinaypuppal.com/)",
47-
"license": "MIT",
38+
"license": "BSD",
4839
"dependencies": {
49-
"axios": "^0.16.2",
50-
"cookie-parser": "^1.4.3",
51-
"express": "^4.15.3",
52-
"feathers": "^2.1.7",
53-
"feathers-authentication-client": "^0.3.3",
54-
"feathers-hooks": "^2.0.2",
40+
"date-fns": "1.29.0",
5541
"feathers-rest": "^1.8.0",
56-
"isomorphic-unfetch": "^2.0.0",
57-
"js-cookie": "^2.1.4",
58-
"moment": "^2.19.1",
42+
"isomorphic-unfetch": "2.0.0",
5943
"next": "^4.1.0",
6044
"nprogress": "^0.2.0",
61-
"preact": "^8.2.1",
62-
"preact-compat": "^3.16.0",
6345
"prop-types": "^15.5.10",
6446
"react": "^16.0.0",
6547
"react-count-down": "^1.1.0",
@@ -74,13 +56,19 @@
7456
"babel-eslint": "^7.2.3",
7557
"babel-plugin-lodash": "^3.2.11",
7658
"cross-env": "^5.0.2",
59+
"cross-spawn": "5.1.0",
7760
"eslint-config-prettier": "^2.3.0",
7861
"eslint-plugin-react": "^7.1.0",
7962
"husky": "^0.14.3",
8063
"lint-staged": "^4.0.2",
81-
"nodemon": "^1.11.0",
64+
"normalize-url": "1.9.1",
65+
"now": "8.3.10",
66+
"octonode": "0.9.1",
8267
"prettier": "^1.7.0",
68+
"travis-after-all": "1.4.5",
69+
"url-regex": "4.1.1",
8370
"webpack-bundle-analyzer": "^2.8.3",
84-
"xo": "^0.18.2"
71+
"xo": "^0.18.2",
72+
"yargs": "9.0.1"
8573
}
8674
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy