fix: workspace name and breadcrumb title , refactor: command palette (#290)

* refactor: command pallette

* fix: workspace name trim

* fix: breadcrumb title responsiveness added
This commit is contained in:
Anmol Singh Bhatia 2023-02-16 18:01:14 +05:30 committed by GitHub
parent 6ed5c05164
commit a28be95002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View File

@ -44,10 +44,10 @@ const BreadcrumbItem: React.FC<BreadcrumbItemProps> = ({ title, link, icon }) =>
</a> </a>
</Link> </Link>
) : ( ) : (
<div className="px-3 text-sm"> <div className="px-3 text-sm max-w-64">
<p className={`${icon ? "flex items-center gap-2" : ""}`}> <p className={`${icon ? "flex items-center gap-2" : ""}`}>
{icon} {icon}
{title} <span className="break-all">{title}</span>
</p> </p>
</div> </div>
)} )}

View File

@ -102,10 +102,10 @@ export const CommandPalette: React.FC = () => {
!(e.target instanceof HTMLInputElement) && !(e.target instanceof HTMLInputElement) &&
!(e.target as Element).classList?.contains("remirror-editor") !(e.target as Element).classList?.contains("remirror-editor")
) { ) {
if ((e.ctrlKey || e.metaKey) && (e.key === "k" || e.key === "K")) { if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") {
e.preventDefault(); e.preventDefault();
setIsPaletteOpen(true); setIsPaletteOpen(true);
} else if ((e.ctrlKey || e.metaKey) && (e.key === "c" || e.key === "C")) { } else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "c") {
if (e.altKey) { if (e.altKey) {
e.preventDefault(); e.preventDefault();
if (!router.query.issueId) return; if (!router.query.issueId) return;
@ -124,26 +124,23 @@ export const CommandPalette: React.FC = () => {
title: "Some error occurred", title: "Some error occurred",
}); });
}); });
console.log("URL Copied");
} else {
console.log("Text copied");
} }
} else if (e.key === "c" || e.key === "C") { } else if (e.key.toLowerCase() === "c") {
e.preventDefault(); e.preventDefault();
setIsIssueModalOpen(true); setIsIssueModalOpen(true);
} else if (e.key === "p" || e.key === "P") { } else if (e.key.toLowerCase() === "p") {
e.preventDefault(); e.preventDefault();
setIsProjectModalOpen(true); setIsProjectModalOpen(true);
} else if ((e.ctrlKey || e.metaKey) && (e.key === "b" || e.key === "B")) { } else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "b") {
e.preventDefault(); e.preventDefault();
toggleCollapsed(); toggleCollapsed();
} else if (e.key === "h" || e.key === "H") { } else if (e.key.toLowerCase() === "h") {
e.preventDefault(); e.preventDefault();
setIsShortcutsModalOpen(true); setIsShortcutsModalOpen(true);
} else if (e.key === "q" || e.key === "Q") { } else if (e.key.toLowerCase() === "q") {
e.preventDefault(); e.preventDefault();
setIsCreateCycleModalOpen(true); setIsCreateCycleModalOpen(true);
} else if (e.key === "m" || e.key === "M") { } else if (e.key.toLowerCase() === "m") {
e.preventDefault(); e.preventDefault();
setIsCreateModuleModalOpen(true); setIsCreateModuleModalOpen(true);
} else if (e.key === "Delete") { } else if (e.key === "Delete") {

View File

@ -107,7 +107,10 @@ const CreateWorkspace: NextPage = () => {
placeholder="Enter name" placeholder="Enter name"
autoComplete="off" autoComplete="off"
onChange={(e) => onChange={(e) =>
setValue("slug", e.target.value.toLocaleLowerCase().replace(/ /g, "-")) setValue(
"slug",
e.target.value.toLocaleLowerCase().trim().replace(/ /g, "-")
)
} }
validations={{ validations={{
required: "Workspace name is required", required: "Workspace name is required",