feat(views): auto-fill project when creating issue via C shortcut on project page

When pressing "C" to create a new issue from a project detail page,
automatically set the project_id so the issue is linked to the current project.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang
2026-04-10 18:23:35 +08:00
parent b52c048c8e
commit bfac473202

View File

@@ -127,12 +127,15 @@ export function AppSidebar({ topSlot, searchSlot, headerClassName, headerStyle }
if (isEditable) return;
if (useModalStore.getState().modal) return;
e.preventDefault();
useModalStore.getState().open("create-issue");
// Auto-fill project when on a project detail page
const projectMatch = pathname.match(/^\/projects\/([^/]+)$/);
const data = projectMatch ? { project_id: projectMatch[1] } : undefined;
useModalStore.getState().open("create-issue", data);
}
};
document.addEventListener("keydown", handleKeyDown);
return () => document.removeEventListener("keydown", handleKeyDown);
}, []);
}, [pathname]);
return (
<Sidebar variant="inset">