-
-
Notifications
You must be signed in to change notification settings - Fork 551
/
directory.ts
47 lines (44 loc) · 1.12 KB
/
directory.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as Immutable from "immutable";
import { ContentRef } from "../../refs";
export interface DirectoryModelRecordProps {
type: "directory";
sortedBy?: "created" | "lastSaved" | "type" | "name";
groupedBy?: "type" | "mimetype";
items: Immutable.List<ContentRef>;
}
export const makeDirectoryModel = Immutable.Record<DirectoryModelRecordProps>({
type: "directory",
items: Immutable.List()
});
export type DirectoryModelRecord = Immutable.RecordOf<
DirectoryModelRecordProps
>;
export interface DirectoryContentRecordProps {
mimetype: null;
type: "directory";
created: Date | null;
format: "json";
lastSaved: Date | null;
filepath: string;
model: DirectoryModelRecord;
saving: boolean;
loading: boolean;
error?: object | null;
}
export const makeDirectoryContentRecord = Immutable.Record<
DirectoryContentRecordProps
>({
mimetype: null,
type: "directory",
created: null,
format: "json",
lastSaved: null,
filepath: "",
model: makeDirectoryModel(),
saving: false,
loading: false,
error: null
});
export type DirectoryContentRecord = Immutable.RecordOf<
DirectoryContentRecordProps
>;