- Remove unnecessary use of UseAppRouter from store and

replace with  useParams
- Make necessary changes for the `anchor` prop in pages
This commit is contained in:
Satish Gandham
2024-06-18 13:25:41 +05:30
parent e6cb68dfcf
commit 652330a2bc
4 changed files with 12 additions and 10 deletions

View File

@@ -1,13 +1,14 @@
import { useState } from "react";
import { observer } from "mobx-react";
// ui
import { useParams } from "next/navigation";
import { ArchiveIcon, Tooltip } from "@plane/ui";
// constants
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
// helpers
import { cn } from "@/helpers/common.helper";
// hooks
import { useAppRouter, useIssueDetail, useProjectState } from "@/hooks/store";
import { useIssueDetail, useProjectState } from "@/hooks/store";
// plane web components
import { BulkArchiveConfirmationModal } from "@/plane-web/components/issues";
@@ -21,7 +22,7 @@ export const BulkArchiveIssues: React.FC<Props> = observer((props) => {
// states
const [isBulkArchiveModalOpen, setIsBulkArchiveModalOpen] = useState(false);
// store hooks
const { projectId, workspaceSlug } = useAppRouter();
const { projectId, workspaceSlug } = useParams();
const {
issue: { getIssueById },
} = useIssueDetail();
@@ -42,8 +43,8 @@ export const BulkArchiveIssues: React.FC<Props> = observer((props) => {
handleClose={() => setIsBulkArchiveModalOpen(false)}
issueIds={selectedIssueIds}
onSubmit={handleClearSelection}
projectId={projectId}
workspaceSlug={workspaceSlug}
projectId={projectId.toString()}
workspaceSlug={workspaceSlug.toString()}
/>
)}
<Tooltip

View File

@@ -1,10 +1,9 @@
import { useState } from "react";
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
import { Trash2 } from "lucide-react";
// ui
import { Tooltip } from "@plane/ui";
// hooks
import { useAppRouter } from "@/hooks/store";
// plane web components
import { BulkDeleteConfirmationModal } from "@/plane-web/components/issues";
@@ -18,7 +17,7 @@ export const BulkDeleteIssues: React.FC<Props> = observer((props) => {
// states
const [isBulkDeleteModalOpen, setIsBulkDeleteModalOpen] = useState(false);
// store hooks
const { projectId, workspaceSlug } = useAppRouter();
const { projectId, workspaceSlug } = useParams();
return (
<>

View File

@@ -1,9 +1,8 @@
import { useState } from "react";
import { observer } from "mobx-react";
// ui
import { useParams } from "next/navigation";
import { SubscribeIcon, Tooltip } from "@plane/ui";
// hooks
import { useAppRouter } from "@/hooks/store";
// plane web components
import { BulkSubscribeConfirmationModal } from "@/plane-web/components/issues";
@@ -17,7 +16,7 @@ export const BulkSubscribeIssues: React.FC<Props> = observer((props) => {
// states
const [isBulkSubscribeModalOpen, setIsBulkSubscribeModalOpen] = useState(false);
// store hooks
const { projectId, workspaceSlug } = useAppRouter();
const { projectId, workspaceSlug } = useParams();
return (
<>

View File

@@ -57,6 +57,7 @@ export class WorkspacePageDetails implements IWorkspacePageDetails {
label_ids: string[] | undefined;
owned_by: string | undefined;
access: EPageAccess | undefined;
anchor?: string | null | undefined;
is_favorite: boolean;
is_locked: boolean;
archived_at: string | null | undefined;
@@ -85,6 +86,7 @@ export class WorkspacePageDetails implements IWorkspacePageDetails {
this.label_ids = page?.label_ids || undefined;
this.owned_by = page?.owned_by || undefined;
this.access = page?.access || EPageAccess.PUBLIC;
this.anchor = page?.anchor || undefined;
this.is_favorite = page?.is_favorite || false;
this.is_locked = page?.is_locked || false;
this.archived_at = page?.archived_at || undefined;
@@ -186,6 +188,7 @@ export class WorkspacePageDetails implements IWorkspacePageDetails {
label_ids: this.label_ids,
owned_by: this.owned_by,
access: this.access,
anchor: this.anchor,
logo_props: this.logo_props,
is_favorite: this.is_favorite,
is_locked: this.is_locked,