diff --git a/.gitignore b/.gitignore
index 65340cc..92dd8c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,7 @@
node_modules/
# Generated JS/CSS files
-static/main.*
+dist/main.*
# Log files
*.log
\ No newline at end of file
diff --git a/static/404.html b/dist/404.html
similarity index 100%
rename from static/404.html
rename to dist/404.html
diff --git a/static/images/error.png b/dist/images/error.png
similarity index 100%
rename from static/images/error.png
rename to dist/images/error.png
diff --git a/static/images/favicon.ico b/dist/images/favicon.ico
similarity index 100%
rename from static/images/favicon.ico
rename to dist/images/favicon.ico
diff --git a/static/images/loading.gif b/dist/images/loading.gif
similarity index 100%
rename from static/images/loading.gif
rename to dist/images/loading.gif
diff --git a/static/images/success.png b/dist/images/success.png
similarity index 100%
rename from static/images/success.png
rename to dist/images/success.png
diff --git a/static/index.html b/dist/index.html
similarity index 100%
rename from static/index.html
rename to dist/index.html
diff --git a/package.json b/package.json
index e16c8ad..a1b4c2d 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"start": "webpack-dev-server --mode development",
"build-dev": "webpack --mode development",
"build-prod": "webpack --mode production",
- "build-sass": "node-sass --style compressed src/sass/index.sass static/main.css"
+ "build-sass": "node-sass --style compressed src/sass/index.sass dist/main.css"
},
"dependencies": {
"babel-polyfill": "^6.26.0",
diff --git a/src/js/App.js b/src/App.js
similarity index 98%
rename from src/js/App.js
rename to src/App.js
index 9a83f74..03c8f1e 100644
--- a/src/js/App.js
+++ b/src/App.js
@@ -2,7 +2,7 @@ import React from 'react'
import {
BrowserRouter,
Switch,
- Route,
+ Route
} from 'react-router-dom'
import Header from 'components/Header'
@@ -19,10 +19,8 @@ export default () => (
-
)
-
diff --git a/src/js/api/pushshift/index.js b/src/api/pushshift/index.js
similarity index 87%
rename from src/js/api/pushshift/index.js
rename to src/api/pushshift/index.js
index 6138606..38a6461 100644
--- a/src/js/api/pushshift/index.js
+++ b/src/api/pushshift/index.js
@@ -8,13 +8,13 @@ export const getPost = threadID => {
const elasticQuery = {
query: {
term: {
- id: toBase10(threadID),
- },
- },
+ id: toBase10(threadID)
+ }
+ }
}
return (
- fetch(postURL + JSON.stringify(elasticQuery))
+ window.fetch(postURL + JSON.stringify(elasticQuery))
.then(json)
.then(jsonData => jsonData.hits.hits[0]._source)
.then(post => {
@@ -41,17 +41,17 @@ export const getComments = threadID => {
const elasticQuery = {
query: {
match: {
- link_id: toBase10(threadID),
- },
+ link_id: toBase10(threadID)
+ }
},
size: 10000,
_source: [
- 'author', 'body', 'created_utc', 'parent_id', 'score', 'subreddit', 'link_id',
- ],
+ 'author', 'body', 'created_utc', 'parent_id', 'score', 'subreddit', 'link_id'
+ ]
}
return (
- fetch(commentURL + JSON.stringify(elasticQuery))
+ window.fetch(commentURL + JSON.stringify(elasticQuery))
.then(json)
.then(jsonData => jsonData.hits.hits)
.then(comments => comments.map(comment => {
diff --git a/src/js/api/reddit/auth.js b/src/api/reddit/auth.js
similarity index 75%
rename from src/js/api/reddit/auth.js
rename to src/api/reddit/auth.js
index ab825c2..3feedb4 100644
--- a/src/js/api/reddit/auth.js
+++ b/src/api/reddit/auth.js
@@ -5,7 +5,7 @@ export const getAuth = () => (
getToken()
.then(token => ({
headers: {
- Authorization: `bearer ${token}`,
- },
+ Authorization: `bearer ${token}`
+ }
}))
)
diff --git a/src/js/api/reddit/clientID.js b/src/api/reddit/clientID.js
similarity index 100%
rename from src/js/api/reddit/clientID.js
rename to src/api/reddit/clientID.js
diff --git a/src/js/api/reddit/comment.js b/src/api/reddit/comment.js
similarity index 81%
rename from src/js/api/reddit/comment.js
rename to src/api/reddit/comment.js
index f1e4dbc..6cc163a 100644
--- a/src/js/api/reddit/comment.js
+++ b/src/api/reddit/comment.js
@@ -9,7 +9,7 @@ export const getComments = commentIDs => (
)
export const fetchComments = (commentIDs, auth) => (
- fetch(`https://oauth.reddit.com/api/info?id=${commentIDs.map(id => `t1_${id}`).join()}`, auth)
+ window.fetch(`https://oauth.reddit.com/api/info?id=${commentIDs.map(id => `t1_${id}`).join()}`, auth)
.then(json)
.then(results => results.data.children)
.then(commentsData => commentsData.map(commentData => commentData.data))
diff --git a/src/js/api/reddit/index.js b/src/api/reddit/index.js
similarity index 100%
rename from src/js/api/reddit/index.js
rename to src/api/reddit/index.js
diff --git a/src/js/api/reddit/thread.js b/src/api/reddit/thread.js
similarity index 90%
rename from src/js/api/reddit/thread.js
rename to src/api/reddit/thread.js
index 45a057c..64f4a0e 100644
--- a/src/js/api/reddit/thread.js
+++ b/src/api/reddit/thread.js
@@ -22,7 +22,7 @@ export const getThread = (subreddit, threadID, commentID = '') => {
// Fetch thread from reddit
return (
getAuth()
- .then(auth => fetch(url, auth))
+ .then(auth => window.fetch(url, auth))
.then(json)
.then(thread => {
// Create cache object for thread if it doesn't exists
@@ -39,13 +39,12 @@ export const getThread = (subreddit, threadID, commentID = '') => {
)
}
-
export const getThreads = threadIDs => {
const threadString = threadIDs.map(id => `t3_${id}`).join()
return (
getAuth()
- .then(auth => fetch(`https://oauth.reddit.com/api/info?id=${threadString}`, auth))
+ .then(auth => window.fetch(`https://oauth.reddit.com/api/info?id=${threadString}`, auth))
.then(json)
.then(response => {
const threads = response.data.children
diff --git a/src/js/api/reddit/token.js b/src/api/reddit/token.js
similarity index 81%
rename from src/js/api/reddit/token.js
rename to src/api/reddit/token.js
index 86385bd..9237f5f 100644
--- a/src/js/api/reddit/token.js
+++ b/src/api/reddit/token.js
@@ -7,11 +7,11 @@ let token = null
// Headers for getting reddit api token
const tokenInit = {
headers: {
- Authorization: `Basic ${btoa(`${clientID}:`)}`,
- 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
+ Authorization: `Basic ${window.btoa(`${clientID}:`)}`,
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
},
method: 'POST',
- body: `grant_type=${encodeURIComponent('https://oauth.reddit.com/grants/installed_client')}&device_id=DO_NOT_TRACK_THIS_DEVICE`,
+ body: `grant_type=${encodeURIComponent('https://oauth.reddit.com/grants/installed_client')}&device_id=DO_NOT_TRACK_THIS_DEVICE`
}
export const getToken = () => {
@@ -20,7 +20,7 @@ export const getToken = () => {
}
return (
- fetch('https://www.reddit.com/api/v1/access_token', tokenInit)
+ window.fetch('https://www.reddit.com/api/v1/access_token', tokenInit)
.then(json)
.then(response => {
token = response.access_token
diff --git a/src/js/api/removeddit/index.js b/src/api/removeddit/index.js
similarity index 67%
rename from src/js/api/removeddit/index.js
rename to src/api/removeddit/index.js
index 94d5ffc..583c3de 100644
--- a/src/js/api/removeddit/index.js
+++ b/src/api/removeddit/index.js
@@ -3,6 +3,6 @@ import { json } from 'utils'
const baseURL = 'https://removeddit.com/api'
export const getRemovedThreadIDs = (subreddit = '', page = 1) => (
- fetch(`${baseURL}/threads?subreddit=${subreddit}&page=${page - 1}`)
+ window.fetch(`${baseURL}/threads?subreddit=${subreddit}&page=${page - 1}`)
.then(json)
)
diff --git a/src/js/components/Comment.js b/src/components/Comment.js
similarity index 100%
rename from src/js/components/Comment.js
rename to src/components/Comment.js
diff --git a/src/js/components/CommentInfo.js b/src/components/CommentInfo.js
similarity index 100%
rename from src/js/components/CommentInfo.js
rename to src/components/CommentInfo.js
diff --git a/src/js/components/CommentSection.js b/src/components/CommentSection.js
similarity index 95%
rename from src/js/components/CommentSection.js
rename to src/components/CommentSection.js
index 6531934..5886cc5 100644
--- a/src/js/components/CommentSection.js
+++ b/src/components/CommentSection.js
@@ -5,11 +5,11 @@ import SortBy from 'components/SortBy'
import { connect } from 'react-redux'
import {
SORT_TOP, SORT_BOTTOM, SORT_NEW, SORT_OLD,
- SHOW_ALL, SHOW_REMOVED_DELETED, SHOW_REMOVED, SHOW_DELETED,
+ SHOW_ALL, SHOW_REMOVED_DELETED, SHOW_REMOVED, SHOW_DELETED
} from 'state'
import {
topSort, bottomSort, newSort, oldSort,
- showRemovedAndDeleted, showRemoved, showDeleted,
+ showRemovedAndDeleted, showRemoved, showDeleted
} from 'utils'
const arrayToLookup = (commentList, removed, deleted) => {
@@ -134,8 +134,7 @@ const commentSection = (props) => {
const mapStateToProps = state => ({
sort: state.commentSection.sort,
- show: state.commentSection.show,
+ show: state.commentSection.show
})
-
export default connect(mapStateToProps)(commentSection)
diff --git a/src/js/components/Header.js b/src/components/Header.js
similarity index 100%
rename from src/js/components/Header.js
rename to src/components/Header.js
diff --git a/src/js/components/Post.js b/src/components/Post.js
similarity index 100%
rename from src/js/components/Post.js
rename to src/components/Post.js
diff --git a/src/js/components/SortBy.js b/src/components/SortBy.js
similarity index 86%
rename from src/js/components/SortBy.js
rename to src/components/SortBy.js
index 026d5b5..6c859c9 100644
--- a/src/js/components/SortBy.js
+++ b/src/components/SortBy.js
@@ -3,11 +3,10 @@ import {
setCommentSort,
setCommentShow,
SORT_TOP, SORT_BOTTOM, SORT_NEW, SORT_OLD,
- SHOW_ALL, SHOW_REMOVED_DELETED, SHOW_REMOVED, SHOW_DELETED,
+ SHOW_ALL, SHOW_REMOVED_DELETED, SHOW_REMOVED, SHOW_DELETED
} from 'state'
import { connect } from 'react-redux'
-
const sortBy = props => (
)
diff --git a/src/js/components/SubredditSort.js b/src/components/SubredditSort.js
similarity index 100%
rename from src/js/components/SubredditSort.js
rename to src/components/SubredditSort.js
diff --git a/src/js/components/ThreadInfo.js b/src/components/ThreadInfo.js
similarity index 100%
rename from src/js/components/ThreadInfo.js
rename to src/components/ThreadInfo.js
diff --git a/src/js/containers/StatusBox.js b/src/containers/StatusBox.js
similarity index 93%
rename from src/js/containers/StatusBox.js
rename to src/containers/StatusBox.js
index 98f4460..e1df31e 100644
--- a/src/js/containers/StatusBox.js
+++ b/src/containers/StatusBox.js
@@ -12,7 +12,7 @@ const StatusBox = props => (
const mapStateToProps = state => ({
text: state.status.text,
- image: state.status.image,
+ image: state.status.image
})
export default connect(mapStateToProps)(StatusBox)
diff --git a/src/js/index.js b/src/index.js
similarity index 100%
rename from src/js/index.js
rename to src/index.js
diff --git a/src/js/pages/About.js b/src/pages/About.js
similarity index 100%
rename from src/js/pages/About.js
rename to src/pages/About.js
diff --git a/src/js/pages/Search.js b/src/pages/Search.js
similarity index 96%
rename from src/js/pages/Search.js
rename to src/pages/Search.js
index 0f6ef4a..86ead70 100644
--- a/src/js/pages/Search.js
+++ b/src/pages/Search.js
@@ -1,7 +1,7 @@
// var radioInput = function(name, displayNames, values) {
// var inputs = "";
-
+
// for(var i = 0, len = displayNames.length; i < len; i++){
// inputs += '';
// inputs += '';
+// return '';
// };
// var label = function(name, display) {
@@ -37,7 +37,7 @@
// var select = function(name, display, values){
// var html = '