From f8b61281be84a6e4e7a44be5109e688a7c56c671 Mon Sep 17 00:00:00 2001
From: Jules Laplace <julescarbon@gmail.com>
Date: Fri, 7 Jul 2017 21:18:33 +0200
Subject: refactor files so list updates while processing

---
 client/components/Browser/Browser.jsx | 57 -----------------------------------
 1 file changed, 57 deletions(-)
 delete mode 100644 client/components/Browser/Browser.jsx

(limited to 'client/components/Browser/Browser.jsx')

diff --git a/client/components/Browser/Browser.jsx b/client/components/Browser/Browser.jsx
deleted file mode 100644
index a7731f1..0000000
--- a/client/components/Browser/Browser.jsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { h, Component } from 'preact'
-
-import Folders from './Folders/Folders.jsx'
-import Files from './Folder/Files.jsx'
-
-import client from '../../client'
-
-class Browser extends Component {
-  constructor(props) {
-    super()
-    let openFolders = JSON.parse( localStorage['openFolders'] || 'null' )
-    this.state = {
-      folders: [],
-      openFolders: openFolders || [],
-    }
-    client.folder.index().then( folders => this.setState({ folders }) )
-  }
-  openFolder(folder) {
-    if (this.state.openFolders.indexOf(folder.id) === -1) {
-      const newOpenFolders = this.state.openFolders.concat(folder.id)
-      localStorage['openFolders'] = JSON.stringify(newOpenFolders)
-      this.setState({ openFolders: newOpenFolders })
-    }
-  }
-  closeFolder(folder) {
-    const openFolders = this.state.openFolders.filter( folder_id => folder_id !== folder.id )
-    localStorage['openFolders'] = JSON.stringify(openFolders)
-    this.setState({ openFolders })
-  }
-  addFolder(folder) {
-    this.setState({ folders: this.state.folders.concat([folder]) })
-  }
-  render() {
-    const openFolders = this.state.openFolders.map((folder_id) => {
-      const folder_list = this.state.folders.filter(folder => folder.id === folder_id)
-      if (! folder_list.length) return
-      const folder = folder_list[0]
-      return (
-        <Files
-          folder={folder}
-          onClose={() => this.closeFolder(folder)}
-        />
-      )
-    })
-    return (
-      <div class='column'>
-        <Folders folders={this.state.folders}
-          openFolder={(folder) => this.openFolder(folder)}
-          addFolder={(folder) => this.addFolder(folder)}
-        />
-        {openFolders}
-      </div>
-    )
-  }
-}
-
-export default Browser
-- 
cgit v1.2.3-70-g09d2

