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
10 changes: 5 additions & 5 deletions frontend/src/components/PluginsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function PluginsPanel({ sessionId, onClose }) {
}
});

// State for contextual menu and action toast feedback (#605)
// State for contextual menu and action toast feedback (#602, #605)
const [activeMenuId, setActiveMenuId] = useState(null);
const [notification, setNotification] = useState("");

Expand Down Expand Up @@ -188,7 +188,7 @@ export default function PluginsPanel({ sessionId, onClose }) {
}
}, [input, sessionId]);

// Close contextual action menu on global click or Escape key (#605)
// Close contextual action menu on global click or Escape key (#602, #605)
useEffect(() => {
const handleGlobalClick = () => setActiveMenuId(null);
const handleKeyDown = (e) => {
Expand Down Expand Up @@ -395,7 +395,7 @@ export default function PluginsPanel({ sessionId, onClose }) {
/>
</div>

{/* Plugin selector with favorite & pin toggles (#601), compatibility badges (#597), & contextual menus (#605) */}
{/* Plugin selector with favorite & pin toggles (#601), compatibility badges (#597), & contextual menus (#602, #605) */}
<div data-testid="plugin-selector-list" className="flex flex-wrap gap-2 mb-4 md:mb-3 shrink-0 min-h-[32px]">
{filteredPlugins.length > 0 ? (
filteredPlugins.map((p) => {
Expand Down Expand Up @@ -426,7 +426,7 @@ export default function PluginsPanel({ sessionId, onClose }) {
{isPinned ? "★" : "☆"}
</button>

{/* Context Menu Trigger Button */}
{/* Context Menu Trigger Button (#602) */}
<button
type="button"
onClick={(e) => toggleContextMenu(e, p.id)}
Expand All @@ -436,7 +436,7 @@ export default function PluginsPanel({ sessionId, onClose }) {
</button>

{/* Context Dropdown Menu (#605) */}
{/* Context Dropdown Menu (#602, #605) */}
{isMenuOpen && (
<div
onClick={(e) => e.stopPropagation()}
Expand Down
38 changes: 38 additions & 0 deletions frontend/src/components/PluginsPanel.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,44 @@ describe("PluginsPanel Export & Share Suite (#605)", () => {
});
});

describe("PluginsPanel Favorite & Pin Support (#601)", () => {
beforeEach(() => {
localStorage.clear();
vi.clearAllMocks();
api.getPlugins.mockResolvedValue({ plugins: mockPluginsList });
api.getPluginLogs.mockResolvedValue({ logs: [] });
});

afterEach(() => {
cleanup();
});

test("toggles pin state and saves to localStorage", async () => {
render(<PluginsPanel sessionId="session-601" onClose={vi.fn()} />);

await waitFor(() => {
expect(screen.getByText("Summarizer")).toBeInTheDocument();
});

const pinBtn = screen.getByLabelText("Pin Summarizer");
fireEvent.click(pinBtn);

expect(screen.getByLabelText("Unpin Summarizer")).toBeInTheDocument();
expect(JSON.parse(localStorage.getItem("plugins-panel-pinned:session-601"))).toContain("summarizer");
});

test("restores pinned favorites from localStorage on mount", async () => {
localStorage.setItem("plugins-panel-pinned:session-601", JSON.stringify(["summarizer"]));

render(<PluginsPanel sessionId="session-601" onClose={vi.fn()} />);

await waitFor(() => {
expect(screen.getByLabelText("Unpin Summarizer")).toBeInTheDocument();
expect(screen.getByLabelText("Pin Calculator")).toBeInTheDocument();
});
});
});

describe("PluginsPanel View State & Persistence Suite (#592)", () => {
let store = {};

Expand Down
Loading