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/BrowserView.jsx | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 client/components/Browser/BrowserView.jsx

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

diff --git a/client/components/Browser/BrowserView.jsx b/client/components/Browser/BrowserView.jsx
new file mode 100644
index 0000000..ed4f2cb
--- /dev/null
+++ b/client/components/Browser/BrowserView.jsx
@@ -0,0 +1,29 @@
+import { h, Component } from 'preact'
+
+import Folders from './Folders/Folders.jsx'
+import Files from './Files/Files.jsx'
+
+export default function BrowserView (props) {
+  console.log('browser view', props)
+  const openFolders = (props.openFolders || []).map((folder_id) => {
+    const folder_list = props.folders.filter(folder => folder.id === folder_id)
+    if (! folder_list.length) return
+    const folder = folder_list[0]
+    return (
+      <Files
+        folder={folder}
+        onClose={() => props.closeFolder(folder)}
+      />
+    )
+  })
+  
+  return (
+    <div class='column'>
+      <Folders folders={props.folders}
+        openFolder={(folder) => props.openFolder(folder)}
+        addFolder={(folder) => props.addFolder(folder)}
+      />
+      {openFolders}
+    </div>
+  )
+}
-- 
cgit v1.2.3-70-g09d2

