Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptiklemur committed Dec 30, 2018
0 parents commit c3b7ab9
Show file tree
Hide file tree
Showing 37 changed files with 13,865 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
presets: [
"next/babel",
"@zeit/next-typescript/babel"
],
plugins: [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
]
};
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.serverless
dev.vault.json
start.sh
.build
node_modules
.next
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@fortawesome:registry=https://npm.fontawesome.com/5CA47386-257E-471F-B022-5A6A4E9F513E
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.9.0
16 changes: 16 additions & 0 deletions components/MainMenu/MainMenu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import "../../styles/variables";

img.logo {
width: 48px;
height: auto;
max-height: initial;
border-radius: 32px;
}

h1.title {
padding-left: 1rem;
}

nav.navbar {
border-radius: 0;
}
53 changes: 53 additions & 0 deletions components/MainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import c from 'classnames';
import Link from 'next/link';
import React from 'react';
import NavbarItem from './NavbarItem';

const bulma = require('../../styles/global.scss');
const styles = require('./MainMenu.scss');

interface State {
mounted: boolean;
toggled: boolean;
}

export default class MainMenu extends React.Component<{}, State> {
public state = {
mounted: false,
toggled: false,
};

public componentDidMount() {
this.setState({mounted: true});
}

public render() {
return (
<nav className={c(bulma.navbar, bulma.isPrimary, styles.navbar)}>
<div className={bulma.navbarBrand}>
<Link href="/">
<a className={bulma.navbarItem}>
<img src={require('../../static/hotline.png')} alt="Logo" className={styles.logo}/>
<h1 className={c(bulma.title, bulma.is2, styles.title)}>Hotline</h1>
</a>
</Link>
<a className={c(bulma.navbarBurger, bulma.burger)}>
<span/>
<span/>
<span/>
</a>
</div>
<div className={bulma.navbarMenu}>
<div className={bulma.navbarEnd}>
<NavbarItem href="https://apply.hotline.gg">
Apply to Join
</NavbarItem>
<NavbarItem href="/connect">
Log In
</NavbarItem>
</div>
</div>
</nav>
);
}
}
21 changes: 21 additions & 0 deletions components/MainMenu/NavbarItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Link from 'next/link';
import * as React from 'react';

const bulma = require('../../styles/global.scss');

interface Props {
href: string;
children: any[] | any;
}

export default class NavbarItem extends React.PureComponent<Props> {
public render() {
return (
<Link href={this.props.href}>
<a className={bulma.navbarItem}>
{this.props.children}
</a>
</Link>
);
}
}
44 changes: 44 additions & 0 deletions extensions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
String.prototype.truncate = function(n, useWordBoundary = true) {
if (this.length <= n) {
return this;
}

let subString = this.substr(0, n - 1);

return (useWordBoundary ? subString.substr(0, subString.lastIndexOf(' ')) : subString) + "...";
};

String.prototype.ucfirst = function() {
return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
};
String.prototype.trimChar = function(char) {
let newString = this;
while (this.charAt(0) === char) {
newString = newString.substring(1);
}

while (this.charAt(newString.length - 1) === char) {
newString = newString.substring(0, newString.length - 1);
}

return newString;
};

Array.prototype.contains = function(...items) {
for (let item of items) {
if (this.indexOf(item) >= 0) {
return true;
}
}

return false;
};
String.prototype.contains = function(...items) {
for (let item of items) {
if (this.indexOf(item) >= 0) {
return true;
}
}

return false;
};
51 changes: 51 additions & 0 deletions fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import '@fortawesome/fontawesome-svg-core/styles.css';
import {config, library} from '@fortawesome/fontawesome-svg-core';
import {faDiscord} from '@fortawesome/free-brands-svg-icons';
import {
faCheck,
faChevronDown,
faChevronLeft,
faChevronRight,
faExclamationTriangle,
faFlag,
faHome,
faPencil,
faQuestion,
faSearch,
faSignInAlt,
faSignOutAlt,
faSpinner,
faSpinnerThird,
faStar,
faSync,
faUser,
faUsers as faUsersLight,
} from '@fortawesome/pro-light-svg-icons';
import {faGem, faLongArrowAltRight, faUsers} from '@fortawesome/pro-solid-svg-icons';

config.autoAddCss = false;

library.add(
faDiscord,
faSpinnerThird,
faSearch,
faSync,
faCheck,
faHome,
faPencil,
faQuestion,
faChevronDown,
faStar,
faUser,
faUsers,
faUsersLight,
faGem,
faChevronLeft,
faChevronRight,
faSignInAlt,
faSignOutAlt,
faFlag,
faLongArrowAltRight,
faSpinner,
faExclamationTriangle,
);
95 changes: 95 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const withImages = require('next-images');
const withCss = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');
const withSourceMaps = require('@zeit/next-source-maps');
const withTypescript = require('@zeit/next-typescript');
const withBundleAnalyzer = require('@zeit/next-bundle-analyzer');

// Define the class
class FilterPlugin {
constructor(options) {
this.options = options;
}

apply(compiler) {
compiler.hooks.afterEmit.tap(
'FilterPlugin',
(compilation) => {
compilation.warnings = (
compilation.warnings
).filter(
warning => !this.options.filter.test(warning.message),
);
},
);
}
}

const isProd = process.env.NODE_ENV === 'production';
const ident = isProd ? '[hash:base64:5]_[local]' : '[name]_[local]';

const config = withBundleAnalyzer(withTypescript(withSourceMaps(withImages(withCss(withSass(
{
analyzeServer: ['server', 'both'].includes(process.env.BUNDLE_ANALYZE),
analyzeBrowser: ['browser', 'both'].includes(process.env.BUNDLE_ANALYZE),
bundleAnalyzerConfig: {
server: {
analyzerMode: 'static',
reportFilename: '../bundles/server.html',
},
browser: {
analyzerMode: 'static',
reportFilename: '../bundles/client.html',
},
},
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
camelCase: true,
localIdentName: 'style_' + ident,
},
publicRuntimeConfig: {
noCache: !isProd,
production: isProd,
algolia: {
app_id: process.env.ALGOLIA_APP_ID,
api_key: process.env.ALGOLIA_API_KEY,
},
sentry: {
dsn: process.env.SENTRY_DSN,
},
api: {
url: process.env.API_URL,
},
chargebee: {
site: process.env.CHARGEBEE_SITE,
},
},
workboxOpts: {
globPatterns: ['static/**/*'],
globDirectory: '.',
runtimeCaching: [
{urlPattern: /^https:\/\/discordservers\.com\/?.*/, handler: 'staleWhileRevalidate'},
],
},
assetPrefix: isProd ? 'https://assets.discordservers.com' : '',
workerLoaderOptions: {inline: true, fallback: false, publicPath: '/'},
webpack(config, options) {
config.plugins.push(
new FilterPlugin({filter: /chunk styles \[mini-css-extract-plugin]\nConflicting order between:/}),
);

config.node = {fs: 'empty', net: 'empty', tls: 'empty', console: true, module: 'empty'};
config.resolve = {extensions: ['.ts', '.tsx', '.js']};

// Necessary for file changes inside the bind mount to get picked up
config.watchOptions = {aggregateTimeout: 300, poll: 1000};

return config;
},
},
))))));

module.exports = (phase) => {
return config;
};
20 changes: 20 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"exec": "ts-node --project tsconfig.server.json server/index.ts",
"watch": [
"server/*.ts",
"server/**/*.ts",
"dev.sh",
"api.ts",
"package.json",
"controller",
"next.config.js"
],
"ignore": [
"pages",
"components",
"notifications",
"styles",
"store"
],
"ext": "ts js json"
}
9 changes: 9 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 2,
"builds": [
{
"src": "package.json",
"use": "@now/next"
}
]
}
Loading

0 comments on commit c3b7ab9

Please sign in to comment.