mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
feat: shortcuts (#674)
* feat: added shortcut for page and view * fix: shortcut for view * fix: onclick method for views and pages
This commit is contained in:
parent
a18af1cecf
commit
0cf498651c
@ -51,6 +51,8 @@ import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
||||
import { CreateUpdateModuleModal } from "components/modules";
|
||||
import { CreateProjectModal } from "components/project";
|
||||
import { CreateUpdateViewModal } from "components/views";
|
||||
import { CreateUpdatePageModal } from "components/pages";
|
||||
|
||||
import { Spinner } from "components/ui";
|
||||
// helpers
|
||||
import {
|
||||
@ -76,6 +78,7 @@ export const CommandPalette: React.FC = () => {
|
||||
const [isCreateModuleModalOpen, setIsCreateModuleModalOpen] = useState(false);
|
||||
const [isBulkDeleteIssuesModalOpen, setIsBulkDeleteIssuesModalOpen] = useState(false);
|
||||
const [deleteIssueModal, setDeleteIssueModal] = useState(false);
|
||||
const [isCreateUpdatePageModalOpen, setIsCreateUpdatePageModalOpen] = useState(false);
|
||||
|
||||
const [searchTerm, setSearchTerm] = React.useState<string>("");
|
||||
const [results, setResults] = useState<IWorkspaceSearchResults>({
|
||||
@ -193,6 +196,12 @@ export const CommandPalette: React.FC = () => {
|
||||
} else if (e.key.toLowerCase() === "p") {
|
||||
e.preventDefault();
|
||||
setIsProjectModalOpen(true);
|
||||
} else if (e.key.toLowerCase() === "v") {
|
||||
e.preventDefault();
|
||||
setIsCreateViewModalOpen(true);
|
||||
} else if (e.key.toLowerCase() === "d") {
|
||||
e.preventDefault();
|
||||
setIsCreateUpdatePageModalOpen(true);
|
||||
} else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "b") {
|
||||
e.preventDefault();
|
||||
toggleCollapsed();
|
||||
@ -323,6 +332,10 @@ export const CommandPalette: React.FC = () => {
|
||||
handleClose={() => setIsCreateViewModalOpen(false)}
|
||||
isOpen={isCreateViewModalOpen}
|
||||
/>
|
||||
<CreateUpdatePageModal
|
||||
isOpen={isCreateUpdatePageModalOpen}
|
||||
handleClose={() => setIsCreateUpdatePageModalOpen(false)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{issueId && issueDetails && (
|
||||
|
@ -33,6 +33,8 @@ const shortcuts = [
|
||||
{ keys: "C", description: "To create issue" },
|
||||
{ keys: "Q", description: "To create cycle" },
|
||||
{ keys: "M", description: "To create module" },
|
||||
{ keys: "V", description: "To create view" },
|
||||
{ keys: "D", description: "To create page" },
|
||||
{ keys: "Delete", description: "To bulk delete issues" },
|
||||
{ keys: "H", description: "To open shortcuts guide" },
|
||||
{
|
||||
|
@ -27,6 +27,10 @@ export const EmptyState: React.FC<Props> = ({ type, title, description, imgURL,
|
||||
return "P";
|
||||
case "issue":
|
||||
return "C";
|
||||
case "view":
|
||||
return "V";
|
||||
case "page":
|
||||
return "D"
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -167,7 +167,10 @@ const ProjectPages: NextPage<UserAuth> = (props) => {
|
||||
right={
|
||||
<PrimaryButton
|
||||
className="flex items-center gap-2"
|
||||
onClick={() => setCreateUpdatePageModal(true)}
|
||||
onClick={() => {
|
||||
const e = new KeyboardEvent("keydown", { key: "d" });
|
||||
document.dispatchEvent(e);
|
||||
}}
|
||||
>
|
||||
<PlusIcon className="w-4 h-4" />
|
||||
Create Page
|
||||
|
@ -67,7 +67,14 @@ const ProjectViews: NextPage<UserAuth> = (props) => {
|
||||
}
|
||||
right={
|
||||
<div className="flex items-center gap-2">
|
||||
<PrimaryButton type="button" className="flex items-center gap-2" onClick={() => setIsCreateViewModalOpen(true)}>
|
||||
<PrimaryButton
|
||||
type="button"
|
||||
className="flex items-center gap-2"
|
||||
onClick={() => {
|
||||
const e = new KeyboardEvent("keydown", { key: "v" });
|
||||
document.dispatchEvent(e);
|
||||
}}
|
||||
>
|
||||
<PlusIcon className="w-4 h-4" />
|
||||
Create View
|
||||
</PrimaryButton>
|
||||
@ -100,7 +107,6 @@ const ProjectViews: NextPage<UserAuth> = (props) => {
|
||||
title="Create New View"
|
||||
description="Views aid in saving your issues by applying various filters and grouping options."
|
||||
imgURL={emptyView}
|
||||
action={() => setIsCreateViewModalOpen(true)}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
|
Loading…
Reference in New Issue
Block a user