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) => {
|
const handlePaletteSubmit = useCallback((query: string) => {
|
||||||
if (isAdminPage) {
|
if (isAdminPage) {
|
||||||
// Navigate to top result — CommandPalette calls onSelect for the top result
|
// Find first matching admin result and navigate to it
|
||||||
// when Enter is pressed, so this is only reached if there are no results.
|
const q = query.toLowerCase();
|
||||||
// Navigate to RBAC page as fallback.
|
const match = adminSearchData.find(
|
||||||
|
(r) => r.title.toLowerCase().includes(q) || r.meta.toLowerCase().includes(q),
|
||||||
|
);
|
||||||
|
if (match) {
|
||||||
|
handlePaletteSelect(match);
|
||||||
|
} else {
|
||||||
navigate('/admin/rbac');
|
navigate('/admin/rbac');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const baseParts = ['/exchanges'];
|
const baseParts = ['/exchanges'];
|
||||||
if (scope.appId) baseParts.push(scope.appId);
|
if (scope.appId) baseParts.push(scope.appId);
|
||||||
if (scope.routeId) baseParts.push(scope.routeId);
|
if (scope.routeId) baseParts.push(scope.routeId);
|
||||||
navigate(`${baseParts.join('/')}?text=${encodeURIComponent(query)}`);
|
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 handleSidebarNavigate = useCallback((path: string) => {
|
||||||
const state = { sidebarReveal: path };
|
const state = { sidebarReveal: path };
|
||||||
@@ -658,6 +664,7 @@ function LayoutContent() {
|
|||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
/>
|
/>
|
||||||
<CommandPalette
|
<CommandPalette
|
||||||
|
key={isAdminPage ? 'admin' : 'ops'}
|
||||||
open={paletteOpen}
|
open={paletteOpen}
|
||||||
onClose={() => setPaletteOpen(false)}
|
onClose={() => setPaletteOpen(false)}
|
||||||
onOpen={() => setPaletteOpen(true)}
|
onOpen={() => setPaletteOpen(true)}
|
||||||
|
|||||||
Reference in New Issue
Block a user