From 9cff94abd63023bd6d9fa7c99ec2c520e1c34c8c Mon Sep 17 00:00:00 2001
From: Arpith Siromoney <arpith@feedreader.co>
Date: Sat, 21 Jul 2018 16:34:55 -0700
Subject: [PATCH] remove folders :)

---
 src/components/AddFolderButton.js | 48 -------------------------------
 src/components/FolderButton.js    | 41 --------------------------
 src/components/FolderButtons.js   |  8 ------
 src/components/FolderLink.js      |  6 ----
 src/components/FolderLinks.js     |  6 ----
 src/main.js                       | 29 ++-----------------
 static/style.css                  |  2 +-
 7 files changed, 3 insertions(+), 137 deletions(-)
 delete mode 100644 src/components/AddFolderButton.js
 delete mode 100644 src/components/FolderButton.js
 delete mode 100644 src/components/FolderButtons.js
 delete mode 100644 src/components/FolderLink.js
 delete mode 100644 src/components/FolderLinks.js

diff --git a/src/components/AddFolderButton.js b/src/components/AddFolderButton.js
deleted file mode 100644
index 327673f..0000000
--- a/src/components/AddFolderButton.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import React, { Component } from 'react';
-
-export default class AddFolderButton extends Component {
-  constructor(props) {
-    super(props);
-    this.state = {
-      textInputDisplay: 'none',
-      buttonValue: 'New Folder',
-    };
-  }
-
-  onClick(e) {
-    e.preventDefault();
-    if (this.state.textInputDisplay === 'none') {
-      this.setState({ textInputDisplay: 'inline', buttonValue: 'Save' });
-    } else {
-      addToNewFolder();
-      this.setState({ buttonValue: 'New Folder' });
-    }
-  }
-
-  addToNewFolder(newFolder) {
-    const newButton = createFolderButton(newFolder.value);
-    newFolder.value = '';
-    newFolder.parentElement.insertBefore(newButton, newFolder);
-    newFolder.style.display = 'none';
-    addToFolder(newButton);
-  }
-
-  render() {
-    return (
-      <div>
-        <input
-          type="text"
-          placeholder="Folder Name"
-          display={this.state.textInputDisplay}
-          className="pillbox"
-        />
-        <input
-          type="submit"
-          className="pillbox"
-          value={this.state.buttonValue}
-          onClick={this.onClick}
-        />
-      </div>
-    );
-  }
-}
diff --git a/src/components/FolderButton.js b/src/components/FolderButton.js
deleted file mode 100644
index e8688ad..0000000
--- a/src/components/FolderButton.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React, { Component } from 'react';
-
-export default class FolderButton extends Component {
-  constructor(props) {
-    super(props);
-    let className = 'pillbox empty';
-    if (this.props.folders.indexOf(this.props.folder) !== -1) {
-      className = 'pillbox';
-    }
-    this.state = { className };
-  }
-
-  onClick(e) {
-    e.preventDefault();
-    if (this.state.className === 'pillbox') {
-      this.removeFromFolder(folderButton);
-    } else {
-      this.addToFolder(folderButton);
-    }
-  }
- 
-  addToFolder() {
-    this.props.lib.user.folders.folder.post(this.props.folder, this.props.feed).then(() => {
-      this.setState({ className: 'pillbox' });
-    }).catch(console.error);
-  }
-
-  removeFromFolder() {
-    this.props.lib.user.folders.folder.del(this.props.folder, this.props.feed).then(() => {
-      this.setState({ className: 'pillbox empty' });
-    }).catch(console.error);
-  }
-
-  render() {
-    return <input type="submit"
-      className={this.state.className}
-      value={this.props.folder}
-      onClick={this.onClick}
-    />;
-  }
-}
diff --git a/src/components/FolderButtons.js b/src/components/FolderButtons.js
deleted file mode 100644
index 717459d..0000000
--- a/src/components/FolderButtons.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from 'react';
-import FolderButton from './FolderButton';
-import AddFolderButton from './AddFolderButton';
-
-export default ({ allFolders, user, folders, feed, lib }) => <div>
-  {allFolders.map(FolderButton.bind(user, folders, feed, lib))}
-  <AddFolderButton />
-</div>;
diff --git a/src/components/FolderLink.js b/src/components/FolderLink.js
deleted file mode 100644
index fcd2d3a..0000000
--- a/src/components/FolderLink.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import React from 'react';
-
-export default ({ folder, user }) => {
-  const uri = `/${user}/folders/${encodeURIComponent(folder)}`;
-  return <a href={uri} className="pillbox">{folder}</a>;
-};
diff --git a/src/components/FolderLinks.js b/src/components/FolderLinks.js
deleted file mode 100644
index 640519d..0000000
--- a/src/components/FolderLinks.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import React from 'react';
-import FolderLink from './FolderLink';
-
-export default ({ folders, user }) => <div>
-  {folders.map(folder => <FolderLink folder={folder} key={folder} user={user} />)}
-</div>;
diff --git a/src/main.js b/src/main.js
index b7d3cc1..09593aa 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,8 +2,6 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import api from './api';
 import Article from './components/Article';
-import FolderLinks from './components/FolderLinks';
-import FolderButtons from './components/FolderButtons';
 
 const token = localStorage.token;
 const user = localStorage.user;
@@ -18,29 +16,6 @@ let pathname = splitPathname.join('/');
 let current;
 let articles;
 
-function displayFolders({ allFolders, folders }) {
-  const foldersDiv = document.getElementById('folders');
-  if (splitPathname[1] === 'feeds') {
-    const feed = pathname.slice(7, -1);
-    if (!allFolders || !folders) return;
-    ReactDOM.render(<FolderButtons
-      folders={folders}
-      user={user}
-      allFolders={allFolders}
-      feed={feed}
-    />, foldersDiv);
-  } else {
-    if (!folders) return;
-    ReactDOM.render(<FolderLinks folders={folders} user={user} />, foldersDiv);
-  }
-}
-
-function getFolders() {
-  return lib.user.folders.get()
-    .then(displayFolders)
-    .catch(console.error);
-}
-
 function storeLabelArticles(label) {
   return lib.user.labels.get(label).then((response) => {
     labelArticles[label] = response.articles || [];
@@ -156,7 +131,7 @@ if (user) {
 }
 
 if (hash && isArticle) {
-  getArticle(hash).then(getFolders).then(getLabels).then(refreshFeeds);
+  getArticle(hash).then(getLabels).then(refreshFeeds);
 } else {
-  getArticles().then(getFolders).then(getLabels).then(refreshFeeds);
+  getArticles().then(getLabels).then(refreshFeeds);
 }
diff --git a/static/style.css b/static/style.css
index ccccdc4..7405305 100644
--- a/static/style.css
+++ b/static/style.css
@@ -94,7 +94,7 @@ header {
   margin-top: 0.4em!important;
 }
 #articles {
-  margin-top: 5em;
+  margin-top: 3em;
 }
 .article {
   margin-bottom: 1.6em!important;
