feat: update main chat and system chat UI
This commit is contained in:
@@ -20,6 +20,11 @@ type SearchLayerContextValue = SearchLayerSnapshot & {
|
||||
|
||||
const SearchLayerContext = createContext<SearchLayerContextValue | null>(null);
|
||||
const PREVIEW_APP_SELECTION_ID = 'page:preview:app';
|
||||
const PLAY_APP_SELECTION_PREFIX = 'page:play:app:';
|
||||
|
||||
function isPlayAppSelectionId(selectionId: string) {
|
||||
return selectionId.startsWith(PLAY_APP_SELECTION_PREFIX);
|
||||
}
|
||||
|
||||
function appendSelection(
|
||||
previous: SearchWindowSelection[],
|
||||
@@ -34,6 +39,10 @@ function appendSelection(
|
||||
return [...previous.filter((item) => item.id !== PREVIEW_APP_SELECTION_ID), nextSelection];
|
||||
}
|
||||
|
||||
if (isPlayAppSelectionId(selection.id)) {
|
||||
return [...previous.filter((item) => !isPlayAppSelectionId(item.id)), nextSelection];
|
||||
}
|
||||
|
||||
return [...previous, nextSelection];
|
||||
}
|
||||
|
||||
@@ -101,7 +110,7 @@ export function SearchLayerProvider({ children }: PropsWithChildren) {
|
||||
pushRecentSearchOption(option.id, mode);
|
||||
setRecentOptions(resolveRecentSearchOptions(options, mode));
|
||||
|
||||
if (mode === 'window' || option.id === 'page:preview:app') {
|
||||
if (mode === 'window' || option.id === PREVIEW_APP_SELECTION_ID) {
|
||||
setOpen(false);
|
||||
appendWindowSelection(option);
|
||||
(option.onSelectWindow ?? option.onSelect)();
|
||||
|
||||
Reference in New Issue
Block a user