diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 2408d7c..8c51d28 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1430,6 +1430,37 @@ function ChangelogModal({ user, toast, onClose, onRead }) { ); } +function SearchResultItem({ item, idx, activeIdx, onNavigate, onHover }) { + const isActive = idx === activeIdx; + let icon = '❓', primary = '', secondary = ''; + if (item.type==='tool') { icon=item.icon||'πŸ› '; primary=item.label; secondary=item.sub||'Navigation'; } + if (item.type==='devtool') { icon=item.icon||'πŸ”§'; primary=item.label; secondary='Dev-Tools'; } + if (item.type==='link') { + const hasCustom = item.icon && item.icon !== 'πŸ”—'; + icon = hasCustom ? item.icon : 'πŸ”—'; + primary = item.title; secondary = item.url; + } + if (item.type==='snippet') { icon='πŸ“„'; primary=item.title; secondary=`Code Β· ${item.language||''}`; } + if (item.type==='calc') { icon='πŸ–¨'; primary=item.name; secondary='3D-Archiv'; } + if (item.type==='order') { icon='πŸ“¦'; primary=item.name; secondary=`Bestellung Β· ${item.status||''}`; } + return ( +
onNavigate(item)} onMouseEnter={()=>onHover(idx)} + style={{display:'flex',alignItems:'center',gap:10,padding:'9px 14px',cursor:'pointer', + background:isActive?'rgba(78,205,196,0.1)':'transparent', + borderBottom:'1px solid rgba(255,255,255,0.04)'}}> + {icon} +
+
{primary}
+
{secondary}
+
+ {item.type==='link' && β†—} + {(item.type==='tool'||item.type==='devtool') && β†’} +
+ ); +} + // ── Globale Suche ───────────────────────────────────────────────────────────── // Statischer Such-Index fΓΌr Tools & Dev-Tools Sub-Tools const SEARCH_TOOL_INDEX = [ @@ -1520,38 +1551,7 @@ function GlobalSearch({ setActive, setDevToolsNav, mobile }) { else if (e.key === 'Escape') { close(); inputRef.current?.blur(); } }; - const ResultItem = ({item, idx}) => { - const isActive = idx === active; - let icon = 'πŸ”', primary = '', secondary = ''; - if (item.type==='tool') { icon=item.icon; primary=item.label; secondary=item.sub||'Navigation'; } - if (item.type==='devtool') { icon=item.icon; primary=item.label; secondary='Dev-Tools'; } - if (item.type==='link') { - const hasCustomIcon = item.icon && item.icon!=='πŸ”—'; - icon = hasCustomIcon ? item.icon : 'πŸ”—'; - primary = item.title; secondary = item.url; - } - if (item.type==='snippet') { icon='πŸ“„'; primary=item.title; secondary=`Code Β· ${item.language||''}`; } - if (item.type==='calc') { icon='πŸ–¨'; primary=item.name; secondary='3D-Archiv'; } - if (item.type==='order') { icon='πŸ“¦'; primary=item.name; secondary=`Bestellung Β· ${item.status||''}`; } - return ( -
navigate(item)} - onMouseEnter={()=>setActiveR(idx)} - style={{display:'flex',alignItems:'center',gap:10,padding:'9px 14px',cursor:'pointer', - background:isActive?'rgba(78,205,196,0.1)':'transparent', - borderBottom:'1px solid rgba(255,255,255,0.04)'}}> - {icon} -
-
{primary}
-
{secondary}
-
- {item.type==='link' && β†—} - {(item.type==='tool'||item.type==='devtool') && β†’} -
- ); - }; const hasResults = allItems.length > 0; const showDropdown = !!query.trim() && results !== null; @@ -1595,13 +1595,13 @@ function GlobalSearch({ setActive, setDevToolsNav, mobile }) { {results.static?.length>0 && (
NAVIGATION
- {results.static.map((item,i)=>)} + {results.static.map((item,i)=>)}
)} {results.links?.length>0 && (
LINKS
- {results.links.map((item,i)=>)} + {results.links.map((item,i)=>)}
)} {results.snippets?.length>0 && ( @@ -1609,7 +1609,7 @@ function GlobalSearch({ setActive, setDevToolsNav, mobile }) {
CODE-SCHNIPSEL
{results.snippets.map((item,i)=>{ const off=results.static.length+(results.links||[]).length; - return ; + return ; })} )} @@ -1618,7 +1618,7 @@ function GlobalSearch({ setActive, setDevToolsNav, mobile }) {
3D-ARCHIV
{results.calculations.map((item,i)=>{ const off=results.static.length+(results.links||[]).length+(results.snippets||[]).length; - return ; + return ; })} )} @@ -1627,7 +1627,7 @@ function GlobalSearch({ setActive, setDevToolsNav, mobile }) {
BESTELLUNGEN
{results.orders.map((item,i)=>{ const off=results.static.length+(results.links||[]).length+(results.snippets||[]).length+(results.calculations||[]).length; - return ; + return ; })} )} @@ -1655,8 +1655,6 @@ function Dashboard({ toast, mobile, setActive, setDevToolsNav, unreadMsgs=0, unr {showBoard && setShowBoard(false)} onRead={onBoardRead}/>} {showChangelog && setShowChangelog(false)} onRead={onChangelogRead}/>} - {/* Globale Suche */} -
@@ -1683,6 +1681,8 @@ function Dashboard({ toast, mobile, setActive, setDevToolsNav, unreadMsgs=0, unr color:'rgba(255,255,255,0.4)', cursor:'pointer', padding:'6px 10px', fontSize:14, fontFamily:'monospace', marginTop:2, flexShrink:0 }}>β†Ί
+ {/* Globale Suche */} +