[WEB-1251] chore: view list enhancement (#4427)
* chore: moved search query to mobx store * chore: moved view sub-header to app header * chore: created by avatar added in view item list
This commit is contained in:
parent
243680132e
commit
e396424db7
6 changed files with 109 additions and 82 deletions
|
|
@ -12,11 +12,13 @@ export interface IProjectViewStore {
|
|||
loader: boolean;
|
||||
fetchedMap: Record<string, boolean>;
|
||||
// observables
|
||||
searchQuery: string;
|
||||
viewMap: Record<string, IProjectView>;
|
||||
// computed
|
||||
projectViewIds: string[] | null;
|
||||
// computed actions
|
||||
getViewById: (viewId: string) => IProjectView;
|
||||
updateSearchQuery: (query: string) => void;
|
||||
// fetch actions
|
||||
fetchViews: (workspaceSlug: string, projectId: string) => Promise<undefined | IProjectView[]>;
|
||||
fetchViewDetails: (workspaceSlug: string, projectId: string, viewId: string) => Promise<IProjectView>;
|
||||
|
|
@ -38,6 +40,7 @@ export class ProjectViewStore implements IProjectViewStore {
|
|||
// observables
|
||||
loader: boolean = false;
|
||||
viewMap: Record<string, IProjectView> = {};
|
||||
searchQuery: string = "";
|
||||
//loaders
|
||||
fetchedMap: Record<string, boolean> = {};
|
||||
// root store
|
||||
|
|
@ -51,6 +54,7 @@ export class ProjectViewStore implements IProjectViewStore {
|
|||
loader: observable.ref,
|
||||
viewMap: observable,
|
||||
fetchedMap: observable,
|
||||
searchQuery: observable.ref,
|
||||
// computed
|
||||
projectViewIds: computed,
|
||||
// fetch actions
|
||||
|
|
@ -60,6 +64,8 @@ export class ProjectViewStore implements IProjectViewStore {
|
|||
createView: action,
|
||||
updateView: action,
|
||||
deleteView: action,
|
||||
// actions
|
||||
updateSearchQuery: action,
|
||||
// favorites actions
|
||||
addViewToFavorites: action,
|
||||
removeViewFromFavorites: action,
|
||||
|
|
@ -85,6 +91,12 @@ export class ProjectViewStore implements IProjectViewStore {
|
|||
*/
|
||||
getViewById = computedFn((viewId: string) => this.viewMap?.[viewId] ?? null);
|
||||
|
||||
/**
|
||||
* @description update search query
|
||||
* @param {string} query
|
||||
*/
|
||||
updateSearchQuery = (query: string) => (this.searchQuery = query);
|
||||
|
||||
/**
|
||||
* Fetches views for current project
|
||||
* @param workspaceSlug
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue