Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanhogan committed Sep 8, 2018
1 parent f9c3b23 commit 9d8b764
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 105 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ before_script:
- git config --global user.email $GH_EMAIL
- git config --global user.name $GH_USERNAME
- git remote set-url origin https://[email protected]/rowanhogan/wikipadia.git
- npm install -g gulp
- npm install
script:
- npm run deploy
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"gh-pages": "^1.1.0",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-fastclick": "^3.0.2",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4"
},
Expand Down
21 changes: 1 addition & 20 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,9 @@
<html>
<head>
<meta charset="utf-8">
<title>Single Page Apps for GitHub Pages</title>
<title>404 - Page not found</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
// ----------------------------------------------------------------------
// This script takes the current url and converts the path and query
// string into just a query string, and then redirects the browser
// to the new url with only a query string and hash fragment,
// e.g. http://www.foo.tld/one/two?a=b&c=d#qwe, becomes
// http://www.foo.tld/?p=/one/two&q=a=b~and~c=d#qwe
// Note: this 404.html file must be at least 512 bytes for it to work
// with Internet Explorer (it is currently > 512 bytes)

// If you're creating a Project Pages site and NOT using a custom domain,
// then set segmentCount to 1 (enterprise users may need to set it to > 1).
// This way the code will only replace the route part of the path, and not
// the real directory in which the app resides, for example:
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
// https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe
// Otherwise, leave segmentCount as 0.
var segmentCount = 0;

var l = window.location;
Expand All @@ -33,7 +15,6 @@
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);

</script>
</head>
<body>
Expand Down
89 changes: 26 additions & 63 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,41 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Wikipadia - A beautiful, customisable Wikipedia reader.</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Cardo:400,400i,700|Playfair+Display:700,700i" rel="stylesheet">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Wikipadia - A beautiful, customisable Wikipedia reader.</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->

<!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
// ----------------------------------------------------------------------
// This script checks to see if a redirect is present in the query string
// and converts it back into the correct url and adds it to the
// browser's history using window.history.replaceState(...),
// which won't cause the browser to attempt to load the new url.
// When the single page app is loaded further down in this file,
// the correct url will be waiting in the browser's history for
// the single page app to route accordingly.
(function(l) {
if (l.search) {
var q = {};
l.search
.slice(1)
.split("&")
.forEach(function(v) {
var a = v.split("=");
q[a[0]] = a
.slice(1)
.join("=")
.replace(/~and~/g, "&");
});
if (q.p !== undefined) {
window.history.replaceState(
null,
null,
l.pathname.slice(0, -1) + (q.p || "") + (q.q ? "?" + q.q : "") + l.hash
);
}
}
})(window.location);
</script>
<!-- End Single Page Apps for GitHub Pages -->
// https://github.com/rafrex/spa-github-pages
(function(l) {
if (l.search) {
var q = {};
l.search
.slice(1)
.split("&")
.forEach(function(v) {
var a = v.split("=");
q[a[0]] = a
.slice(1)
.join("=")
.replace(/~and~/g, "&");
});
if (q.p !== undefined) {
window.history.replaceState(
null,
null,
l.pathname.slice(0, -1) + (q.p || "") + (q.q ? "?" + q.q : "") + l.hash
);
}
}
})(window.location);
</script>
</body>
</html>
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/Home.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
import "./index.css";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
import App from "./routes/app";
import "./index.css";

ReactDOM.render(
<BrowserRouter>
Expand Down
9 changes: 9 additions & 0 deletions src/routes/app/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import ReactDOM from "react-dom";
import App from ".";

it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
15 changes: 11 additions & 4 deletions src/App.js → src/routes/app/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import React from "react";
import { Switch, Route, Link } from "react-router-dom";

import Home from "./Home";
import Page from "./Page";
import Media from "./Media";
import Home from "../home";
import Page from "../page";
import Media from "../media";

const PageNotFound = () => <div>😢 Not Found</div>;
const PageNotFound = () => (
<div>
<span role="img" aria-label="Sad face">
😢
</span>
Not Found
</div>
);

export default () => (
<div>
Expand Down
16 changes: 16 additions & 0 deletions src/routes/home/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import { Route, Link } from "react-router-dom";

export default () => (
<div>
<h1 class="logo">Wikipadia</h1>

<div class="blurb">
<p>
<em>WikiPadia</em> is a beautiful, customisable Wikipedia reader. It was
specifically built for leisurely reading on an iPad.
</p>
</div>
<Link to="/Main_page">Main Page</Link>
</div>
);
2 changes: 1 addition & 1 deletion src/Media/index.js → src/routes/media/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from "react";
import { fetchMedia } from "../lib/api";
import { fetchMedia } from "../../lib/api";

export default class extends Component {
constructor(props) {
Expand Down
4 changes: 2 additions & 2 deletions src/Page/index.js → src/routes/page/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from "react";
import { fetchPage } from "../lib/api";
import Loading from "../components/Loading";
import { fetchPage } from "../../lib/api";
import Loading from "../../components/Loading";

export default class extends Component {
constructor(props) {
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5586,6 +5586,10 @@ react-error-overlay@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4"

react-fastclick@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/react-fastclick/-/react-fastclick-3.0.2.tgz#2994c60088cda90b0b2cbfac4b6e7c6bc73d6a3a"

react-router-dom@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.2.2.tgz#c8a81df3adc58bba8a76782e946cbd4eae649b8d"
Expand Down

0 comments on commit 9d8b764

Please sign in to comment.