chore: add empty state for list and spreadsheet layouts (#2531)
* chore: add empty state for list and spreadsheet layouts * fix: build errors
This commit is contained in:
parent
8eaac60aa5
commit
050406b8a4
22 changed files with 417 additions and 105 deletions
|
|
@ -9,15 +9,12 @@ import { sortArrayByDate, sortArrayByPriority } from "constants/kanban-helpers";
|
|||
// types
|
||||
import { IIssue } from "types";
|
||||
import { IBlockUpdateData } from "components/gantt-chart";
|
||||
|
||||
export type IIssueType = "grouped" | "groupWithSubGroups" | "ungrouped";
|
||||
export type IIssueGroupedStructure = { [group_id: string]: IIssue[] };
|
||||
export type IIssueGroupWithSubGroupsStructure = {
|
||||
[group_id: string]: {
|
||||
[sub_group_id: string]: IIssue[];
|
||||
};
|
||||
};
|
||||
export type IIssueUnGroupedStructure = IIssue[];
|
||||
import {
|
||||
IIssueGroupWithSubGroupsStructure,
|
||||
IIssueGroupedStructure,
|
||||
IIssueType,
|
||||
IIssueUnGroupedStructure,
|
||||
} from "store/issue";
|
||||
|
||||
export interface ICycleIssueStore {
|
||||
loader: boolean;
|
||||
|
|
@ -33,6 +30,7 @@ export interface ICycleIssueStore {
|
|||
// computed
|
||||
getIssueType: IIssueType | null;
|
||||
getIssues: IIssueGroupedStructure | IIssueGroupWithSubGroupsStructure | IIssueUnGroupedStructure | null;
|
||||
getIssuesCount: number;
|
||||
// action
|
||||
fetchIssues: (workspaceSlug: string, projectId: string, cycleId: string) => Promise<any>;
|
||||
updateIssueStructure: (group_id: string | null, sub_group_id: string | null, issue: IIssue) => void;
|
||||
|
|
@ -73,6 +71,7 @@ export class CycleIssueStore implements ICycleIssueStore {
|
|||
// computed
|
||||
getIssueType: computed,
|
||||
getIssues: computed,
|
||||
getIssuesCount: computed,
|
||||
// actions
|
||||
fetchIssues: action,
|
||||
updateIssueStructure: action,
|
||||
|
|
@ -130,6 +129,44 @@ export class CycleIssueStore implements ICycleIssueStore {
|
|||
return this.issues?.[cycleId]?.[issueType] || null;
|
||||
}
|
||||
|
||||
get getIssuesCount() {
|
||||
const issueType = this.getIssueType;
|
||||
|
||||
let issuesCount = 0;
|
||||
|
||||
if (issueType === "grouped") {
|
||||
const issues = this.getIssues as IIssueGroupedStructure;
|
||||
|
||||
if (!issues) return 0;
|
||||
|
||||
Object.keys(issues).map((group_id) => {
|
||||
issuesCount += issues[group_id].length;
|
||||
});
|
||||
}
|
||||
|
||||
if (issueType === "groupWithSubGroups") {
|
||||
const issues = this.getIssues as IIssueGroupWithSubGroupsStructure;
|
||||
|
||||
if (!issues) return 0;
|
||||
|
||||
Object.keys(issues).map((sub_group_id) => {
|
||||
Object.keys(issues[sub_group_id]).map((group_id) => {
|
||||
issuesCount += issues[sub_group_id][group_id].length;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (issueType === "ungrouped") {
|
||||
const issues = this.getIssues as IIssueUnGroupedStructure;
|
||||
|
||||
if (!issues) return 0;
|
||||
|
||||
issuesCount = issues.length;
|
||||
}
|
||||
|
||||
return issuesCount;
|
||||
}
|
||||
|
||||
updateIssueStructure = async (group_id: string | null, sub_group_id: string | null, issue: IIssue) => {
|
||||
const cycleId: string | null = this.rootStore?.cycle?.cycleId || null;
|
||||
const issueType = this.getIssueType;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { action, makeObservable, runInAction } from "mobx";
|
||||
// types
|
||||
import { RootStore } from "../root";
|
||||
import { IIssueType } from "./cycle_issue.store";
|
||||
import { IIssueType } from "store/issue";
|
||||
|
||||
export interface ICycleIssueCalendarViewStore {
|
||||
// actions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue