π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-2943] chore: issue reaction and code refactor (#6350)
Anmol Singh Bhatia3691cef351e1
diff --git a/web/core/components/issues/issue-detail/reactions/issue.tsx b/web/core/components/issues/issue-detail/reactions/issue.tsxindex 815e979360..9b723e785b 100644--- a/web/core/components/issues/issue-detail/reactions/issue.tsx+++ b/web/core/components/issues/issue-detail/reactions/issue.tsx@@ -20,10 +20,11 @@ export type TIssueReaction = {issueId: string;currentUser: IUser;disabled?: boolean;+ className?: string;};export const IssueReaction: FC<TIssueReaction> = observer((props) => {- const { workspaceSlug, projectId, issueId, currentUser, disabled = false } = props;+ const { workspaceSlug, projectId, issueId, currentUser, disabled = false, className = "" } = props;// hooksconst {reaction: { getReactionsByIssueId, reactionsByUser, getReactionById },@@ -92,7 +93,7 @@ export const IssueReaction: FC<TIssueReaction> = observer((props) => {};return (- <div className="relative mt-4 flex items-center gap-1.5">+ <div className={cn("relative mt-4 flex items-center gap-1.5", className)}>{!disabled && (<ReactionSelector size="md" position="top" value={userReactions} onSelect={issueReactionOperations.react} />)}diff --git a/web/core/store/project/project.store.ts b/web/core/store/project/project.store.tsindex 25e6d500da..e32c189546 100644--- a/web/core/store/project/project.store.ts+++ b/web/core/store/project/project.store.ts@@ -11,6 +11,8 @@ import { ProjectService, ProjectStateService, ProjectArchiveService } from "@/se// storeimport { CoreRootStore } from "../root.store";+type ProjectOverviewCollapsible = "links" | "attachments";+export interface IProjectStore {// observablesisUpdatingProject: boolean;@@ -18,9 +20,6 @@ export interface IProjectStore {projectMap: {[projectId: string]: TProject; // projectId: project Info};- projectEpicPropertiesMap: {- [projectId: string]: any;- };// computedfilteredProjectIds: string[] | undefined;workspaceProjectIds: string[] | undefined;@@ -32,9 +31,15 @@ export interface IProjectStore {// actionsgetProjectById: (projectId: string | undefined | null) => TProject | undefined;getProjectIdentifierById: (projectId: string | undefined | null) => string;- getProjectEpicPropertiesById: (projectId: string | undefined | null) => any;+ // collapsible+ openCollapsibleSection: ProjectOverviewCollapsible[];+ lastCollapsibleAction: ProjectOverviewCollapsible | null;++ setOpenCollapsibleSection: (section: ProjectOverviewCollapsible[]) => void;+ setLastCollapsibleAction: (section: ProjectOverviewCollapsible) => void;+ toggleOpenCollapsibleSection: (section: ProjectOverviewCollapsible) => void;+// fetch actions- fetchProjectEpicProperties: (workspaceSlug: string, projectId: string) => Promise<any>;fetchProjects: (workspaceSlug: string) => Promise<TProject[]>;fetchProjectDetails: (workspaceSlug: string, projectId: string) => Promise<TProject>;// favorites actions@@ -58,9 +63,9 @@ export class ProjectStore implements IProjectStore {projectMap: {[projectId: string]: TProject; // projectId: project Info} = {};- projectEpicPropertiesMap: {- [projectId: string]: any;- } = {};+ openCollapsibleSection: ProjectOverviewCollapsible[] = [];+ lastCollapsibleAction: ProjectOverviewCollapsible | null = null;+// root storerootStore: CoreRootStore;// service@@ -76,6 +81,8 @@ export class ProjectStore implements IProjectStore {isUpdatingProject: observable,loader: observable.ref,projectMap: observable,+ openCollapsibleSection: observable.ref,+ lastCollapsibleAction: observable.ref,// computedfilteredProjectIds: computed,workspaceProjectIds: computed,@@ -85,7 +92,6 @@ export class ProjectStore implements IProjectStore {joinedProjectIds: computed,favoriteProjectIds: computed,// fetch actions- fetchProjectEpicProperties: action,fetchProjects: action,fetchProjectDetails: action,// favorites actions@@ -96,6 +102,10 @@ export class ProjectStore implements IProjectStore {// CRUD actionscreateProject: action,updateProject: action,+ // collapsible actions+ setOpenCollapsibleSection: action,+ setLastCollapsibleAction: action,+ toggleOpenCollapsibleSection: action,});// root storethis.rootStore = _rootStore;@@ -214,23 +224,22 @@ export class ProjectStore implements IProjectStore {return projectIds;}- fetchProjectEpicProperties = async (workspaceSlug: string, projectId: string) => {- try {- const response = await this.projectService.fetchProjectEpicProperties(workspaceSlug, projectId);- runInAction(() => {- set(this.projectEpicPropertiesMap, [projectId], response);- });- return response;- } catch (error) {- console.log("Failed to fetch epic properties from project store");- throw error;- }+ setOpenCollapsibleSection = (section: ProjectOverviewCollapsible[]) => {+ this.openCollapsibleSection = section;+ if (this.lastCollapsibleAction) this.lastCollapsibleAction = null;};- getProjectEpicPropertiesById = computedFn((projectId: string | undefined | null) => {- const projectEpicProperties = this.projectEpicPropertiesMap[projectId ?? ""];- return projectEpicProperties;- });+ setLastCollapsibleAction = (section: ProjectOverviewCollapsible) => {+ this.openCollapsibleSection = [section];+ };++ toggleOpenCollapsibleSection = (section: ProjectOverviewCollapsible) => {+ if (this.openCollapsibleSection && this.openCollapsibleSection.includes(section)) {+ this.openCollapsibleSection = this.openCollapsibleSection.filter((s) => s !== section);+ } else {+ this.openCollapsibleSection = [...this.openCollapsibleSection, section];+ }+ };/*** get Workspace projects using workspace slug