Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/web/src/components/GraphSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ interface GraphSelectorProps {
onCreateGraph?: () => void;
onEditGraph?: (graph: any) => void;
onDeleteGraph?: (graph: any) => void;
// GraphSelector is mounted in 2–3 responsive slots at once (sidebar, phone
// top-bar, workspace top-bar); each needs a distinct test id so selectors stay
// unique. Defaults to the canonical 'graph-selector' (the workspace mount).
testId?: string;
}

export function GraphSelector({ onCreateGraph, onEditGraph, onDeleteGraph }: GraphSelectorProps) {
export function GraphSelector({ onCreateGraph, onEditGraph, onDeleteGraph, testId = 'graph-selector' }: GraphSelectorProps) {
const { currentGraph, graphHierarchy, selectGraph } = useGraph();
const { currentTeam, currentUser } = useAuth();
const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -229,7 +233,7 @@ export function GraphSelector({ onCreateGraph, onEditGraph, onDeleteGraph }: Gra
<button
ref={buttonRef}
onClick={toggleDropdown}
data-testid="graph-selector"
data-testid={testId}
className="flex items-center space-x-3 w-full p-3 text-left hover:bg-gray-700/80 rounded-xl transition-all duration-200 hover:scale-[1.02] border border-gray-600/30 hover:border-gray-500/50 shadow-lg hover:shadow-xl backdrop-blur-sm bg-gray-800/50"
>
<div className="flex-shrink-0">
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function Layout({ children }: LayoutProps) {
<div className="md:hidden relative z-30 pt-safe">
<div className="flex items-center bg-gray-800/90 backdrop-blur-sm px-3 py-2 border-b border-gray-700/50">
<div className="flex-1 min-w-0">
<GraphSelector />
<GraphSelector testId="graph-selector-mobile" />
</div>
</div>
</div>
Expand Down Expand Up @@ -166,7 +166,7 @@ export function Layout({ children }: LayoutProps) {
{/* Graph Selector */}
{!desktopSidebarCollapsed && (
<div className="border-t border-gray-700">
<GraphSelector />
<GraphSelector testId="graph-selector-sidebar" />
</div>
)}

Expand Down
Loading