+
+ {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 &&
+