diff --git a/src/components/cmdk/CommandKClient.tsx b/src/components/cmdk/CommandKClient.tsx index 75b5b8e8..96b0b62b 100644 --- a/src/components/cmdk/CommandKClient.tsx +++ b/src/components/cmdk/CommandKClient.tsx @@ -570,97 +570,99 @@ export default function CommandKClient({ // eslint-disable-next-line max-len maskImage: 'linear-gradient(to bottom, transparent, black 20px, black calc(100% - 20px), transparent)', }}> - - {isLoading ? 'Searching ...' : 'No results found'} - -
- {queriedSections - .concat(categorySections) - .concat(sectionPages) - .concat(adminSection) - .concat(clientSections) - .filter(({ items }) => items.length > 0) - .map(({ heading, accessory, items }) => - - {accessory && -
{accessory}
} - {heading} -
} - className={clsx( - 'uppercase', - 'select-none', - '[&>*:first-child]:py-1', - '[&>*:first-child]:font-medium', - '[&>*:first-child]:text-dim', - '[&>*:first-child]:text-xs', - '[&>*:first-child]:tracking-wider', - )} - > - {items.map(({ - label, - explicitKey, - keywords, - accessory, - annotation, - annotationAria, - path, - action, - }) => { - const key = `${heading} ${explicitKey ?? label}`; - return { - if (action) { - const result = action(); - if (result instanceof Promise) { - setKeyWaiting(key); - setIsWaitingForAction(true); - result.then(shouldClose => { - shouldCloseAfterWaiting.current = - shouldClose === true; - setIsWaitingForAction(false); - }); - } else { - if (!path) { setIsOpen?.(false); } +
+ + {isLoading ? 'Searching ...' : 'No results found'} + +
+ {queriedSections + .concat(categorySections) + .concat(sectionPages) + .concat(adminSection) + .concat(clientSections) + .filter(({ items }) => items.length > 0) + .map(({ heading, accessory, items }) => + + {accessory && +
{accessory}
} + {heading} +
} + className={clsx( + 'uppercase', + 'select-none', + '[&>*:first-child]:py-1', + '[&>*:first-child]:font-medium', + '[&>*:first-child]:text-dim', + '[&>*:first-child]:text-xs', + '[&>*:first-child]:tracking-wider', + )} + > + {items.map(({ + label, + explicitKey, + keywords, + accessory, + annotation, + annotationAria, + path, + action, + }) => { + const key = `${heading} ${explicitKey ?? label}`; + return { + if (action) { + const result = action(); + if (result instanceof Promise) { + setKeyWaiting(key); + setIsWaitingForAction(true); + result.then(shouldClose => { + shouldCloseAfterWaiting.current = + shouldClose === true; + setIsWaitingForAction(false); + }); + } else { + if (!path) { setIsOpen?.(false); } + } } - } - if (path) { - if (path !== pathname) { - setKeyWaiting(key); - shouldCloseAfterWaiting.current = true; - startTransition(() => { - router.push(path, { scroll: true }); - }); - } else { - setIsOpen?.(false); + if (path) { + if (path !== pathname) { + setKeyWaiting(key); + shouldCloseAfterWaiting.current = true; + startTransition(() => { + router.push(path, { scroll: true }); + }); + } else { + setIsOpen?.(false); + } } - } - }} - accessory={accessory} - annotation={annotation} - annotationAria={annotationAria} - loading={key === keyWaiting} - disabled={isPending && key !== keyWaiting} - />; - })} - )} + }} + accessory={accessory} + annotation={annotation} + annotationAria={annotationAria} + loading={key === keyWaiting} + disabled={isPending && key !== keyWaiting} + />; + })} + )} +
+ {footer && !queryLive && +
+ {footer} +
} - {footer && !queryLive && -
- {footer} -
}