-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathIAppState.ts
More file actions
61 lines (56 loc) · 1.86 KB
/
IAppState.ts
File metadata and controls
61 lines (56 loc) · 1.86 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Document } from "flexsearch";
import { IFilter } from "./IFilter";
import { IProjectInfo } from "./IProjectInfo";
import { IProjectsMetadata } from "./IProjectsMetadata";
/**
* This is the document layout used for indexing the Projects.
*/
export interface IProjectSearchDoc {
id: number;
name: string;
description?: string;
}
/**
* The Projects state is the master list of all projects from the data file. The
* values for this state should not be modified after the file is loaded unless
* reloading the file.
*
* @property isFetchingProjects Indicates if we are currently fetching projects from the server.
* @property values The list of projects.
* @property searchIndex The flexsearch index for searching titles and descriptions.
*/
export interface IProjectsState {
isFetchingProjects: boolean;
values: IProjectInfo[];
searchIndex?: Document<IProjectSearchDoc>;
isFetchingProjectsMetadata: boolean;
projectsMetadata?: IProjectsMetadata
}
/**
* The part of the state that summarizes the filter options and selection.
*
* @property filterOptions A record that maps projectsMetadata tags to the
* list of filters that are available for this project property. These are
* one filter object for each possible value of this property.
* @property titleSubstring The string that was entered in the free-text search box
* @property selected The set of filters that are currently selected
*/
export interface IFiltersState {
filterOptions: Map<string, IFilter[]>;
titleSubstring: string;
selected: Set<IFilter>;
}
/**
* Results are the IProjectInfo objects that are displayed to the user after
* filtering has been applied.
*
* @property values The filtered list of projects.
*/
export interface IResultsState {
values: IProjectInfo[];
}
export interface IAppState {
projects: IProjectsState;
filters: IFiltersState;
results: IResultsState;
}