feat: reordering documents in collection (#1722)

* tweaking effect details

* wrap work on this feature

* adds correct color to drop cursor

* simplify logic for early return

* much better comment so Tom doesn't fire me

* feat: Allow changing sort order of collections

* refactor: Move validation to model
feat: Make custom order the default (in prep for dnd)

* feat: Add sort choice to edit collection modal
fix: Improved styling of generic InputSelect

* fix: Vertical space left after removing previous collection description

* chore: Tweak language, menu contents, add auto-disclosure on sub menus

* only show drop-to-reorder cursor when sort is set to manual

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Nan Yu
2020-12-31 12:51:12 -08:00
committed by GitHub
parent ba61091c4c
commit 2cc45187e6
22 changed files with 435 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
// @flow
import { pick } from "lodash";
import { pick, trim } from "lodash";
import { action, computed, observable } from "mobx";
import BaseModel from "models/BaseModel";
import Document from "models/Document";
@@ -20,6 +20,7 @@ export default class Collection extends BaseModel {
createdAt: ?string;
updatedAt: ?string;
deletedAt: ?string;
sort: { field: string, direction: "asc" | "desc" };
url: string;
@computed
@@ -45,6 +46,11 @@ export default class Collection extends BaseModel {
return results;
}
@computed
get hasDescription(): string {
return !!trim(this.description, "\\").trim();
}
@action
updateDocument(document: Document) {
const travelDocuments = (documentList, path) =>
@@ -108,6 +114,7 @@ export default class Collection extends BaseModel {
"description",
"icon",
"private",
"sort",
]);
};