feat(ui): reconcile backup UI changes with current routing and interaction features
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { NavLink, useLocation } from "react-router-dom";
|
||||
import { NavLink, useLocation } from "@/lib/router";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ChevronRight } from "lucide-react";
|
||||
import { useCompany } from "../context/CompanyContext";
|
||||
@@ -7,7 +7,7 @@ import { useSidebar } from "../context/SidebarContext";
|
||||
import { agentsApi } from "../api/agents";
|
||||
import { heartbeatsApi } from "../api/heartbeats";
|
||||
import { queryKeys } from "../lib/queryKeys";
|
||||
import { cn } from "../lib/utils";
|
||||
import { cn, agentRouteRef, agentUrl } from "../lib/utils";
|
||||
import { AgentIcon } from "./AgentIconPicker";
|
||||
import {
|
||||
Collapsible,
|
||||
@@ -71,7 +71,7 @@ export function SidebarAgents() {
|
||||
return sortByHierarchy(filtered);
|
||||
}, [agents]);
|
||||
|
||||
const agentMatch = location.pathname.match(/^\/agents\/([^/]+)/);
|
||||
const agentMatch = location.pathname.match(/^\/(?:[^/]+\/)?agents\/([^/]+)/);
|
||||
const activeAgentId = agentMatch?.[1] ?? null;
|
||||
|
||||
return (
|
||||
@@ -99,13 +99,13 @@ export function SidebarAgents() {
|
||||
return (
|
||||
<NavLink
|
||||
key={agent.id}
|
||||
to={`/agents/${agent.id}`}
|
||||
to={agentUrl(agent)}
|
||||
onClick={() => {
|
||||
if (isMobile) setSidebarOpen(false);
|
||||
}}
|
||||
className={cn(
|
||||
"flex items-center gap-2.5 px-3 py-1.5 text-[13px] font-medium transition-colors",
|
||||
activeAgentId === agent.id
|
||||
activeAgentId === agentRouteRef(agent)
|
||||
? "bg-accent text-foreground"
|
||||
: "text-foreground/80 hover:bg-accent/50 hover:text-foreground"
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user