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.

Commit 5b387f7

Browse files
committed
remove login, jobs, projects, profile functionality and pages
1 parent 6f00f81 commit 5b387f7

15 files changed

+30
-2050
lines changed

components/header.js

Lines changed: 8 additions & 54 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',
5650
path: 'https://medium.com/freecodecamp-hyderabad',
51+
external: true,
5752
},
58-
{
59-
title: 'Login/Register',
60-
path: '/login',
61-
},
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;

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.

package.json

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,25 @@
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",
14-
"build": "next build",
15-
"heroku-postbuild": "next build"
12+
"dev": "cross-env NODE_ENV=development next",
13+
"start": "cross-env NODE_ENV=production next start",
14+
"build": "next build"
1615
},
1716
"xo": {
1817
"parser": "babel-eslint",
19-
"extends": [
20-
"prettier",
21-
"prettier/react",
22-
"plugin:react/recommended"
23-
],
24-
"env": [
25-
"browser",
26-
"node"
27-
],
18+
"extends": ["prettier", "prettier/react", "plugin:react/recommended"],
19+
"env": ["browser", "node"],
2820
"rules": {
2921
"linebreak-style": 0,
3022
"react/display-name": 0,
3123
"react/prop-types": 0
3224
},
3325
"space:": 2,
34-
"ignores": [
35-
"next.config.js"
36-
]
26+
"ignores": ["next.config.js"]
3727
},
3828
"lint-staged": {
3929
"*.js": [
@@ -44,22 +34,13 @@
4434
},
4535
"keywords": [],
4636
"author": "Vinay Puppal <[email protected]> (https://www.vinaypuppal.com/)",
47-
"license": "MIT",
37+
"license": "BSD",
4838
"dependencies": {
4939
"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",
5540
"feathers-rest": "^1.8.0",
56-
"isomorphic-unfetch": "^2.0.0",
57-
"js-cookie": "^2.1.4",
5841
"moment": "^2.19.1",
5942
"next": "^4.1.0",
6043
"nprogress": "^0.2.0",
61-
"preact": "^8.2.1",
62-
"preact-compat": "^3.16.0",
6344
"prop-types": "^15.5.10",
6445
"react": "^16.0.0",
6546
"react-count-down": "^1.1.0",
@@ -78,7 +59,6 @@
7859
"eslint-plugin-react": "^7.1.0",
7960
"husky": "^0.14.3",
8061
"lint-staged": "^4.0.2",
81-
"nodemon": "^1.11.0",
8262
"now-travis": "1.0.1",
8363
"prettier": "^1.7.0",
8464
"webpack-bundle-analyzer": "^2.8.3",

0 commit comments

Comments
 (0)