🆙 Complete rebuild of toolbar / catalog / inventory make it 100% mobile friendly Take #1

This commit is contained in:
duckietm
2026-05-29 11:30:17 +02:00
parent fbcda88cd3
commit d0c11f047a
19 changed files with 680 additions and 488 deletions
+19 -2
View File
@@ -1,10 +1,24 @@
import { NavigatorSearchComposer, NavigatorSearchEvent, NavigatorSearchResultSet } from '@nitrots/nitro-renderer';
import { NavigatorSearchComposer, NavigatorSearchEvent,
NavigatorSearchResultSet } from '@nitrots/nitro-renderer';
import { useEffect, useState } from 'react';
import { SendMessageComposer } from '../../api';
import { useMessageEvent } from '../events';
import { useNavigatorUiStore } from './navigatorUiStore';
/**
* Navigator search hook.
*
* Fires NavigatorSearchComposer(tabCode, filter) whenever the active tab
* or filter changes (skipped when tabCode is '' — initial state, before
* metadata arrives). Holds the latest NavigatorSearchResultSet that
* matches the active tab.
*
* The TanStack Query variant (see useNitroQuery) was tried earlier but
* its one-shot listener doesn't always reach NavigatorSearchEvent in
* production builds with older renderer SDKs; the persistent
* useMessageEvent listener used here matches the rest of the codebase
* and reliably catches every server push.
*/
export const useNavigatorSearch = () =>
{
const tabCode = useNavigatorUiStore(s => s.currentTabCode);
@@ -26,6 +40,9 @@ export const useNavigatorSearch = () =>
const result = event.getParser()?.result;
if(!result) return;
// Accept any incoming result for the currently active tab. Server
// can push extra results unprompted (e.g. after a room is
// created); accepting them keeps the panel in sync.
if(tabCode && result.code !== tabCode) return;
setSearchResult(result);