diff --git a/client/assets/css/reset.scss b/client/assets/css/reset.scss
index 32711086..2b9a27ae 100644
--- a/client/assets/css/reset.scss
+++ b/client/assets/css/reset.scss
@@ -106,19 +106,19 @@ select:-moz-focusring {
::-webkit-scrollbar{
- height:6px;
- width:6px
+ height:4px;
+ width:4px
}
::-webkit-scrollbar-track{
background:rgba(0,0,0,.1)
}
::-webkit-scrollbar-thumb{
- -webkit-border-radius:3px;
+ -webkit-border-radius:2px;
-moz-border-radius:2px;
-ms-border-radius:2px;
-o-border-radius:2px;
border-radius:2px;
- background:rgba(0,0,0,.2)
+ background:rgba(0,0,0,.2);
}
.scroll-y{
scrollbar-3dlight-color:#7d7e94;
diff --git a/client/helpers/cache.js b/client/helpers/cache.js
index 996744d4..d6a23fdc 100644
--- a/client/helpers/cache.js
+++ b/client/helpers/cache.js
@@ -126,18 +126,19 @@ Data.prototype.remove = function(type, path, exact = true){
}
Data.prototype.update_path = function(updater_fn){
- this.db.then((db) => {
+ return this.db.then((db) => {
const tx = db.transaction(this.FILE_PATH, "readwrite");
const store = tx.objectStore(this.FILE_PATH);
const request = store.openCursor();
- request.onsuccess = function(event) {
- const cursor = event.target.result;
- if(cursor){
+
+ return new Promise((done, error) => {
+ request.onsuccess = function(event) {
+ const cursor = event.target.result;
+ if(!cursor) return done();
updater_fn(cursor.value, store)
cursor.continue();
- }
- };
-
+ };
+ });
});
}
Data.prototype.update_content = function(updater_fn){
diff --git a/client/model/files.js b/client/model/files.js
index bda63d96..b6eb9f8b 100644
--- a/client/model/files.js
+++ b/client/model/files.js
@@ -300,6 +300,22 @@ class FileSystem{
}
}
+ frequents(){
+ let data = [];
+ return cache.update_path((value) => {
+ if(value.access_count >= 1 && value.path !== "/"){
+ data.push(value);
+ }
+ }).then(() => {
+ return Promise.resolve(
+ data
+ .sort((a,b) => a.access_count > b.access_count? -1 : 1)
+ .map((a) => a.path)
+ .slice(0,6)
+ );
+ });
+ }
+
_replace(path, icon){
return cache.get(cache.FILE_PATH, dirname(path), false)
.then((res) => {
diff --git a/client/pages/filespage.js b/client/pages/filespage.js
index 9bd54fc6..5b25fcff 100644
--- a/client/pages/filespage.js
+++ b/client/pages/filespage.js
@@ -8,7 +8,7 @@ import './filespage.scss';
import { Files } from '../model/';
import { NgIf, Loader, Uploader, EventReceiver } from '../components/';
import { notify, debounce, goToFiles, goToViewer, event, screenHeight } from '../helpers/';
-import { BreadCrumb, FileSystem } from './filespage/';
+import { BreadCrumb, FileSystem, FrequentlyAccess } from './filespage/';
@EventReceiver
@DragDropContext(('ontouchstart' in window)? HTML5Backend : HTML5Backend)
@@ -18,6 +18,7 @@ export class FilesPage extends React.Component {
this.state = {
path: props.match.url.replace('/files', '') || '/',
files: [],
+ frequents: [],
loading: true,
error: false,
height: null
@@ -91,6 +92,7 @@ export class FilesPage extends React.Component {
});
this.observers.push(observer);
this.setState({error: false});
+ Files.frequents().then((s) => this.setState({frequents: s}));
}
_cleanupListeners(){
@@ -226,6 +228,9 @@ export class FilesPage extends React.Component {