Upgrade dependencies, etc. (#55)

* Run prettify

* Upgrade dependencies and switch out some libraries:

* timeago (freshly jquery dependent) -> ReactTimeAgo
* next-ga -> react-ga and custom plumbing

* Move static/ to public/static/

As per https://github.com/zeit/next.js/blob/master/errors/static-dir-deprecated.md

* Fix cons->icons typo

* Import only what's necessary from lodash (223 -> 180 kb)

* Asyncify MembershipInfoForm
This commit is contained in:
Aarni Koskela
2019-10-30 20:05:08 +02:00
committed by Riku Rouvila
parent db98341a51
commit dcf26deb0f
36 changed files with 3376 additions and 585 deletions

View File

@@ -1,13 +0,0 @@
import React from "react";
import App from "next/app";
import Router from "next/router";
import withGA from "next-ga";
class MyApp extends App {
render() {
const { Component, pageProps } = this.props;
return <Component {...pageProps} />;
}
}
export default withGA("UA-58806132-1", Router)(MyApp);

View File

@@ -2,6 +2,19 @@ import React from "react";
import Document, { Html, Head, Main, NextScript } from "next/document";
import { Footer } from "../components/Footer";
import Fader from "../components/Fader";
import ReactGA from "react-ga";
function trackPageView() {
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
return;
}
if (!window.GA_INITIALIZED) {
ReactGA.initialize("UA-58806132-1");
window.GA_INITIALIZED = true;
}
ReactGA.set({ page: window.location.pathname });
ReactGA.pageview(window.location.pathname);
}
class MyDocument extends Document {
static async getInitialProps(ctx) {
@@ -9,6 +22,10 @@ class MyDocument extends Document {
return { ...initialProps };
}
componentDidMount() {
trackPageView();
}
render() {
return (
<Html lang="fi">
@@ -41,7 +58,7 @@ class MyDocument extends Document {
sizes="16x16"
href="/static/icons/favicon-16x16.png"
/>
<link rel="manifest" href="/static/cons/site.webmanifest" />
<link rel="manifest" href="/static/icons/site.webmanifest" />
<meta property="og:image" content="images/logo.png" />
<script src="https://js.stripe.com/v3/" />
<script src="//use.typekit.net/scb5xny.js" />

View File

@@ -100,7 +100,10 @@ const IndexContent = () => (
</div>
<div className="column column1-2">
<a href="/static/images/slack.png" target="_blank">
<img src="/static/images/slack.png" alt="Slack app at Koodiklinikka" />
<img
src="/static/images/slack.png"
alt="Slack app at Koodiklinikka"
/>
</a>
</div>
</div>
@@ -108,7 +111,10 @@ const IndexContent = () => (
<div className="row">
<div className="bread">
<div className="column column2-5">
<img src="/static/images/octocat.png" alt="Octocat, the mascot of GitHub" />
<img
src="/static/images/octocat.png"
alt="Octocat, the mascot of GitHub"
/>
</div>
<div className="column column3-5">
<h3>Avoin lähdekoodi</h3>