Skip to content

Commit 3c0555d

Browse files
feat: search as virtual tab instead of modal, inline rendering support
1 parent bd1805a commit 3c0555d

5 files changed

Lines changed: 26 additions & 7 deletions

File tree

crates/tauri-app/frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function App() {
155155
}
156156
if (mod && e.shiftKey && key === "f") {
157157
e.preventDefault();
158-
setStore("searchOpen", !store.searchOpen);
158+
appStore.openVirtualTab("__search__");
159159
}
160160
if (mod && key === "\\") {
161161
e.preventDefault();

crates/tauri-app/frontend/src/components/chat/ChatArea.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ThinkingBlock } from "./ThinkingBlock";
77
import { ThreadSetup } from "./ThreadSetup";
88
import { McpPanel } from "../sidebar/McpPanel";
99
import { ThemeSelector } from "../settings/ThemeSelector";
10+
import { SearchOverlay } from "../shared/SearchOverlay";
1011
import type { ContentBlock } from "../../types";
1112

1213
export function ChatArea() {
@@ -163,6 +164,11 @@ export function ChatArea() {
163164
<ThemeSelector inline />
164165
</div>
165166
</Show>
167+
<Show when={store.activeTab === "__search__"}>
168+
<div class="virtual-tab-content">
169+
<SearchOverlay inline />
170+
</div>
171+
</Show>
166172

167173
{/* Regular chat content */}
168174
<Show when={!isVirtualTab()}>

crates/tauri-app/frontend/src/components/shared/SearchOverlay.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface GroupedResults {
1010
messages: SearchResult[];
1111
}
1212

13-
export function SearchOverlay() {
13+
export function SearchOverlay(props?: { inline?: boolean }) {
1414
const { store, setStore } = appStore;
1515
const [query, setQuery] = createSignal("");
1616
const [results, setResults] = createSignal<SearchResult[]>([]);
@@ -102,10 +102,8 @@ export function SearchOverlay() {
102102
);
103103
}
104104

105-
return (
106-
<Show when={store.searchOpen}>
107-
<div class="search-backdrop" onClick={(e) => { if (e.target === e.currentTarget) close(); }}>
108-
<div class="search-panel">
105+
const searchContent = (
106+
<div class={props?.inline ? "search-panel-inline" : "search-panel"}>
109107
<div class="search-input-row">
110108
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
111109
<circle cx="11" cy="11" r="8" /><line x1="21" y1="21" x2="16.65" y2="16.65" />
@@ -161,6 +159,14 @@ export function SearchOverlay() {
161159
</Show>
162160
</div>
163161
</div>
162+
);
163+
164+
if (props?.inline) return searchContent;
165+
166+
return (
167+
<Show when={store.searchOpen}>
168+
<div class="search-backdrop" onClick={(e) => { if (e.target === e.currentTarget) close(); }}>
169+
{searchContent}
164170
</div>
165171
</Show>
166172
);
@@ -170,6 +176,12 @@ if (!document.getElementById("search-overlay-styles")) {
170176
const style = document.createElement("style");
171177
style.id = "search-overlay-styles";
172178
style.textContent = `
179+
.search-panel-inline {
180+
max-width: 680px;
181+
margin: 0 auto;
182+
padding: 24px;
183+
width: 100%;
184+
}
173185
.search-backdrop {
174186
position: fixed;
175187
inset: 0;

crates/tauri-app/frontend/src/components/sidebar/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function Sidebar() {
128128
</svg>
129129
Themes
130130
</button>
131-
<button class="sidebar-action" onClick={() => setStore("searchOpen", true)} title="Search (Cmd+Shift+F)">
131+
<button class="sidebar-action" onClick={() => appStore.openVirtualTab("__search__")} title="Search (Cmd+Shift+F)">
132132
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
133133
<circle cx="11" cy="11" r="8" /><line x1="21" y1="21" x2="16.65" y2="16.65" />
134134
</svg>

crates/tauri-app/frontend/src/components/tabs/TabBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function SortableTab(props: { tabId: string; index: number }) {
7373
<span class="tab-label">{
7474
props.tabId === "__mcp__" ? "MCP Servers" :
7575
props.tabId === "__themes__" ? "Themes" :
76+
props.tabId === "__search__" ? "Search" :
7677
props.tabId === "__settings__" ? "Settings" :
7778
thread()?.title || "..."
7879
}</span>

0 commit comments

Comments
 (0)