fix: Labels delete & reordering (#2729)
* fix: Labels reordering inconsistency * fix: Delete child labels * feat: multi-select while grouping labels * refactor: label sorting in mobx computed function * feat: drag & drop label grouping, un-grouping * chore: removed label select modal * fix: moving labels from project store to project label store * fix: typo changes and build tree function added * labels feature * disable dropping group into a group * fix build errors * fix more issues * chore: added combining state UI, fixed scroll issue for label groups * chore: group icon for label groups * fix: group cannot be dropped in another group --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: rahulramesha <rahulramesham@gmail.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
parent
d933c73343
commit
63b6150b9c
62 changed files with 862 additions and 520 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { observable, action, computed, makeObservable, runInAction } from "mobx";
|
||||
// types
|
||||
import { RootStore } from "../root";
|
||||
import { IProject, IIssueLabels, IEstimate } from "types";
|
||||
import { IProject, IEstimate } from "types";
|
||||
// services
|
||||
import { ProjectService, ProjectStateService, ProjectEstimateService } from "services/project";
|
||||
import { IssueService, IssueLabelService } from "services/issue";
|
||||
|
|
@ -16,9 +16,6 @@ export interface IProjectStore {
|
|||
project_details: {
|
||||
[projectId: string]: IProject; // projectId: project Info
|
||||
};
|
||||
labels: {
|
||||
[projectId: string]: IIssueLabels[] | null; // project_id: labels
|
||||
} | null;
|
||||
estimates: {
|
||||
[projectId: string]: IEstimate[] | null; // project_id: members
|
||||
} | null;
|
||||
|
|
@ -26,12 +23,9 @@ export interface IProjectStore {
|
|||
// computed
|
||||
searchedProjects: IProject[];
|
||||
workspaceProjects: IProject[] | null;
|
||||
projectLabels: IIssueLabels[] | null;
|
||||
projectEstimates: IEstimate[] | null;
|
||||
|
||||
joinedProjects: IProject[];
|
||||
favoriteProjects: IProject[];
|
||||
|
||||
currentProjectDetails: IProject | undefined;
|
||||
|
||||
// actions
|
||||
|
|
@ -39,12 +33,10 @@ export interface IProjectStore {
|
|||
setSearchQuery: (query: string) => void;
|
||||
|
||||
getProjectById: (workspaceSlug: string, projectId: string) => IProject | null;
|
||||
getProjectLabelById: (labelId: string) => IIssueLabels | null;
|
||||
getProjectEstimateById: (estimateId: string) => IEstimate | null;
|
||||
|
||||
getProjectEstimateById: (estimateId: string) => IEstimate | null;
|
||||
fetchProjects: (workspaceSlug: string) => Promise<void>;
|
||||
fetchProjectDetails: (workspaceSlug: string, projectId: string) => Promise<any>;
|
||||
fetchProjectLabels: (workspaceSlug: string, projectId: string) => Promise<void>;
|
||||
fetchProjectEstimates: (workspaceSlug: string, projectId: string) => Promise<any>;
|
||||
|
||||
addProjectToFavorites: (workspaceSlug: string, projectId: string) => Promise<any>;
|
||||
|
|
@ -70,9 +62,6 @@ export class ProjectStore implements IProjectStore {
|
|||
project_details: {
|
||||
[projectId: string]: IProject; // projectId: project
|
||||
} = {};
|
||||
labels: {
|
||||
[projectId: string]: IIssueLabels[]; // projectId: labels
|
||||
} | null = {};
|
||||
estimates: {
|
||||
[projectId: string]: IEstimate[]; // projectId: estimates
|
||||
} | null = {};
|
||||
|
|
@ -96,13 +85,13 @@ export class ProjectStore implements IProjectStore {
|
|||
projectId: observable.ref,
|
||||
projects: observable.ref,
|
||||
project_details: observable.ref,
|
||||
labels: observable.ref,
|
||||
|
||||
estimates: observable.ref,
|
||||
|
||||
// computed
|
||||
searchedProjects: computed,
|
||||
workspaceProjects: computed,
|
||||
projectLabels: computed,
|
||||
|
||||
projectEstimates: computed,
|
||||
|
||||
currentProjectDetails: computed,
|
||||
|
|
@ -117,10 +106,8 @@ export class ProjectStore implements IProjectStore {
|
|||
fetchProjectDetails: action,
|
||||
|
||||
getProjectById: action,
|
||||
getProjectLabelById: action,
|
||||
getProjectEstimateById: action,
|
||||
|
||||
fetchProjectLabels: action,
|
||||
fetchProjectEstimates: action,
|
||||
|
||||
addProjectToFavorites: action,
|
||||
|
|
@ -177,11 +164,6 @@ export class ProjectStore implements IProjectStore {
|
|||
return this.projects?.[this.rootStore.workspace.workspaceSlug]?.filter((p) => p.is_favorite);
|
||||
}
|
||||
|
||||
get projectLabels() {
|
||||
if (!this.projectId) return null;
|
||||
return this.labels?.[this.projectId] || null;
|
||||
}
|
||||
|
||||
get projectEstimates() {
|
||||
if (!this.projectId) return null;
|
||||
return this.estimates?.[this.projectId] || null;
|
||||
|
|
@ -241,14 +223,6 @@ export class ProjectStore implements IProjectStore {
|
|||
return projectInfo;
|
||||
};
|
||||
|
||||
getProjectLabelById = (labelId: string) => {
|
||||
if (!this.projectId) return null;
|
||||
const labels = this.projectLabels;
|
||||
if (!labels) return null;
|
||||
const labelInfo: IIssueLabels | null = labels.find((label) => label.id === labelId) || null;
|
||||
return labelInfo;
|
||||
};
|
||||
|
||||
getProjectEstimateById = (estimateId: string) => {
|
||||
if (!this.projectId) return null;
|
||||
const estimates = this.projectEstimates;
|
||||
|
|
@ -257,28 +231,6 @@ export class ProjectStore implements IProjectStore {
|
|||
return estimateInfo;
|
||||
};
|
||||
|
||||
fetchProjectLabels = async (workspaceSlug: string, projectId: string) => {
|
||||
try {
|
||||
this.loader = true;
|
||||
this.error = null;
|
||||
|
||||
const labelResponse = await this.issueLabelService.getProjectIssueLabels(workspaceSlug, projectId);
|
||||
|
||||
runInAction(() => {
|
||||
this.labels = {
|
||||
...this.labels,
|
||||
[projectId]: labelResponse,
|
||||
};
|
||||
this.loader = false;
|
||||
this.error = null;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.loader = false;
|
||||
this.error = error;
|
||||
}
|
||||
};
|
||||
|
||||
fetchProjectEstimates = async (workspaceSlug: string, projectId: string) => {
|
||||
try {
|
||||
this.loader = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue