diff --git a/app/actions/definitions/navigation.tsx b/app/actions/definitions/navigation.tsx
index 4af4c57b9..0334862db 100644
--- a/app/actions/definitions/navigation.tsx
+++ b/app/actions/definitions/navigation.tsx
@@ -25,7 +25,7 @@ import KeyboardShortcuts from "~/scenes/KeyboardShortcuts";
import { createAction } from "~/actions";
import {
NavigationSection,
- NoSection,
+ SearchSection,
RecentSearchesSection,
} from "~/actions/sections";
import history from "~/utils/history";
@@ -60,7 +60,7 @@ export const navigateToRecentSearchQuery = (searchQuery: SearchQuery) =>
export const navigateToSearchQuery = (searchQuery: string) =>
createAction({
id: "search",
- section: NoSection,
+ section: SearchSection,
name: ({ t }) =>
t(`Search documents for "{{searchQuery}}"`, { searchQuery }),
icon: ,
diff --git a/app/actions/sections.ts b/app/actions/sections.ts
index a387d23a9..39549c6f1 100644
--- a/app/actions/sections.ts
+++ b/app/actions/sections.ts
@@ -15,4 +15,4 @@ export const UserSection = ({ t }: ActionContext) => t("People");
export const RecentSearchesSection = ({ t }: ActionContext) =>
t("Recent searches");
-export const NoSection = "";
+export const SearchSection = "";
diff --git a/app/components/CommandBar.tsx b/app/components/CommandBar.tsx
index 3239ea59e..cfb8fb840 100644
--- a/app/components/CommandBar.tsx
+++ b/app/components/CommandBar.tsx
@@ -42,8 +42,10 @@ function CommandBar() {
t("Type a command or search")
}…`}
/>
-
- {ui.showModKHint && (
+
+ {ui.commandBarOpenedFromSidebar && (
{t(
@@ -77,14 +79,10 @@ const Hint = styled(Text)`
display: flex;
align-items: center;
gap: 4px;
- background: ${(props) => props.theme.secondaryBackground};
border-top: 1px solid ${(props) => props.theme.background};
margin: 1px 0 0;
padding: 6px 16px;
width: 100%;
-
- position: absolute;
- bottom: 0;
`;
const Positioner = styled(KBarPositioner)`
diff --git a/app/components/CommandBarResults.tsx b/app/components/CommandBarResults.tsx
index ad184b705..250269b67 100644
--- a/app/components/CommandBarResults.tsx
+++ b/app/components/CommandBarResults.tsx
@@ -3,15 +3,24 @@ import { orderBy } from "lodash";
import * as React from "react";
import styled from "styled-components";
import CommandBarItem from "~/components/CommandBarItem";
-import { NoSection } from "~/actions/sections";
+import { SearchSection } from "~/actions/sections";
-export default function CommandBarResults() {
+type Props = {
+ prioritizeSearchResults: boolean;
+};
+
+export default function CommandBarResults(props: Props) {
const { results, rootActionId } = useMatches();
return (
- typeof item !== "string" && item.section === NoSection ? -1 : 1
+ // this is an unfortunate hack until kbar supports priority internally
+ typeof item !== "string" &&
+ item.section === SearchSection &&
+ props.prioritizeSearchResults
+ ? -1
+ : 1
)}
maxHeight={400}
onRender={({ item, active }) =>
diff --git a/app/components/Sidebar/App.tsx b/app/components/Sidebar/App.tsx
index 83693360a..aadc53a21 100644
--- a/app/components/Sidebar/App.tsx
+++ b/app/components/Sidebar/App.tsx
@@ -64,7 +64,7 @@ function AppSidebar() {
if (isSearching) {
history.push(searchPath());
} else {
- ui.enableModKHint();
+ ui.commandBarOpened();
query.toggle();
}
}, [ui, location, history, query]);
diff --git a/app/index.tsx b/app/index.tsx
index 4bf59515a..cdf525f26 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -58,8 +58,7 @@ const commandBarOptions = {
exitMs: 200,
},
callbacks: {
- onClose: () => stores.ui.disableModKHint(),
- onQueryChange: () => stores.ui.disableModKHint(),
+ onClose: () => stores.ui.commandBarClosed(),
},
};
diff --git a/app/stores/UiStore.ts b/app/stores/UiStore.ts
index 95494240a..9cb3307a6 100644
--- a/app/stores/UiStore.ts
+++ b/app/stores/UiStore.ts
@@ -40,7 +40,7 @@ class UiStore {
observingUserId: string | undefined;
@observable
- showModKHint = false;
+ commandBarOpenedFromSidebar = false;
@observable
progressBarVisible = false;
@@ -215,13 +215,13 @@ class UiStore {
};
@action
- enableModKHint = () => {
- this.showModKHint = true;
+ commandBarOpened = () => {
+ this.commandBarOpenedFromSidebar = true;
};
@action
- disableModKHint = () => {
- this.showModKHint = false;
+ commandBarClosed = () => {
+ this.commandBarOpenedFromSidebar = false;
};
@action