Fix debug tools cmd-k interaction

This commit is contained in:
Sam Becker 2024-03-27 13:22:31 -05:00
parent 3b19ba0425
commit d36a1c5536
2 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,6 @@ import { useTheme } from 'next-themes';
import { BiDesktop, BiMoon, BiSun } from 'react-icons/bi';
import { IoInvertModeSharp } from 'react-icons/io5';
import { useAppState } from '@/state';
import { ADMIN_DEBUG_TOOLS_ENABLED } from '@/site/config';
import { RiToolsFill } from 'react-icons/ri';
const LISTENER_KEYDOWN = 'keydown';
@ -41,10 +40,12 @@ export type CommandKSection = {
export default function CommandKClient({
onQueryChange,
serverSections = [],
showDebugTools,
footer,
}: {
onQueryChange?: (query: string) => Promise<CommandKSection[]>
serverSections?: CommandKSection[]
showDebugTools?: boolean
footer?: string
}) {
const {
@ -156,7 +157,7 @@ export default function CommandKClient({
}],
}];
if (ADMIN_DEBUG_TOOLS_ENABLED) {
if (showDebugTools) {
clientSections.push({
heading: 'Debug Tools',
accessory: <RiToolsFill size={16} className="translate-x-[-1px]" />,

View File

@ -163,6 +163,7 @@ export default async function CommandK() {
}]
: [];
}}
showDebugTools={isAdminLoggedIn && ADMIN_DEBUG_TOOLS_ENABLED}
footer={photoQuantityText(count, false)}
/>;
}