From c6f09906052a7100dd2a8883fb4cc2ed5a1d1234 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 13 Feb 2023 20:19:46 +0530 Subject: [PATCH] fix: ui bug (#274) * fix: shortcut search fix shortcut modal ui fixes shortcut search fix email us label change * fix: email us label updated --- .../command-palette/shortcuts-modal.tsx | 65 +++++++++++++------ .../app/components/workspace/help-section.tsx | 2 +- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/apps/app/components/command-palette/shortcuts-modal.tsx b/apps/app/components/command-palette/shortcuts-modal.tsx index c1800ab17..593c68324 100644 --- a/apps/app/components/command-palette/shortcuts-modal.tsx +++ b/apps/app/components/command-palette/shortcuts-modal.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // icons @@ -15,7 +15,7 @@ const shortcuts = [ { title: "Navigation", shortcuts: [ - { keys: "Ctrl,Cmd,K", description: "To open navigator" }, + { keys: "Ctrl,/,Cmd,K", description: "To open navigator" }, { keys: "↑", description: "Move up" }, { keys: "↓", description: "Move down" }, { keys: "←", description: "Move left" }, @@ -34,22 +34,26 @@ const shortcuts = [ { keys: "Delete", description: "To bulk delete issues" }, { keys: "H", description: "To open shortcuts guide" }, { - keys: "Ctrl,Cmd,Alt,C", + keys: "Ctrl,/,Cmd,Alt,C", description: "To copy issue url when on issue detail page.", }, ], }, ]; +const allShortcuts = shortcuts.map((i) => i.shortcuts).flat(1); + export const ShortcutsModal: React.FC = ({ isOpen, setIsOpen }) => { const [query, setQuery] = useState(""); - const filteredShortcuts = shortcuts.filter((shortcut) => - shortcut.shortcuts.some((item) => item.description.includes(query.trim())) || query === "" - ? true - : false + const filteredShortcuts = allShortcuts.filter((shortcut) => + shortcut.description.includes(query.trim()) || query === "" ? true : false ); + useEffect(() => { + if (!isOpen) setQuery(""); + }, [isOpen]); + return ( @@ -104,8 +108,40 @@ export const ShortcutsModal: React.FC = ({ isOpen, setIsOpen }) => { />
- {filteredShortcuts.length > 0 ? ( - filteredShortcuts.map(({ title, shortcuts }) => ( + {query.trim().length > 0 ? ( + filteredShortcuts.length > 0 ? ( + filteredShortcuts.map((shortcut) => ( +
+
+
+

{shortcut.description}

+
+ {shortcut.keys.split(",").map((key, index) => ( + + + {key} + + + ))} +
+
+
+
+ )) + ) : ( +
+

+ No shortcuts found for{" "} + + {`"`} + {query} + {`"`} + +

+
+ ) + ) : ( + shortcuts.map(({ title, shortcuts }) => (

{title}

@@ -126,17 +162,6 @@ export const ShortcutsModal: React.FC = ({ isOpen, setIsOpen }) => {
)) - ) : ( -
-

- No shortcuts found for{" "} - - {`"`} - {query} - {`"`} - -

-
)}
diff --git a/apps/app/components/workspace/help-section.tsx b/apps/app/components/workspace/help-section.tsx index cd6fce3c6..b8ac07e24 100644 --- a/apps/app/components/workspace/help-section.tsx +++ b/apps/app/components/workspace/help-section.tsx @@ -32,7 +32,7 @@ const helpOptions = [ Icon: GithubIcon, }, { - name: "Chat with us", + name: "Email us", href: "mailto:hello@plane.so", Icon: CommentIcon, },