Skip to content

[OPIK-5582][FE]: add avatars to projects;#6043

Merged
aadereiko merged 4 commits intomainfrom
sashaa/OPIk-5582/add-avatar-to-projects
Apr 2, 2026
Merged

[OPIK-5582][FE]: add avatars to projects;#6043
aadereiko merged 4 commits intomainfrom
sashaa/OPIk-5582/add-avatar-to-projects

Conversation

@aadereiko
Copy link
Copy Markdown
Collaborator

Details

image image image
  • Add project avatar icons (owl + robot variants) to the sidebar project selector, projects table, and agent runner page
  • Sidebar trigger shows a 32px owl icon for the active project with "Project" label, name, and chevron
  • Dropdown list items show 16px robot icons with a check mark for the selected project
  • Projects table Name column includes robot icons
  • Agent runner "Connect your agent" heading includes an owl icon
  • Icons are assigned by creation order (created_at ascending, mod 10) — no backend changes needed

New files

  • src/constants/projectIcons.ts — icon count constant
  • src/hooks/useProjectIconIndex.ts — hook that maps project IDs to icon indices based on creation order
  • src/shared/ProjectIcon/ProjectIcon.tsx — reusable component rendering owl (32px) or robot (16px) SVG by index
  • src/v2/pages/ProjectsPage/ProjectNameCell.tsx — custom table cell for project name with robot icon
  • src/icons/projects/owl-{1..10}.svg — 10 owl icon variants
  • src/icons/projects/robot-{1..10}.svg — 10 robot icon variants

Modified files

*ProjectSelector.tsx — redesigned trigger (owl + two-line layout), added robot icons to dropdown items, selected item styling (bg-primary-100, blue check), name underline on hover
*ProjectSidebarContent.tsx — added separator between project selector and menu items
*ProjectsPage.tsx — swapped TextCell for ProjectNameCell on the Name column
*AgentRunnerEmptyState.tsx — added owl icon next to "Connect your agent" heading

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-5582

AI-WATERMARK

  • Tools: Claude Code
  • Model(s): Opus

Testing

  • npm run lint
  • npm run typecheck

Documentation

@aadereiko aadereiko requested a review from a team as a code owner April 1, 2026 21:31
Comment on lines +11 to +22
const { data } = useProjectsList({
workspaceName,
sorting: [{ id: "created_at", desc: false }],
page: 1,
size: 1000,
queryKey: PROJECTS_ICONS_QUERY_KEY,
});

return useMemo(() => {
if (!data?.content) return new Map<string, number>();
return new Map(data.content.map((p, i) => [p.id, i % PROJECT_ICON_COUNT]));
}, [data?.content]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useProjectIconIndices only fetches the first 1000 projects so projects beyond that fall back to ?? 0 and render the default avatar — should we paginate or remove the 1000 cap so every project is added to the id→index map?

Finding type: Logical Bugs | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-frontend/src/hooks/useProjectIconIndex.ts around lines 11 to 22, the
useProjectIconIndices hook currently calls useProjectsList with page: 1 and size: 1000
and then builds the id→index Map from only that single page. This omits any projects
beyond the first 1000. Refactor the hook to paginate through all project pages (or
remove the hard cap if the API supports unlimited results): repeatedly call/use the API
with incremental page numbers, accumulate all data.content entries until a page returns
fewer items than the requested size (or no content), then build and return the Map from
the full accumulated list. Ensure the query key/params remain stable and keep the
deterministic index calculation (i % PROJECT_ICON_COUNT).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's good for now, no workspace has >1000 projects for now

awkoy
awkoy previously approved these changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@awkoy awkoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@aadereiko aadereiko merged commit 8814d53 into main Apr 2, 2026
10 checks passed
@aadereiko aadereiko deleted the sashaa/OPIk-5582/add-avatar-to-projects branch April 2, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants