diff --git a/web/components/issues/issue-layouts/roots/all-issue-layout-root.tsx b/web/components/issues/issue-layouts/roots/all-issue-layout-root.tsx index b87bec2d0..0262788ac 100644 --- a/web/components/issues/issue-layouts/roots/all-issue-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/all-issue-layout-root.tsx @@ -5,19 +5,17 @@ import useSWR from "swr"; // hooks import { useGlobalView, useIssues, useUser } from "hooks/store"; // components -import { GlobalViewsAppliedFiltersRoot } from "components/issues"; +import { GlobalViewsAppliedFiltersRoot, IssuePeekOverview } from "components/issues"; import { SpreadsheetView } from "components/issues/issue-layouts"; import { AllIssueQuickActions } from "components/issues/issue-layouts/quick-action-dropdowns"; // ui import { Spinner } from "@plane/ui"; // types -import { TIssue, IIssueDisplayFilterOptions, TStaticViewTypes, TUnGroupedIssues } from "@plane/types"; +import { TIssue, IIssueDisplayFilterOptions } from "@plane/types"; import { EIssueActions } from "../types"; import { EUserProjectRoles } from "constants/project"; import { EIssueFilterType, EIssuesStoreType } from "constants/issue"; - - export const AllIssueLayoutRoot: React.FC = observer(() => { // router const router = useRouter(); @@ -48,11 +46,7 @@ export const AllIssueLayoutRoot: React.FC = observer(() => { if (workspaceSlug && globalViewId) { await fetchAllGlobalViews(workspaceSlug.toString()); await fetchFilters(workspaceSlug.toString(), globalViewId.toString()); - await fetchIssues( - workspaceSlug.toString(), - globalViewId.toString(), - groupedIssueIds ? "mutation" : "init-loader" - ); + await fetchIssues(workspaceSlug.toString(), globalViewId.toString(), issueIds ? "mutation" : "init-loader"); } } ); @@ -138,6 +132,9 @@ export const AllIssueLayoutRoot: React.FC = observer(() => { )} )} + + {/* peek overview */} + ); }); diff --git a/web/components/issues/peek-overview/root.tsx b/web/components/issues/peek-overview/root.tsx index 56ccb9b7c..5b36a1c4f 100644 --- a/web/components/issues/peek-overview/root.tsx +++ b/web/components/issues/peek-overview/root.tsx @@ -35,12 +35,9 @@ export type TIssuePeekOperations = { export const IssuePeekOverview: FC = observer((props) => { const { is_archived = false, onIssueUpdate } = props; // hooks - const { - project: {}, - } = useMember(); const { setToastAlert } = useToast(); const { - membership: { currentProjectRole }, + membership: { currentWorkspaceAllProjectsRole }, } = useUser(); const { issues: { removeIssue: removeArchivedIssue }, @@ -198,6 +195,7 @@ export const IssuePeekOverview: FC = observer((props) => { const issue = getIssueById(peekIssue.issueId) || undefined; + const currentProjectRole = currentWorkspaceAllProjectsRole?.[peekIssue?.projectId]; // Check if issue is editable, based on user role const is_editable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; const isLoading = !issue || loader ? true : false; diff --git a/web/components/profile/profile-issues.tsx b/web/components/profile/profile-issues.tsx index cef250f1f..5d7575835 100644 --- a/web/components/profile/profile-issues.tsx +++ b/web/components/profile/profile-issues.tsx @@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite"; // components import { ProfileIssuesListLayout } from "components/issues/issue-layouts/list/roots/profile-issues-root"; import { ProfileIssuesKanBanLayout } from "components/issues/issue-layouts/kanban/roots/profile-issues-root"; -import { ProfileIssuesAppliedFiltersRoot } from "components/issues"; +import { IssuePeekOverview, ProfileIssuesAppliedFiltersRoot } from "components/issues"; import { Spinner } from "@plane/ui"; // hooks import { useIssues } from "hooks/store"; @@ -34,7 +34,7 @@ export const ProfileIssuesPage = observer((props: IProfileIssuesPage) => { async () => { if (workspaceSlug && userId) { await fetchFilters(workspaceSlug, userId); - await fetchIssues(workspaceSlug, userId, groupedIssueIds ? "mutation" : "init-loader", undefined, type); + await fetchIssues(workspaceSlug, undefined, groupedIssueIds ? "mutation" : "init-loader", userId, type); } } ); @@ -57,6 +57,8 @@ export const ProfileIssuesPage = observer((props: IProfileIssuesPage) => { ) : null} + {/* peek overview */} + )} diff --git a/web/constants/common.ts b/web/constants/common.ts index de4c0c558..3fac821fa 100644 --- a/web/constants/common.ts +++ b/web/constants/common.ts @@ -1,7 +1 @@ export const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB - -export const isNil = (value: any) => { - if (value === undefined || value === null) return true; - - return false; -}; diff --git a/web/store/issue/helpers/issue-filter-helper.store.ts b/web/store/issue/helpers/issue-filter-helper.store.ts index 352b641de..2474d6019 100644 --- a/web/store/issue/helpers/issue-filter-helper.store.ts +++ b/web/store/issue/helpers/issue-filter-helper.store.ts @@ -11,7 +11,6 @@ import { TStaticViewTypes, } from "@plane/types"; // constants -import { isNil } from "constants/common"; import { EIssueFilterType, EIssuesStoreType } from "constants/issue"; // lib import { storage } from "lib/local-storage"; @@ -76,8 +75,8 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore { target_date: filters?.target_date || undefined, // display filters type: displayFilters?.type || undefined, - sub_issue: isNil(displayFilters?.sub_issue) ? true : displayFilters?.sub_issue, - start_target_date: isNil(displayFilters?.start_target_date) ? true : displayFilters?.start_target_date, + sub_issue: displayFilters?.sub_issue ?? true, + start_target_date: displayFilters?.start_target_date ?? true, }; const issueFiltersParams: Partial> = {}; @@ -169,19 +168,19 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore { * @returns {IIssueDisplayProperties} */ computedDisplayProperties = (displayProperties: IIssueDisplayProperties): IIssueDisplayProperties => ({ - assignee: displayProperties?.assignee || false, - start_date: displayProperties?.start_date || false, - due_date: displayProperties?.due_date || false, - labels: displayProperties?.labels || false, - priority: displayProperties?.priority || false, - state: displayProperties?.state || false, - sub_issue_count: displayProperties?.sub_issue_count || false, - attachment_count: displayProperties?.attachment_count || false, - estimate: displayProperties?.estimate || false, - link: displayProperties?.link || false, - key: displayProperties?.key || false, - created_on: displayProperties?.created_on || false, - updated_on: displayProperties?.updated_on || false, + assignee: displayProperties?.assignee ?? true, + start_date: displayProperties?.start_date ?? true, + due_date: displayProperties?.due_date ?? true, + labels: displayProperties?.labels ?? true, + priority: displayProperties?.priority ?? true, + state: displayProperties?.state ?? true, + sub_issue_count: displayProperties?.sub_issue_count ?? true, + attachment_count: displayProperties?.attachment_count ?? true, + link: displayProperties?.link ?? true, + estimate: displayProperties?.estimate ?? true, + key: displayProperties?.key ?? true, + created_on: displayProperties?.created_on ?? true, + updated_on: displayProperties?.updated_on ?? true, }); handleIssuesLocalFilters = { diff --git a/web/store/issue/profile/filter.store.ts b/web/store/issue/profile/filter.store.ts index e7d33c48b..3ec5aed6f 100644 --- a/web/store/issue/profile/filter.store.ts +++ b/web/store/issue/profile/filter.store.ts @@ -183,10 +183,10 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf _filters.displayFilters.sub_group_by = null; updatedDisplayFilters.sub_group_by = null; } - // set group_by to state if layout is switched to kanban and group_by is null + // set group_by to priority if layout is switched to kanban and group_by is null if (_filters.displayFilters.layout === "kanban" && _filters.displayFilters.group_by === null) { - _filters.displayFilters.group_by = "state"; - updatedDisplayFilters.group_by = "state"; + _filters.displayFilters.group_by = "priority"; + updatedDisplayFilters.group_by = "priority"; } runInAction(() => { diff --git a/web/store/issue/profile/issue.store.ts b/web/store/issue/profile/issue.store.ts index d9c727fce..e754758cc 100644 --- a/web/store/issue/profile/issue.store.ts +++ b/web/store/issue/profile/issue.store.ts @@ -97,7 +97,9 @@ export class ProfileIssues extends IssueHelperStore implements IProfileIssues { const orderBy = displayFilters?.order_by; const layout = displayFilters?.layout; - const userIssueIds = this.issues[userId][currentView] ?? []; + const userIssueIds = this.issues[userId]?.[currentView]; + + if (!userIssueIds) return; const _issues = this.rootStore.issues.getIssuesByIds(userIssueIds); if (!_issues) return undefined; diff --git a/web/store/issue/root.store.ts b/web/store/issue/root.store.ts index edde040c4..1f20a4151 100644 --- a/web/store/issue/root.store.ts +++ b/web/store/issue/root.store.ts @@ -123,6 +123,7 @@ export class IssueRootStore implements IIssueRootStore { moduleId: observable.ref, viewId: observable.ref, userId: observable.ref, + globalViewId: observable.ref, states: observable, stateDetails: observable, labels: observable,