├── .github └── CODE_OF_CONDUCT.md ├── .gitignore ├── .prettierrc ├── .snyk ├── .travis.yml ├── LICENSE ├── README.md ├── commitlint.config.js ├── gatsby-browser.js ├── gatsby-config.js ├── gatsby-node.js ├── gatsby-ssr.js ├── package.json ├── src ├── components │ ├── Header │ │ └── index.js │ └── Nav.js ├── layouts │ ├── index.css │ └── index.js ├── pages │ ├── 404.js │ ├── callback.js │ └── index.js └── utils │ └── auth.js └── yarn.lock /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at team@freecodecamp.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Project dependencies 2 | .cache 3 | node_modules 4 | yarn-error.log 5 | 6 | # Build directory 7 | /public 8 | 9 | # Lock files 10 | package-lock.json 11 | 12 | # Others 13 | .env.* 14 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /.snyk: -------------------------------------------------------------------------------- 1 | # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. 2 | version: v1.10.2 3 | # ignores vulnerabilities until expiry date; change duration by modifying expiry date 4 | ignore: 5 | 'npm:braces:20180219': 6 | - gatsby > webpack-dev-server > http-proxy-middleware > micromatch > braces: 7 | reason: None given 8 | expires: '2018-05-05T22:36:49.728Z' 9 | - gatsby > chokidar > anymatch > micromatch > braces: 10 | reason: None given 11 | expires: '2018-05-05T22:36:49.728Z' 12 | - gatsby > webpack-validator > find-node-modules > findup-sync > micromatch > braces: 13 | reason: None given 14 | expires: '2018-05-05T22:36:49.728Z' 15 | - gatsby > webpack > watchpack > chokidar > anymatch > micromatch > braces: 16 | reason: None given 17 | expires: '2018-05-05T22:36:49.729Z' 18 | - gatsby > postcss-import > pkg-resolve > jspm > sane > anymatch > micromatch > braces: 19 | reason: None given 20 | expires: '2018-05-05T22:36:49.729Z' 21 | 'npm:hoek:20180212': 22 | - gatsby > chokidar > fsevents > node-pre-gyp > hawk > hoek: 23 | reason: None given 24 | expires: '2018-05-05T22:36:49.729Z' 25 | - gatsby > chokidar > fsevents > node-pre-gyp > hawk > boom > hoek: 26 | reason: None given 27 | expires: '2018-05-05T22:36:49.729Z' 28 | - gatsby > chokidar > fsevents > node-pre-gyp > hawk > sntp > hoek: 29 | reason: None given 30 | expires: '2018-05-05T22:36:49.729Z' 31 | - gatsby > chokidar > fsevents > node-pre-gyp > hawk > cryptiles > boom > hoek: 32 | reason: None given 33 | expires: '2018-05-05T22:36:49.729Z' 34 | - gatsby > chokidar > fsevents > node-pre-gyp > request > hawk > hoek: 35 | reason: None given 36 | expires: '2018-05-05T22:36:49.729Z' 37 | - gatsby > chokidar > fsevents > node-pre-gyp > request > hawk > boom > hoek: 38 | reason: None given 39 | expires: '2018-05-05T22:36:49.729Z' 40 | - gatsby > chokidar > fsevents > node-pre-gyp > request > hawk > sntp > hoek: 41 | reason: None given 42 | expires: '2018-05-05T22:36:49.729Z' 43 | - gatsby > chokidar > fsevents > node-pre-gyp > request > hawk > cryptiles > boom > hoek: 44 | reason: None given 45 | expires: '2018-05-05T22:36:49.730Z' 46 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > hawk > hoek: 47 | reason: None given 48 | expires: '2018-05-05T22:36:49.730Z' 49 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > hawk > boom > hoek: 50 | reason: None given 51 | expires: '2018-05-05T22:36:49.730Z' 52 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > hawk > sntp > hoek: 53 | reason: None given 54 | expires: '2018-05-05T22:36:49.730Z' 55 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > hawk > cryptiles > boom > hoek: 56 | reason: None given 57 | expires: '2018-05-05T22:36:49.730Z' 58 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > request > hawk > hoek: 59 | reason: None given 60 | expires: '2018-05-05T22:36:49.730Z' 61 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > request > hawk > boom > hoek: 62 | reason: None given 63 | expires: '2018-05-05T22:36:49.730Z' 64 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > request > hawk > sntp > hoek: 65 | reason: None given 66 | expires: '2018-05-05T22:36:49.730Z' 67 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > request > hawk > cryptiles > boom > hoek: 68 | reason: None given 69 | expires: '2018-05-05T22:36:49.730Z' 70 | 'npm:lodash:20180130': 71 | - gatsby > webpack-configurator > lodash: 72 | reason: None given 73 | expires: '2018-05-05T22:36:49.730Z' 74 | - gatsby > webpack-validator > lodash: 75 | reason: None given 76 | expires: '2018-05-05T22:36:49.730Z' 77 | 'npm:mime:20170907': 78 | - gatsby > url-loader > mime: 79 | reason: None given 80 | expires: '2018-05-05T22:36:49.730Z' 81 | 'npm:shelljs:20140723': 82 | - gatsby > webpack-validator > shelljs: 83 | reason: None given 84 | expires: '2018-05-05T22:36:49.730Z' 85 | 'npm:ws:20171108': 86 | - gatsby > remote-redux-devtools > socketcluster-client > ws: 87 | reason: None given 88 | expires: '2018-05-05T22:36:49.730Z' 89 | # patches apply the minimum changes required to fix a vulnerability 90 | patch: 91 | 'npm:debug:20170905': 92 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > tar-pack > debug: 93 | patched: '2018-04-05T22:34:09.819Z' 94 | - gatsby > chokidar > fsevents > node-pre-gyp > tar-pack > debug: 95 | patched: '2018-04-05T22:34:09.819Z' 96 | 'npm:tough-cookie:20170905': 97 | - gatsby > webpack > watchpack > chokidar > fsevents > node-pre-gyp > request > tough-cookie: 98 | patched: '2018-04-05T22:34:09.819Z' 99 | - gatsby > chokidar > fsevents > node-pre-gyp > request > tough-cookie: 100 | patched: '2018-04-05T22:34:09.819Z' 101 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: node_js 4 | node_js: 5 | - "lts/*" 6 | cache: 7 | yarn: true 8 | directories: 9 | - "node_modules" 10 | 11 | script: 12 | - commitlint-travis 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, freeCodeCamp 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![freeCodeCamp](https://camo.githubusercontent.com/60c67cf9ac2db30d478d21755289c423e1f985c6/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f66726565636f646563616d702f776964652d736f6369616c2d62616e6e65722e706e67) 2 | 3 | [![Build Status](https://travis-ci.org/freeCodeCamp/open-api.svg?branch=staging)](https://travis-ci.org/freeCodeCamp/open-api) 4 | 5 | # events 6 | 7 | **Notice:** 8 | 9 | This repository has been archived in favor of the same available in the monorepo at 10 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {extends: ['@commitlint/config-conventional']}; 2 | -------------------------------------------------------------------------------- /gatsby-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Browser APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/browser-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it -------------------------------------------------------------------------------- /gatsby-config.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ 2 | path: `.env.${process.env.NODE_ENV}` 3 | }); 4 | 5 | module.exports = { 6 | siteMetadata: { 7 | title: 'freeCodeCamp Events', 8 | }, 9 | plugins: ['gatsby-plugin-react-helmet'], 10 | }; 11 | -------------------------------------------------------------------------------- /gatsby-node.js: -------------------------------------------------------------------------------- 1 | exports.modifyWebpackConfig = ({ config, stage }) => { 2 | switch (stage) { 3 | case "build-html": 4 | config.plugin('define', webpack.DefinePlugin, [ { "global.GENTLY": false } ]); 5 | 6 | break; 7 | } 8 | 9 | return config; 10 | }; 11 | -------------------------------------------------------------------------------- /gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/ssr-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "freecodecamp-events", 3 | "private": true, 4 | "description": "freeCodeCamp Events", 5 | "version": "1.0.0", 6 | "author": "freeCodeCamp (https://freecodecamp.org)", 7 | "dependencies": { 8 | "auth0-js": "^9.4.2", 9 | "dotenv": "^5.0.1", 10 | "gatsby": "^1.9.241", 11 | "gatsby-link": "^1.6.39", 12 | "gatsby-plugin-react-helmet": "^2.0.8", 13 | "react-helmet": "^5.2.0", 14 | "snyk": "^1.70.3" 15 | }, 16 | "keywords": [ 17 | "gatsby" 18 | ], 19 | "license": "BSD-3-Clause", 20 | "scripts": { 21 | "build": "gatsby build", 22 | "develop": "gatsby develop", 23 | "format": "prettier --write 'src/**/*.js'", 24 | "test": "echo \"Error: no test specified\" && exit 1", 25 | "commitmsg": "commitlint -e", 26 | "commit": "git-cz", 27 | "prepare-production": "snyk protect" 28 | }, 29 | "devDependencies": { 30 | "@commitlint/cli": "^6.1.3", 31 | "@commitlint/config-conventional": "^6.1.3", 32 | "@commitlint/travis-cli": "^6.1.3", 33 | "commitizen": "^2.9.6", 34 | "husky": "^0.14.3", 35 | "prettier": "^1.11.1" 36 | }, 37 | "repository": { 38 | "type": "git", 39 | "url": "git+https://github.com/freeCodeCamp/events.git" 40 | }, 41 | "bugs": { 42 | "url": "https://github.com/freeCodeCamp/events/issues" 43 | }, 44 | "homepage": "https://github.com/freeCodeCamp/events#readme", 45 | "snyk": true 46 | } 47 | -------------------------------------------------------------------------------- /src/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from 'gatsby-link' 3 | 4 | const Header = () => ( 5 |
11 |
18 |

19 | 26 | freeCodeCamp Events 27 | 28 |

29 |
30 |
31 | ) 32 | 33 | export default Header 34 | -------------------------------------------------------------------------------- /src/components/Nav.js: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | import Auth from '../utils/auth'; 4 | 5 | const auth = new Auth(); 6 | 7 | export default class Nav extends React.Component { 8 | constructor(props) { 9 | super(props); 10 | this.state = { 11 | authenticated: false 12 | }; 13 | } 14 | 15 | login() { 16 | auth.login(); 17 | 18 | this.setState({ 19 | authenticated: auth.isAuthenticated() 20 | }); 21 | } 22 | 23 | logout() { 24 | auth.logout(); 25 | 26 | this.setState({ 27 | authenticated: auth.isAuthenticated() 28 | }); 29 | } 30 | 31 | componentDidMount() { 32 | this.setState({ 33 | authenticated: auth.isAuthenticated() 34 | }); 35 | } 36 | 37 | render() { 38 | return ( 39 |
45 |
50 | 56 | Home 57 | 58 | | 59 | { 60 | !this.state.authenticated && ( 61 | 62 | 69 | Log In 70 | 71 | 72 | ) 73 | } 74 | { 75 | this.state.authenticated && ( 76 | 77 | 84 | Log Out 85 | { 86 | auth.getUserName() && ( 87 | ({auth.getUserName()}) 88 | ) 89 | } 90 | 91 | 92 | ) 93 | } 94 |
95 |
96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/layouts/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family: sans-serif; 3 | -ms-text-size-adjust: 100%; 4 | -webkit-text-size-adjust: 100%; 5 | } 6 | body { 7 | margin: 0; 8 | } 9 | article, 10 | aside, 11 | details, 12 | figcaption, 13 | figure, 14 | footer, 15 | header, 16 | main, 17 | menu, 18 | nav, 19 | section, 20 | summary { 21 | display: block; 22 | } 23 | audio, 24 | canvas, 25 | progress, 26 | video { 27 | display: inline-block; 28 | } 29 | audio:not([controls]) { 30 | display: none; 31 | height: 0; 32 | } 33 | progress { 34 | vertical-align: baseline; 35 | } 36 | [hidden], 37 | template { 38 | display: none; 39 | } 40 | a { 41 | background-color: transparent; 42 | -webkit-text-decoration-skip: objects; 43 | } 44 | a:active, 45 | a:hover { 46 | outline-width: 0; 47 | } 48 | abbr[title] { 49 | border-bottom: none; 50 | text-decoration: underline; 51 | text-decoration: underline dotted; 52 | } 53 | b, 54 | strong { 55 | font-weight: inherit; 56 | font-weight: bolder; 57 | } 58 | dfn { 59 | font-style: italic; 60 | } 61 | h1 { 62 | font-size: 2em; 63 | margin: .67em 0; 64 | } 65 | mark { 66 | background-color: #ff0; 67 | color: #000; 68 | } 69 | small { 70 | font-size: 80%; 71 | } 72 | sub, 73 | sup { 74 | font-size: 75%; 75 | line-height: 0; 76 | position: relative; 77 | vertical-align: baseline; 78 | } 79 | sub { 80 | bottom: -.25em; 81 | } 82 | sup { 83 | top: -.5em; 84 | } 85 | img { 86 | border-style: none; 87 | } 88 | svg:not(:root) { 89 | overflow: hidden; 90 | } 91 | code, 92 | kbd, 93 | pre, 94 | samp { 95 | font-family: monospace, monospace; 96 | font-size: 1em; 97 | } 98 | figure { 99 | margin: 1em 40px; 100 | } 101 | hr { 102 | box-sizing: content-box; 103 | height: 0; 104 | overflow: visible; 105 | } 106 | button, 107 | input, 108 | optgroup, 109 | select, 110 | textarea { 111 | font: inherit; 112 | margin: 0; 113 | } 114 | optgroup { 115 | font-weight: 700; 116 | } 117 | button, 118 | input { 119 | overflow: visible; 120 | } 121 | button, 122 | select { 123 | text-transform: none; 124 | } 125 | [type=reset], 126 | [type=submit], 127 | button, 128 | html [type=button] { 129 | -webkit-appearance: button; 130 | } 131 | [type=button]::-moz-focus-inner, 132 | [type=reset]::-moz-focus-inner, 133 | [type=submit]::-moz-focus-inner, 134 | button::-moz-focus-inner { 135 | border-style: none; 136 | padding: 0; 137 | } 138 | [type=button]:-moz-focusring, 139 | [type=reset]:-moz-focusring, 140 | [type=submit]:-moz-focusring, 141 | button:-moz-focusring { 142 | outline: 1px dotted ButtonText; 143 | } 144 | fieldset { 145 | border: 1px solid silver; 146 | margin: 0 2px; 147 | padding: .35em .625em .75em; 148 | } 149 | legend { 150 | box-sizing: border-box; 151 | color: inherit; 152 | display: table; 153 | max-width: 100%; 154 | padding: 0; 155 | white-space: normal; 156 | } 157 | textarea { 158 | overflow: auto; 159 | } 160 | [type=checkbox], 161 | [type=radio] { 162 | box-sizing: border-box; 163 | padding: 0; 164 | } 165 | [type=number]::-webkit-inner-spin-button, 166 | [type=number]::-webkit-outer-spin-button { 167 | height: auto; 168 | } 169 | [type=search] { 170 | -webkit-appearance: textfield; 171 | outline-offset: -2px; 172 | } 173 | [type=search]::-webkit-search-cancel-button, 174 | [type=search]::-webkit-search-decoration { 175 | -webkit-appearance: none; 176 | } 177 | ::-webkit-input-placeholder { 178 | color: inherit; 179 | opacity: .54; 180 | } 181 | ::-webkit-file-upload-button { 182 | -webkit-appearance: button; 183 | font: inherit; 184 | } 185 | html { 186 | font: 112.5%/1.45em georgia, serif; 187 | box-sizing: border-box; 188 | overflow-y: scroll; 189 | } 190 | * { 191 | box-sizing: inherit; 192 | } 193 | *:before { 194 | box-sizing: inherit; 195 | } 196 | *:after { 197 | box-sizing: inherit; 198 | } 199 | body { 200 | color: hsla(0, 0%, 0%, 0.8); 201 | font-family: georgia, serif; 202 | font-weight: normal; 203 | word-wrap: break-word; 204 | font-kerning: normal; 205 | -moz-font-feature-settings: "kern", "liga", "clig", "calt"; 206 | -ms-font-feature-settings: "kern", "liga", "clig", "calt"; 207 | -webkit-font-feature-settings: "kern", "liga", "clig", "calt"; 208 | font-feature-settings: "kern", "liga", "clig", "calt"; 209 | } 210 | img { 211 | max-width: 100%; 212 | margin-left: 0; 213 | margin-right: 0; 214 | margin-top: 0; 215 | padding-bottom: 0; 216 | padding-left: 0; 217 | padding-right: 0; 218 | padding-top: 0; 219 | margin-bottom: 1.45rem; 220 | } 221 | h1 { 222 | margin-left: 0; 223 | margin-right: 0; 224 | margin-top: 0; 225 | padding-bottom: 0; 226 | padding-left: 0; 227 | padding-right: 0; 228 | padding-top: 0; 229 | margin-bottom: 1.45rem; 230 | color: inherit; 231 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 232 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 233 | font-weight: bold; 234 | text-rendering: optimizeLegibility; 235 | font-size: 2.25rem; 236 | line-height: 1.1; 237 | } 238 | h2 { 239 | margin-left: 0; 240 | margin-right: 0; 241 | margin-top: 0; 242 | padding-bottom: 0; 243 | padding-left: 0; 244 | padding-right: 0; 245 | padding-top: 0; 246 | margin-bottom: 1.45rem; 247 | color: inherit; 248 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 249 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 250 | font-weight: bold; 251 | text-rendering: optimizeLegibility; 252 | font-size: 1.62671rem; 253 | line-height: 1.1; 254 | } 255 | h3 { 256 | margin-left: 0; 257 | margin-right: 0; 258 | margin-top: 0; 259 | padding-bottom: 0; 260 | padding-left: 0; 261 | padding-right: 0; 262 | padding-top: 0; 263 | margin-bottom: 1.45rem; 264 | color: inherit; 265 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 266 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 267 | font-weight: bold; 268 | text-rendering: optimizeLegibility; 269 | font-size: 1.38316rem; 270 | line-height: 1.1; 271 | } 272 | h4 { 273 | margin-left: 0; 274 | margin-right: 0; 275 | margin-top: 0; 276 | padding-bottom: 0; 277 | padding-left: 0; 278 | padding-right: 0; 279 | padding-top: 0; 280 | margin-bottom: 1.45rem; 281 | color: inherit; 282 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 283 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 284 | font-weight: bold; 285 | text-rendering: optimizeLegibility; 286 | font-size: 1rem; 287 | line-height: 1.1; 288 | } 289 | h5 { 290 | margin-left: 0; 291 | margin-right: 0; 292 | margin-top: 0; 293 | padding-bottom: 0; 294 | padding-left: 0; 295 | padding-right: 0; 296 | padding-top: 0; 297 | margin-bottom: 1.45rem; 298 | color: inherit; 299 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 300 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 301 | font-weight: bold; 302 | text-rendering: optimizeLegibility; 303 | font-size: 0.85028rem; 304 | line-height: 1.1; 305 | } 306 | h6 { 307 | margin-left: 0; 308 | margin-right: 0; 309 | margin-top: 0; 310 | padding-bottom: 0; 311 | padding-left: 0; 312 | padding-right: 0; 313 | padding-top: 0; 314 | margin-bottom: 1.45rem; 315 | color: inherit; 316 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 317 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 318 | font-weight: bold; 319 | text-rendering: optimizeLegibility; 320 | font-size: 0.78405rem; 321 | line-height: 1.1; 322 | } 323 | hgroup { 324 | margin-left: 0; 325 | margin-right: 0; 326 | margin-top: 0; 327 | padding-bottom: 0; 328 | padding-left: 0; 329 | padding-right: 0; 330 | padding-top: 0; 331 | margin-bottom: 1.45rem; 332 | } 333 | ul { 334 | margin-left: 1.45rem; 335 | margin-right: 0; 336 | margin-top: 0; 337 | padding-bottom: 0; 338 | padding-left: 0; 339 | padding-right: 0; 340 | padding-top: 0; 341 | margin-bottom: 1.45rem; 342 | list-style-position: outside; 343 | list-style-image: none; 344 | } 345 | ol { 346 | margin-left: 1.45rem; 347 | margin-right: 0; 348 | margin-top: 0; 349 | padding-bottom: 0; 350 | padding-left: 0; 351 | padding-right: 0; 352 | padding-top: 0; 353 | margin-bottom: 1.45rem; 354 | list-style-position: outside; 355 | list-style-image: none; 356 | } 357 | dl { 358 | margin-left: 0; 359 | margin-right: 0; 360 | margin-top: 0; 361 | padding-bottom: 0; 362 | padding-left: 0; 363 | padding-right: 0; 364 | padding-top: 0; 365 | margin-bottom: 1.45rem; 366 | } 367 | dd { 368 | margin-left: 0; 369 | margin-right: 0; 370 | margin-top: 0; 371 | padding-bottom: 0; 372 | padding-left: 0; 373 | padding-right: 0; 374 | padding-top: 0; 375 | margin-bottom: 1.45rem; 376 | } 377 | p { 378 | margin-left: 0; 379 | margin-right: 0; 380 | margin-top: 0; 381 | padding-bottom: 0; 382 | padding-left: 0; 383 | padding-right: 0; 384 | padding-top: 0; 385 | margin-bottom: 1.45rem; 386 | } 387 | figure { 388 | margin-left: 0; 389 | margin-right: 0; 390 | margin-top: 0; 391 | padding-bottom: 0; 392 | padding-left: 0; 393 | padding-right: 0; 394 | padding-top: 0; 395 | margin-bottom: 1.45rem; 396 | } 397 | pre { 398 | margin-left: 0; 399 | margin-right: 0; 400 | margin-top: 0; 401 | padding-bottom: 0; 402 | padding-left: 0; 403 | padding-right: 0; 404 | padding-top: 0; 405 | margin-bottom: 1.45rem; 406 | font-size: 0.85rem; 407 | line-height: 1.42; 408 | background: hsla(0, 0%, 0%, 0.04); 409 | border-radius: 3px; 410 | overflow: auto; 411 | word-wrap: normal; 412 | padding: 1.45rem; 413 | } 414 | table { 415 | margin-left: 0; 416 | margin-right: 0; 417 | margin-top: 0; 418 | padding-bottom: 0; 419 | padding-left: 0; 420 | padding-right: 0; 421 | padding-top: 0; 422 | margin-bottom: 1.45rem; 423 | font-size: 1rem; 424 | line-height: 1.45rem; 425 | border-collapse: collapse; 426 | width: 100%; 427 | } 428 | fieldset { 429 | margin-left: 0; 430 | margin-right: 0; 431 | margin-top: 0; 432 | padding-bottom: 0; 433 | padding-left: 0; 434 | padding-right: 0; 435 | padding-top: 0; 436 | margin-bottom: 1.45rem; 437 | } 438 | blockquote { 439 | margin-left: 1.45rem; 440 | margin-right: 1.45rem; 441 | margin-top: 0; 442 | padding-bottom: 0; 443 | padding-left: 0; 444 | padding-right: 0; 445 | padding-top: 0; 446 | margin-bottom: 1.45rem; 447 | } 448 | form { 449 | margin-left: 0; 450 | margin-right: 0; 451 | margin-top: 0; 452 | padding-bottom: 0; 453 | padding-left: 0; 454 | padding-right: 0; 455 | padding-top: 0; 456 | margin-bottom: 1.45rem; 457 | } 458 | noscript { 459 | margin-left: 0; 460 | margin-right: 0; 461 | margin-top: 0; 462 | padding-bottom: 0; 463 | padding-left: 0; 464 | padding-right: 0; 465 | padding-top: 0; 466 | margin-bottom: 1.45rem; 467 | } 468 | iframe { 469 | margin-left: 0; 470 | margin-right: 0; 471 | margin-top: 0; 472 | padding-bottom: 0; 473 | padding-left: 0; 474 | padding-right: 0; 475 | padding-top: 0; 476 | margin-bottom: 1.45rem; 477 | } 478 | hr { 479 | margin-left: 0; 480 | margin-right: 0; 481 | margin-top: 0; 482 | padding-bottom: 0; 483 | padding-left: 0; 484 | padding-right: 0; 485 | padding-top: 0; 486 | margin-bottom: calc(1.45rem - 1px); 487 | background: hsla(0, 0%, 0%, 0.2); 488 | border: none; 489 | height: 1px; 490 | } 491 | address { 492 | margin-left: 0; 493 | margin-right: 0; 494 | margin-top: 0; 495 | padding-bottom: 0; 496 | padding-left: 0; 497 | padding-right: 0; 498 | padding-top: 0; 499 | margin-bottom: 1.45rem; 500 | } 501 | b { 502 | font-weight: bold; 503 | } 504 | strong { 505 | font-weight: bold; 506 | } 507 | dt { 508 | font-weight: bold; 509 | } 510 | th { 511 | font-weight: bold; 512 | } 513 | li { 514 | margin-bottom: calc(1.45rem / 2); 515 | } 516 | ol li { 517 | padding-left: 0; 518 | } 519 | ul li { 520 | padding-left: 0; 521 | } 522 | li > ol { 523 | margin-left: 1.45rem; 524 | margin-bottom: calc(1.45rem / 2); 525 | margin-top: calc(1.45rem / 2); 526 | } 527 | li > ul { 528 | margin-left: 1.45rem; 529 | margin-bottom: calc(1.45rem / 2); 530 | margin-top: calc(1.45rem / 2); 531 | } 532 | blockquote *:last-child { 533 | margin-bottom: 0; 534 | } 535 | li *:last-child { 536 | margin-bottom: 0; 537 | } 538 | p *:last-child { 539 | margin-bottom: 0; 540 | } 541 | li > p { 542 | margin-bottom: calc(1.45rem / 2); 543 | } 544 | code { 545 | font-size: 0.85rem; 546 | line-height: 1.45rem; 547 | } 548 | kbd { 549 | font-size: 0.85rem; 550 | line-height: 1.45rem; 551 | } 552 | samp { 553 | font-size: 0.85rem; 554 | line-height: 1.45rem; 555 | } 556 | abbr { 557 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 558 | cursor: help; 559 | } 560 | acronym { 561 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 562 | cursor: help; 563 | } 564 | abbr[title] { 565 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 566 | cursor: help; 567 | text-decoration: none; 568 | } 569 | thead { 570 | text-align: left; 571 | } 572 | td, 573 | th { 574 | text-align: left; 575 | border-bottom: 1px solid hsla(0, 0%, 0%, 0.12); 576 | font-feature-settings: "tnum"; 577 | -moz-font-feature-settings: "tnum"; 578 | -ms-font-feature-settings: "tnum"; 579 | -webkit-font-feature-settings: "tnum"; 580 | padding-left: 0.96667rem; 581 | padding-right: 0.96667rem; 582 | padding-top: 0.725rem; 583 | padding-bottom: calc(0.725rem - 1px); 584 | } 585 | th:first-child, 586 | td:first-child { 587 | padding-left: 0; 588 | } 589 | th:last-child, 590 | td:last-child { 591 | padding-right: 0; 592 | } 593 | tt, 594 | code { 595 | background-color: hsla(0, 0%, 0%, 0.04); 596 | border-radius: 3px; 597 | font-family: "SFMono-Regular", Consolas, "Roboto Mono", "Droid Sans Mono", 598 | "Liberation Mono", Menlo, Courier, monospace; 599 | padding: 0; 600 | padding-top: 0.2em; 601 | padding-bottom: 0.2em; 602 | } 603 | pre code { 604 | background: none; 605 | line-height: 1.42; 606 | } 607 | code:before, 608 | code:after, 609 | tt:before, 610 | tt:after { 611 | letter-spacing: -0.2em; 612 | content: " "; 613 | } 614 | pre code:before, 615 | pre code:after, 616 | pre tt:before, 617 | pre tt:after { 618 | content: ""; 619 | } 620 | @media only screen and (max-width: 480px) { 621 | html { 622 | font-size: 100%; 623 | } 624 | } 625 | -------------------------------------------------------------------------------- /src/layouts/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import Helmet from 'react-helmet' 4 | 5 | import Header from '../components/Header' 6 | import Nav from '../components/Nav' 7 | import './index.css' 8 | 9 | const TemplateWrapper = ({ children }) => ( 10 |
11 | 18 |
19 |
31 | ) 32 | 33 | TemplateWrapper.propTypes = { 34 | children: PropTypes.func, 35 | } 36 | 37 | export default TemplateWrapper 38 | -------------------------------------------------------------------------------- /src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const NotFoundPage = () => ( 4 |
5 |

NOT FOUND

6 |

You just hit a route that doesn't exist... the sadness.

7 |
8 | ) 9 | 10 | export default NotFoundPage 11 | -------------------------------------------------------------------------------- /src/pages/callback.js: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | import Auth from '../utils/auth'; 4 | 5 | class Callback extends React.Component { 6 | render() { 7 | const auth = new Auth(); 8 | auth.handleAuthentication(); 9 | 10 | return ( 11 |
14 | Loading... 15 |
16 | ); 17 | } 18 | } 19 | 20 | export default Callback; 21 | -------------------------------------------------------------------------------- /src/pages/index.js: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | import Link from 'gatsby-link'; 4 | import get from 'lodash/get'; 5 | import Helmet from 'react-helmet'; 6 | 7 | class IndexPage extends React.Component { 8 | render() { 9 | return ( 10 |
13 |

Welcome to freeCodeCamp Events.

14 |
15 | ) 16 | } 17 | } 18 | 19 | export default IndexPage; 20 | -------------------------------------------------------------------------------- /src/utils/auth.js: -------------------------------------------------------------------------------- 1 | 2 | import auth0 from 'auth0-js'; 3 | import { navigateTo } from "gatsby-link"; 4 | 5 | const AUTH0_DOMAIN = process.env.AUTH0_DOMAIN; 6 | const AUTH0_CLIENT_ID = process.env.AUTH0_CLIENT_ID; 7 | 8 | export default class Auth { 9 | auth0 = new auth0.WebAuth({ 10 | domain: AUTH0_DOMAIN, 11 | clientID: AUTH0_CLIENT_ID, 12 | redirectUri: 'http://localhost:8000/callback', 13 | audience: `https://${AUTH0_DOMAIN}/api/v2/`, 14 | responseType: 'token id_token', 15 | scope: 'openid profile email' 16 | }); 17 | 18 | constructor() { 19 | this.login = this.login.bind(this); 20 | this.logout = this.logout.bind(this); 21 | this.handleAuthentication = this.handleAuthentication.bind(this); 22 | this.isAuthenticated = this.isAuthenticated.bind(this); 23 | } 24 | 25 | login() { 26 | this.auth0.authorize(); 27 | } 28 | 29 | logout() { 30 | localStorage.removeItem('access_token'); 31 | localStorage.removeItem('id_token'); 32 | localStorage.removeItem('expires_at'); 33 | localStorage.removeItem('user'); 34 | } 35 | 36 | handleAuthentication() { 37 | if (typeof window !== 'undefined') { 38 | this.auth0.parseHash((err, authResult) => { 39 | if (authResult && authResult.accessToken && authResult.idToken) { 40 | this.setSession(authResult); 41 | } else if (err) { 42 | console.log(err); 43 | } 44 | 45 | // Return to the homepage after authentication. 46 | navigateTo('/'); 47 | }); 48 | } 49 | } 50 | 51 | isAuthenticated() { 52 | const expiresAt = JSON.parse(localStorage.getItem('expires_at')); 53 | return new Date().getTime() < expiresAt; 54 | } 55 | 56 | setSession(authResult) { 57 | const expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime()); 58 | localStorage.setItem('access_token', authResult.accessToken); 59 | localStorage.setItem('id_token', authResult.idToken); 60 | localStorage.setItem('expires_at', expiresAt); 61 | 62 | this.auth0.client.userInfo(authResult.accessToken, (err, user) => { 63 | localStorage.setItem('user', JSON.stringify(user)); 64 | }) 65 | } 66 | 67 | getUser() { 68 | if (localStorage.getItem('user')) { 69 | return JSON.parse(localStorage.getItem('user')); 70 | } 71 | } 72 | 73 | getUserName() { 74 | if (this.getUser()) { 75 | return this.getUser().name; 76 | } 77 | } 78 | } 79 | --------------------------------------------------------------------------------