From 4d0632bfd2d621fcce7a25c9c1cced59602377a5 Mon Sep 17 00:00:00 2001 From: JubbeArt Date: Sun, 29 Jul 2018 04:09:05 +0200 Subject: [PATCH] Removed unnecessary functions in utils.js --- README.md | 2 +- TODO | 4 ++++ optimization | 4 ---- src/state.js | 14 +++++--------- src/utils.js | 16 ---------------- 5 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 optimization diff --git a/README.md b/README.md index abc0996..6921539 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [Removeddit](https://removeddit.com) is a site for viewing removed comments / threads from [Reddit](https://www.reddit.com). Just go to any reddit thread and change the `reddit` in the URL to `removeddit` to see all removed comments. -This is a done by comparing the comments being stored in [Jason Baumgartners](https://pushshift.io/) [Pushshift Reddit API](https://github.com/pushshift/api) and the ones from Reddit API. The frontend is written in React and uses Sass as the CSS Preprocessor. There is also a seperate [backend](https://github.com/JubbeArt/removeddit-api) used for storing what threads that have been removed by mods. +This is a done by comparing the comments being stored in [Jason Baumgartners](https://pushshift.io/) [Pushshift Reddit API](https://github.com/pushshift/api) and the ones from Reddit API. The frontend is written in [React](https://reactjs.org/) and uses [Sass](https://sass-lang.com/) as the CSS Preprocessor. There is also a seperate [backend](https://github.com/JubbeArt/removeddit-api) used for storing what threads that have been removed by mods. # Development Download either [Yarn](https://yarnpkg.com/en/docs/install) (the one I use) or [npm](https://www.npmjs.com/get-npm) diff --git a/TODO b/TODO index 58e81a8..0cbc1cc 100644 --- a/TODO +++ b/TODO @@ -3,3 +3,7 @@ update header links active (NavLinks) make sort/filter state local old.removeddit.com + +take utc from thread and limit pushshift comments + +rename show to filter \ No newline at end of file diff --git a/optimization b/optimization deleted file mode 100644 index 552fd2e..0000000 --- a/optimization +++ /dev/null @@ -1,4 +0,0 @@ -take utc from thread and limit pushshift comments - - -rename show to filter \ No newline at end of file diff --git a/src/state.js b/src/state.js index da065f4..874b19e 100644 --- a/src/state.js +++ b/src/state.js @@ -23,15 +23,11 @@ const sortKey = 'commentSort' const filterKey = 'commentFilter' class GlobalState extends Container { - constructor () { - super() - - this.state = { - commentSort: get(sortKey, sort.top), - commentFilter: get(filterKey, filter.removedDeleted), - statusText: '', - statusImage: undefined - } + state = { + commentSort: get(sortKey, sort.top), + commentFilter: get(filterKey, filter.removedDeleted), + statusText: '', + statusImage: undefined } setCommentSort (sortType) { diff --git a/src/utils.js b/src/utils.js index d661481..0d7d905 100644 --- a/src/utils.js +++ b/src/utils.js @@ -8,12 +8,6 @@ export const flatten = arr => arr.reduce( [] ) -// Same as: array => Set => array -export const unique = arr => arr.filter((value, index) => arr.indexOf(value) === index) - -// Everything in arr1 that is not in arr2 -export const difference = (arr1, arr2) => arr1.filter(x => !arr2.includes(x)) - // Take on big array and split it into an array of chunks with correct size export const chunk = (arr, size) => { const chunks = [] @@ -23,16 +17,6 @@ export const chunk = (arr, size) => { return chunks } -// Make multiple requests to the same url, with an array of data (usually comment IDs) -// This is needed since there is a limit on how long a url can be -export const fetchMultiple = (url, arr, header, size = 100) => { - const subArrays = chunk(arr, size) - - return Promise.all(subArrays.map(subArr => window.fetch(url + subArr.join(), header))) -} - -export const jsonMultiple = responses => Promise.all(responses.map(response => response.json())) - // Change bases export const toBase36 = number => parseInt(number, 10).toString(36) export const toBase10 = numberString => parseInt(numberString, 36)