From ae0eac0f3b59c3c39d06d43d03dc1b0435bb9ef2 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 15 May 2017 19:10:00 +0000 Subject: [PATCH] Refactoring note list --- ReactNativeClient/src/base-model.js | 7 ++ .../src/components/create-note-button.js | 31 --------- ReactNativeClient/src/components/item-list.js | 23 +------ ReactNativeClient/src/components/note-list.js | 27 ++++++++ .../src/components/screens/folder.js | 64 +++++++++++++++++++ .../src/components/screens/note.js | 2 +- .../src/components/screens/notes.js | 18 ++++-- ReactNativeClient/src/models/folder.js | 33 ++++++++++ ReactNativeClient/src/models/note.js | 7 -- ReactNativeClient/src/root.js | 30 ++++++++- ReactNativeClient/src/web-api.js | 6 +- 11 files changed, 180 insertions(+), 68 deletions(-) delete mode 100644 ReactNativeClient/src/components/create-note-button.js create mode 100644 ReactNativeClient/src/components/note-list.js create mode 100644 ReactNativeClient/src/components/screens/folder.js create mode 100644 ReactNativeClient/src/models/folder.js diff --git a/ReactNativeClient/src/base-model.js b/ReactNativeClient/src/base-model.js index a4bbcb894..6e0cb0fa0 100644 --- a/ReactNativeClient/src/base-model.js +++ b/ReactNativeClient/src/base-model.js @@ -13,6 +13,13 @@ class BaseModel { return false; } + static byId(items, id) { + for (let i = 0; i < items.length; i++) { + if (items[i].id == id) return items[i]; + } + return null; + } + static save(o) { let isNew = !o.id; let query = ''; diff --git a/ReactNativeClient/src/components/create-note-button.js b/ReactNativeClient/src/components/create-note-button.js deleted file mode 100644 index 99b2b2d78..000000000 --- a/ReactNativeClient/src/components/create-note-button.js +++ /dev/null @@ -1,31 +0,0 @@ -// import React, { Component } from 'react'; -// import { connect } from 'react-redux' -// import { Button } from 'react-native'; -// import { _ } from 'src/locale.js'; - -// class CreateNoteButtonComponent extends Component { - -// render() { -// return