Clear localstorage cache and add slogan

master
Tanner Collin 5 years ago
parent 1b6c8fc6cb
commit 2b1a352917
  1. 2
      webclient/src/App.js
  2. 2
      webclient/src/Feed.js
  3. 2
      webclient/src/Style-dark.css
  4. 4
      webclient/src/Style-light.css
  5. 6
      webclient/src/utils.js

@ -35,6 +35,8 @@ class App extends React.Component {
<p>
<Link to='/'>QNN - Home</Link>
<span className='theme'>Theme: <a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span>
<br />
<span className='slogan'>Reddit, Hacker News, and Tildes combined, then pre-rendered in reader mode.</span>
</p>
</div>
<Route path='/' exact component={Feed} />

@ -1,6 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { sourceLink, infoLine } from './utils.js';
import { clearStorage } from './utils.js';
const apiUrl = 'http://news-api.dns.t0.vc/';
@ -21,6 +22,7 @@ class Feed extends React.Component {
.then(
(result) => {
this.setState({ stories: result.stories });
clearStorage();
localStorage.setItem('stories', JSON.stringify(result.stories));
result.stories.slice(0, 25).forEach(x => {
fetch(apiUrl + x.id)

@ -26,7 +26,7 @@
}
.dark .item .info a.hot {
color: #CCCCCC;
color: #cccccc;
}
.dark .article a {

@ -20,6 +20,10 @@ a {
padding: 0 1rem;
}
.slogan {
color: #828282;
}
.theme {
float: right;
}

@ -20,3 +20,9 @@ export const infoLine = (story) =>
</Link>
</div>
;
export const clearStorage = () => {
const themeSetting = localStorage.getItem('theme');
localStorage.clear();
localStorage.setItem('theme', themeSetting);
};

Loading…
Cancel
Save