fix: project modal shortcut (#5353)
This commit is contained in:
parent
041f2b16c3
commit
4792c1cdf5
3 changed files with 29 additions and 54 deletions
|
|
@ -212,7 +212,6 @@ export const CommandPalette: FC = observer(() => {
|
||||||
toggleCreatePageModal,
|
toggleCreatePageModal,
|
||||||
toggleCreateProjectModal,
|
toggleCreateProjectModal,
|
||||||
toggleCreateViewModal,
|
toggleCreateViewModal,
|
||||||
toggleShortcutModal,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -261,15 +260,18 @@ export const CommandPalette: FC = observer(() => {
|
||||||
if (
|
if (
|
||||||
Object.keys(shortcutsList.global).includes(keyPressed) &&
|
Object.keys(shortcutsList.global).includes(keyPressed) &&
|
||||||
((!projectId && performAnyProjectCreateActions()) || performProjectCreateActions())
|
((!projectId && performAnyProjectCreateActions()) || performProjectCreateActions())
|
||||||
)
|
) {
|
||||||
shortcutsList.global[keyPressed].action();
|
shortcutsList.global[keyPressed].action();
|
||||||
|
}
|
||||||
// workspace authorized actions
|
// workspace authorized actions
|
||||||
else if (
|
else if (
|
||||||
Object.keys(shortcutsList.workspace).includes(keyPressed) &&
|
Object.keys(shortcutsList.workspace).includes(keyPressed) &&
|
||||||
workspaceSlug &&
|
workspaceSlug &&
|
||||||
performWorkspaceCreateActions()
|
performWorkspaceCreateActions()
|
||||||
)
|
) {
|
||||||
|
e.preventDefault();
|
||||||
shortcutsList.workspace[keyPressed].action();
|
shortcutsList.workspace[keyPressed].action();
|
||||||
|
}
|
||||||
// project authorized actions
|
// project authorized actions
|
||||||
else if (
|
else if (
|
||||||
Object.keys(shortcutsList.project).includes(keyPressed) &&
|
Object.keys(shortcutsList.project).includes(keyPressed) &&
|
||||||
|
|
@ -283,16 +285,18 @@ export const CommandPalette: FC = observer(() => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
performAnyProjectCreateActions,
|
|
||||||
performProjectCreateActions,
|
|
||||||
performProjectBulkDeleteActions,
|
|
||||||
performWorkspaceCreateActions,
|
|
||||||
copyIssueUrlToClipboard,
|
copyIssueUrlToClipboard,
|
||||||
isAnyModalOpen,
|
isAnyModalOpen,
|
||||||
|
platform,
|
||||||
|
performAnyProjectCreateActions,
|
||||||
|
performProjectBulkDeleteActions,
|
||||||
|
performProjectCreateActions,
|
||||||
|
performWorkspaceCreateActions,
|
||||||
projectId,
|
projectId,
|
||||||
setTrackElement,
|
setTrackElement,
|
||||||
shortcutsList,
|
shortcutsList,
|
||||||
toggleCommandPaletteModal,
|
toggleCommandPaletteModal,
|
||||||
|
toggleShortcutModal,
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect, Fragment, FC, useState } from "react";
|
import { useEffect, FC, useState } from "react";
|
||||||
import { Dialog, Transition } from "@headlessui/react";
|
// ui
|
||||||
|
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";
|
||||||
// components
|
// components
|
||||||
import { CreateProjectForm } from "@/plane-web/components/projects/create/root";
|
import { CreateProjectForm } from "@/plane-web/components/projects/create/root";
|
||||||
import { TProject } from "@/plane-web/types/projects";
|
import { TProject } from "@/plane-web/types/projects";
|
||||||
|
|
@ -38,32 +39,7 @@ export const CreateProjectModal: FC<Props> = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={isOpen} as={Fragment}>
|
<ModalCore isOpen={isOpen} handleClose={onClose} position={EModalPosition.TOP} width={EModalWidth.XXL}>
|
||||||
<Dialog as="div" className="relative z-20" onClose={onClose}>
|
|
||||||
<Transition.Child
|
|
||||||
as={Fragment}
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enterFrom="opacity-0"
|
|
||||||
enterTo="opacity-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leaveFrom="opacity-100"
|
|
||||||
leaveTo="opacity-0"
|
|
||||||
>
|
|
||||||
<div className="fixed inset-0 bg-custom-backdrop transition-opacity" />
|
|
||||||
</Transition.Child>
|
|
||||||
|
|
||||||
<div className="fixed inset-0 z-20 overflow-y-auto">
|
|
||||||
<div className="my-10 flex items-center justify-center p-4 text-center sm:p-0 md:my-20">
|
|
||||||
<Transition.Child
|
|
||||||
as={Fragment}
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
||||||
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
|
||||||
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
||||||
>
|
|
||||||
<Dialog.Panel className="w-full transform rounded-lg bg-custom-background-100 p-3 text-left shadow-custom-shadow-md transition-all sm:w-3/5 lg:w-1/2 xl:w-2/5">
|
|
||||||
{currentStep === EProjectCreationSteps.CREATE_PROJECT && (
|
{currentStep === EProjectCreationSteps.CREATE_PROJECT && (
|
||||||
<CreateProjectForm
|
<CreateProjectForm
|
||||||
setToFavorite={setToFavorite}
|
setToFavorite={setToFavorite}
|
||||||
|
|
@ -76,11 +52,6 @@ export const CreateProjectModal: FC<Props> = (props) => {
|
||||||
{currentStep === EProjectCreationSteps.FEATURE_SELECTION && (
|
{currentStep === EProjectCreationSteps.FEATURE_SELECTION && (
|
||||||
<ProjectFeatureUpdate projectId={createdProjectId} workspaceSlug={workspaceSlug} onClose={onClose} />
|
<ProjectFeatureUpdate projectId={createdProjectId} workspaceSlug={workspaceSlug} onClose={onClose} />
|
||||||
)}
|
)}
|
||||||
</Dialog.Panel>
|
</ModalCore>
|
||||||
</Transition.Child>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Dialog>
|
|
||||||
</Transition.Root>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const ProjectCreateButtons: React.FC<Props> = (props) => {
|
||||||
} = useFormContext<IProject>();
|
} = useFormContext<IProject>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-end gap-2 pt-4 border-t border-custom-border-100">
|
<div className="flex justify-end gap-2 py-4 border-t border-custom-border-100">
|
||||||
<Button variant="neutral-primary" size="sm" onClick={handleClose} tabIndex={6}>
|
<Button variant="neutral-primary" size="sm" onClick={handleClose} tabIndex={6}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue