Skip to content

Conversation

@rahul1841
Copy link
Contributor

@rahul1841 rahul1841 commented Oct 7, 2025

Description

added empty state for collection and agents page

Testing

tested locally

Summary by CodeRabbit

  • New Features

    • Added empty-state visuals for Agents and Knowledge Management with illustrations and contextual guidance.
    • Action buttons are now contextual: CREATE (Agents) and ADD COLLECTION (Knowledge) appear only when relevant; search and CREATE for Agents show only when the active tab has agents.
    • Agents tabs (ALL, SHARED-WITH-ME, MADE-BY-ME) remain always visible; Refresh preserved.
  • Style

    • Introduced empty-state icons and adjusted button text/styling (NEW COLLECTION → ADD COLLECTION in empty state).

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rahul1841, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant user interface enhancements to the Agents and Knowledge Management sections of the application. The primary goal is to provide a more intuitive and engaging experience for users when these sections are empty, guiding them on how to create their first agent or collection. This is achieved through the implementation of dedicated empty state designs, which include relevant imagery, descriptive text, and prominent call-to-action buttons, alongside refined conditional rendering of UI components to maintain a clean and focused interface.

Highlights

  • Enhanced Empty States: Implemented new, visually distinct empty states for both the Agents and Knowledge Management pages, featuring dedicated icons, clear messages, and calls to action to guide users.
  • Conditional UI Elements on Agents Page: Dynamically hide/show the search bar and 'CREATE' button on the Agents page based on whether agents are present in the currently active tab, improving UI clarity when no agents exist.
  • Consistent Tab Visibility on Agents Page: Ensured that tab navigation (All, Shared-With-Me, Made-By-Me) on the Agents page remains visible even when no agents are listed, allowing users to switch categories easily.
  • Knowledge Management Flow Refinement: Adjusted the 'NEW COLLECTION' button visibility and overall layout on the Knowledge Management page to present a guided empty state experience when no collections are available.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Conditional rendering added for header actions and empty states in Agents and Knowledge Management routes; action buttons now depend on data presence or upload state and illustrative empty-state icons were introduced. Refresh and upload behaviors retained; no public API changes. (50 words)

Changes

Cohort / File(s) Summary of changes
Agents route UI
frontend/src/routes/_authenticated/agent.tsx
Top action cluster (search input, CREATE) now renders only when the active tab has agents; tabs remain always visible. Added agent empty-state illustration and dynamic titles/descriptions per tab; imported agentEmptyStateIcon. Refresh button preserved and reflowed into new header layout.
Knowledge Management route UI
frontend/src/routes/_authenticated/knowledgeManagement.tsx
Added KB empty-state illustration (kbEmptyStateIcon) shown when no collections and not uploading. NEW COLLECTION button rendered conditionally (shown as ADD COLLECTION in empty state). Upload skeletons/progress preserved; container structure adjusted to host empty-state branch.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant AR as AgentsRoute
  participant DS as AgentData

  U->>AR: Navigate / switch tab
  AR->>DS: Fetch agents for active tab
  DS-->>AR: Agent list
  alt Has agents
    AR-->>U: Render tabs + actions (Search, CREATE) + list
  else No agents
    AR-->>U: Render tabs + empty-state illustration + guidance (+ CREATE action where applicable)
  end
  U->>AR: Click Refresh
  AR->>DS: Refetch agents
  DS-->>AR: Updated list
  AR-->>U: Rerender per state
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant KM as KnowledgeManagementContent
  participant KB as CollectionsData
  participant UP as UploadState

  U->>KM: Navigate
  KM->>KB: Load collections
  KB-->>KM: Collections list
  KM->>UP: Check uploading
  UP-->>KM: Upload status

  alt Collections exist or uploading
    KM-->>U: Render header + (NEW/ADD) button + list or upload progress
  else No collections and not uploading
    KM-->>U: Render empty-state illustration + title/subtitle + ADD COLLECTION button
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • shivamashtikar
  • kalpadhwaryu
  • junaid-shirur
  • zereraz

Poem

A nibble of UI, a hop and a wink,
Tabs stand ready while empty states blink.
Icons nibble silence, buttons invite,
Refresh, add, and make the list bright.
— a rabbit’s cheer for code that feels light 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly states that the pull request adds empty states for both the collections and agents pages, directly reflecting the main change introduced in the diff. It follows a conventional commit prefix to indicate the nature of the change and is free of extraneous details or vague wording. This clarity and specificity will help team members quickly understand the purpose of the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/EmptyStates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

Thank you for this pull request. You've done a great job of adding empty states to the agents and collections pages, which significantly improves the user experience for new users or empty accounts. I've identified a critical syntax issue and a few opportunities for code simplification and consistency. Please see my detailed comments below.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/routes/_authenticated/agent.tsx (1)

2926-2928: Improve alt text specificity for accessibility.

The alt text "No agents" is generic. Consider making it more descriptive to better convey the context to screen reader users:

-                            alt="No agents"
+                            alt="Empty agents list illustration"

For the shared-to-me tab:

-                            alt="No agents"
+                            alt="No shared agents illustration"

More descriptive alt text improves accessibility without affecting visual presentation.

Also applies to: 2950-2952

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e025647 and 322097c.

⛔ Files ignored due to path filters (2)
  • frontend/src/assets/emptystateIcons/agent.png is excluded by !**/*.png
  • frontend/src/assets/emptystateIcons/kb.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • frontend/src/routes/_authenticated/agent.tsx (4 hunks)
  • frontend/src/routes/_authenticated/knowledgeManagement.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-23T07:43:59.494Z
Learnt from: rahul1841
PR: xynehq/xyne#582
File: frontend/src/routes/_authenticated/agent.tsx:1654-1654
Timestamp: 2025-06-23T07:43:59.494Z
Learning: In the agent test interface dropdown (frontend/src/routes/_authenticated/agent.tsx), the agent selection dropdown specifically uses `allAgentsList` only and should only check `allAgentsList.length > 0` for visibility. It does not need to check other agent lists like `madeByMeAgentsList` or `sharedToMeAgentsList` because the dropdown is designed to show agents from the "all agents" tab only.

Applied to files:

  • frontend/src/routes/_authenticated/agent.tsx
📚 Learning: 2025-10-07T13:55:21.003Z
Learnt from: Ravishekhar7870
PR: xynehq/xyne#1059
File: frontend/src/routes/_authenticated/agent.tsx:3642-3692
Timestamp: 2025-10-07T13:55:21.003Z
Learning: In the agent.tsx file, folder navigation from Google Drive search results is now intended functionality - users should be able to navigate into searched folders via the GoogleDriveNavigation component.

Applied to files:

  • frontend/src/routes/_authenticated/agent.tsx
🔇 Additional comments (6)
frontend/src/routes/_authenticated/knowledgeManagement.tsx (3)

64-64: LGTM!

The import statement is correct and follows the project's convention for importing static assets.


1778-1793: LGTM!

The conditional rendering logic is correct. The header actions are appropriately shown when there are collections or during an upload, which ensures a smooth UX when creating the first collection.


1820-2104: LGTM!

The existing collections list is correctly wrapped in an else block to ensure it's only shown when appropriate (not in empty state). The internal logic remains unchanged and functions as expected.

frontend/src/routes/_authenticated/agent.tsx (3)

81-81: LGTM: Empty state icon import.

The import is correctly structured and follows the existing naming convention for asset files.


2755-2782: Verify: Inconsistent CREATE button visibility.

The IIFE hides both the search input and CREATE button when the current tab has no agents. While the empty states (lines 2922-2943) provide a CREATE button for "all" and "made-by-me" tabs, this creates an inconsistency:

  1. With agents: CREATE button appears in the header (line 2774-2779)
  2. Without agents: CREATE button appears in the empty state (line 2936-2941)

This shifting location might confuse users. Consider one of these approaches:

  • Option 1: Always show the CREATE button in the header, hide only the search input when empty
  • Option 2: Keep current behavior but ensure it's intentional UX design

If the current behavior is intended (showing CREATE in empty state encourages users to act), please confirm. Otherwise, adjust the conditional to keep CREATE always visible in the header.

// Option 1: Always show CREATE, conditionally show search
const currentTabHasAgents = 
  (activeTab === "all" && allAgentsList.length > 0) ||
  (activeTab === "made-by-me" && madeByMeAgentsList.length > 0) ||
  (activeTab === "shared-to-me" && sharedToMeAgentsList.length > 0)

return (
  <>
    {currentTabHasAgents && (
      <div className="relative">
        <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5" />
        <input
          type="text"
          placeholder="Search agents.."
          value={listSearchQuery}
          onChange={handleListSearchChange}
          className="pl-10 pr-4 py-2 rounded-full border border-gray-200 dark:border-slate-600 w-[300px] focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-slate-500 bg-white dark:bg-slate-700 dark:text-gray-100"
        />
      </div>
    )}
    <Button
      onClick={handleCreateNewAgent}
      className="bg-slate-800 hover:bg-slate-700 text-white font-mono font-medium rounded-full px-6 py-2 flex items-center gap-2"
    >
      <Plus size={18} /> CREATE
    </Button>
  </>
)

2836-2871: LGTM: Tab layout reorganization.

The restructured layout correctly ensures tab buttons and the refresh button are always accessible, while the action cluster (search/CREATE) is conditionally rendered. The refresh button properly reflects loading state with both disabled attribute and spinning animation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
frontend/src/routes/_authenticated/agent.tsx (2)

2755-2784: Refactor IIFE to useMemo for better performance and readability.

The IIFE pattern for calculating currentTabHasAgents inside JSX is awkward and recomputes on every render. Consider extracting this logic to a useMemo hook for clarity and to avoid unnecessary recalculations:

+ const currentTabHasAgents = useMemo(() => {
+   const agentLists: Record<string, SelectPublicAgent[]> = {
+     "all": allAgentsList,
+     "made-by-me": madeByMeAgentsList,
+     "shared-to-me": sharedToMeAgentsList,
+   }
+   return (agentLists[activeTab]?.length ?? 0) > 0
+ }, [activeTab, allAgentsList, madeByMeAgentsList, sharedToMeAgentsList])

  <div className="flex items-center gap-4 ">
-   {(() => {
-     // Calculate whether current tab has agents
-     const agentLists: Record<string, SelectPublicAgent[]> = {
-       "all": allAgentsList,
-       "made-by-me": madeByMeAgentsList,
-       "shared-to-me": sharedToMeAgentsList,
-     }
-     const currentTabHasAgents = (agentLists[activeTab]?.length ?? 0) > 0
-     
-     return currentTabHasAgents && (
-       <>
-         <div className="relative">
-           <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5" />
-           <input
-             type="text"
-             placeholder="Search agents.."
-             value={listSearchQuery}
-             onChange={handleListSearchChange}
-             className="pl-10 pr-4 py-2 rounded-full border border-gray-200 dark:border-slate-600 w-[300px] focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-slate-500 bg-white dark:bg-slate-700 dark:text-gray-100"
-           />
-         </div>
-         <Button
-           onClick={handleCreateNewAgent}
-           className="bg-slate-800 hover:bg-slate-700 text-white font-mono font-medium rounded-full px-6 py-2 flex items-center gap-2"
-         >
-           <Plus size={18} /> CREATE
-         </Button>
-       </>
-     )
-   })()}
+   {currentTabHasAgents && (
+     <>
+       <div className="relative">
+         <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5" />
+         <input
+           type="text"
+           placeholder="Search agents.."
+           value={listSearchQuery}
+           onChange={handleListSearchChange}
+           className="pl-10 pr-4 py-2 rounded-full border border-gray-200 dark:border-slate-600 w-[300px] focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-slate-500 bg-white dark:bg-slate-700 dark:text-gray-100"
+         />
+       </div>
+       <Button
+         onClick={handleCreateNewAgent}
+         className="bg-slate-800 hover:bg-slate-700 text-white font-mono font-medium rounded-full px-6 py-2 flex items-center gap-2"
+       >
+         <Plus size={18} /> CREATE
+       </Button>
+     </>
+   )}
  </div>

2935-2937: Improve alt text for better accessibility.

The alt text "No agents" is minimal. Consider making it more descriptive to help screen reader users understand the context:

  <img
    src={agentEmptyStateIcon}
-   alt="No agents"
+   alt="Empty state illustration"
    className="w-32 h-32 mb-6 opacity-60"
  />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 322097c and fa7e604.

📒 Files selected for processing (1)
  • frontend/src/routes/_authenticated/agent.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-23T07:43:59.494Z
Learnt from: rahul1841
PR: xynehq/xyne#582
File: frontend/src/routes/_authenticated/agent.tsx:1654-1654
Timestamp: 2025-06-23T07:43:59.494Z
Learning: In the agent test interface dropdown (frontend/src/routes/_authenticated/agent.tsx), the agent selection dropdown specifically uses `allAgentsList` only and should only check `allAgentsList.length > 0` for visibility. It does not need to check other agent lists like `madeByMeAgentsList` or `sharedToMeAgentsList` because the dropdown is designed to show agents from the "all agents" tab only.

Applied to files:

  • frontend/src/routes/_authenticated/agent.tsx
📚 Learning: 2025-10-07T13:55:21.003Z
Learnt from: Ravishekhar7870
PR: xynehq/xyne#1059
File: frontend/src/routes/_authenticated/agent.tsx:3642-3692
Timestamp: 2025-10-07T13:55:21.003Z
Learning: In the agent.tsx file, folder navigation from Google Drive search results is now intended functionality - users should be able to navigate into searched folders via the GoogleDriveNavigation component.

Applied to files:

  • frontend/src/routes/_authenticated/agent.tsx
🧬 Code graph analysis (1)
frontend/src/routes/_authenticated/agent.tsx (2)
server/db/schema/agents.ts (1)
  • SelectPublicAgent (131-131)
server/shared/types.ts (1)
  • SelectPublicAgent (113-113)
🔇 Additional comments (1)
frontend/src/routes/_authenticated/agent.tsx (1)

2923-2957: LGTM! Clean empty state implementation.

The empty state logic appropriately handles different tab scenarios:

  • Shared tab: Shows a passive message without action button (correct, as users can't create shared agents)
  • Other tabs: Shows a call-to-action with CREATE button

The conditional rendering of the CREATE button (in header when agents exist, in empty state when none exist) is an intentional UX pattern that keeps the primary action visible and accessible in both scenarios.

@shivamashtikar shivamashtikar merged commit 6cd770e into main Oct 8, 2025
4 checks passed
@shivamashtikar shivamashtikar deleted the fix/EmptyStates branch October 8, 2025 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants