fix: cmd-k context key for tab reset and Enter-to-navigate on admin pages
Some checks failed
Some checks failed
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -533,17 +533,23 @@ function LayoutContent() {
|
||||
|
||||
const handlePaletteSubmit = useCallback((query: string) => {
|
||||
if (isAdminPage) {
|
||||
// Navigate to top result — CommandPalette calls onSelect for the top result
|
||||
// when Enter is pressed, so this is only reached if there are no results.
|
||||
// Navigate to RBAC page as fallback.
|
||||
navigate('/admin/rbac');
|
||||
// Find first matching admin result and navigate to it
|
||||
const q = query.toLowerCase();
|
||||
const match = adminSearchData.find(
|
||||
(r) => r.title.toLowerCase().includes(q) || r.meta.toLowerCase().includes(q),
|
||||
);
|
||||
if (match) {
|
||||
handlePaletteSelect(match);
|
||||
} else {
|
||||
navigate('/admin/rbac');
|
||||
}
|
||||
} else {
|
||||
const baseParts = ['/exchanges'];
|
||||
if (scope.appId) baseParts.push(scope.appId);
|
||||
if (scope.routeId) baseParts.push(scope.routeId);
|
||||
navigate(`${baseParts.join('/')}?text=${encodeURIComponent(query)}`);
|
||||
}
|
||||
}, [isAdminPage, navigate, scope.appId, scope.routeId]);
|
||||
}, [isAdminPage, adminSearchData, handlePaletteSelect, navigate, scope.appId, scope.routeId]);
|
||||
|
||||
const handleSidebarNavigate = useCallback((path: string) => {
|
||||
const state = { sidebarReveal: path };
|
||||
@@ -658,6 +664,7 @@ function LayoutContent() {
|
||||
onLogout={handleLogout}
|
||||
/>
|
||||
<CommandPalette
|
||||
key={isAdminPage ? 'admin' : 'ops'}
|
||||
open={paletteOpen}
|
||||
onClose={() => setPaletteOpen(false)}
|
||||
onOpen={() => setPaletteOpen(true)}
|
||||
|
||||
Reference in New Issue
Block a user