forked from github/plane
fix: view modal overlapping (#2956)
This commit is contained in:
parent
ff03f8badb
commit
43cd0554fb
@ -55,22 +55,10 @@ export const CommandPalette: FC = observer(() => {
|
|||||||
toggleBulkDeleteIssueModal,
|
toggleBulkDeleteIssueModal,
|
||||||
isDeleteIssueModalOpen,
|
isDeleteIssueModalOpen,
|
||||||
toggleDeleteIssueModal,
|
toggleDeleteIssueModal,
|
||||||
|
isAnyModalOpen,
|
||||||
createIssueStoreType,
|
createIssueStoreType,
|
||||||
} = commandPalette;
|
} = commandPalette;
|
||||||
|
|
||||||
const isAnyModalOpen = Boolean(
|
|
||||||
isCreateIssueModalOpen ||
|
|
||||||
isCreateCycleModalOpen ||
|
|
||||||
isCreatePageModalOpen ||
|
|
||||||
isCreateProjectModalOpen ||
|
|
||||||
isCreateModuleModalOpen ||
|
|
||||||
isCreateViewModalOpen ||
|
|
||||||
isShortcutModalOpen ||
|
|
||||||
isBulkDeleteIssueModalOpen ||
|
|
||||||
isDeleteIssueModalOpen
|
|
||||||
);
|
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const { data: issueDetails } = useSWR(
|
const { data: issueDetails } = useSWR(
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { useState } from "react";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
@ -15,18 +14,16 @@ export const ProjectViewsHeader: React.FC = observer(() => {
|
|||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
// states
|
|
||||||
const [createViewModal, setCreateViewModal] = useState(false);
|
|
||||||
|
|
||||||
const { project: projectStore } = useMobxStore();
|
const { project: projectStore, commandPalette } = useMobxStore();
|
||||||
const { currentProjectDetails } = projectStore;
|
const { currentProjectDetails } = projectStore;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{workspaceSlug && projectId && (
|
{workspaceSlug && projectId && (
|
||||||
<CreateUpdateProjectViewModal
|
<CreateUpdateProjectViewModal
|
||||||
isOpen={createViewModal}
|
isOpen={commandPalette.isCreateViewModalOpen}
|
||||||
onClose={() => setCreateViewModal(false)}
|
onClose={() => commandPalette.toggleCreateViewModal(false)}
|
||||||
workspaceSlug={workspaceSlug.toString()}
|
workspaceSlug={workspaceSlug.toString()}
|
||||||
projectId={projectId.toString()}
|
projectId={projectId.toString()}
|
||||||
/>
|
/>
|
||||||
@ -69,7 +66,7 @@ export const ProjectViewsHeader: React.FC = observer(() => {
|
|||||||
variant="primary"
|
variant="primary"
|
||||||
size="sm"
|
size="sm"
|
||||||
prependIcon={<Plus className="h-3.5 w-3.5 stroke-2" />}
|
prependIcon={<Plus className="h-3.5 w-3.5 stroke-2" />}
|
||||||
onClick={() => setCreateViewModal(true)}
|
onClick={() => commandPalette.toggleCreateViewModal(true)}
|
||||||
>
|
>
|
||||||
Create View
|
Create View
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { observable, action, makeObservable } from "mobx";
|
import { observable, action, makeObservable, computed } from "mobx";
|
||||||
// types
|
// types
|
||||||
import { RootStore } from "./root";
|
import { RootStore } from "./root";
|
||||||
// services
|
// services
|
||||||
@ -30,6 +30,9 @@ export interface ICommandPaletteStore {
|
|||||||
isDeleteIssueModalOpen: boolean;
|
isDeleteIssueModalOpen: boolean;
|
||||||
isBulkDeleteIssueModalOpen: boolean;
|
isBulkDeleteIssueModalOpen: boolean;
|
||||||
|
|
||||||
|
// computed
|
||||||
|
isAnyModalOpen: boolean;
|
||||||
|
|
||||||
toggleCommandPaletteModal: (value?: boolean) => void;
|
toggleCommandPaletteModal: (value?: boolean) => void;
|
||||||
toggleShortcutModal: (value?: boolean) => void;
|
toggleShortcutModal: (value?: boolean) => void;
|
||||||
toggleCreateProjectModal: (value?: boolean) => void;
|
toggleCreateProjectModal: (value?: boolean) => void;
|
||||||
@ -77,6 +80,7 @@ class CommandPaletteStore implements ICommandPaletteStore {
|
|||||||
isDeleteIssueModalOpen: observable.ref,
|
isDeleteIssueModalOpen: observable.ref,
|
||||||
isBulkDeleteIssueModalOpen: observable.ref,
|
isBulkDeleteIssueModalOpen: observable.ref,
|
||||||
// computed
|
// computed
|
||||||
|
isAnyModalOpen: computed,
|
||||||
// projectPages: computed,
|
// projectPages: computed,
|
||||||
// action
|
// action
|
||||||
toggleCommandPaletteModal: action,
|
toggleCommandPaletteModal: action,
|
||||||
@ -96,6 +100,20 @@ class CommandPaletteStore implements ICommandPaletteStore {
|
|||||||
this.pageService = new PageService();
|
this.pageService = new PageService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isAnyModalOpen() {
|
||||||
|
return Boolean(
|
||||||
|
this.isCreateIssueModalOpen ||
|
||||||
|
this.isCreateCycleModalOpen ||
|
||||||
|
this.isCreatePageModalOpen ||
|
||||||
|
this.isCreateProjectModalOpen ||
|
||||||
|
this.isCreateModuleModalOpen ||
|
||||||
|
this.isCreateViewModalOpen ||
|
||||||
|
this.isShortcutModalOpen ||
|
||||||
|
this.isBulkDeleteIssueModalOpen ||
|
||||||
|
this.isDeleteIssueModalOpen
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
toggleCommandPaletteModal = (value?: boolean) => {
|
toggleCommandPaletteModal = (value?: boolean) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.isCommandPaletteOpen = value;
|
this.isCommandPaletteOpen = value;
|
||||||
|
Loading…
Reference in New Issue
Block a user