-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update agent hub navigation and filtering (#321)
* fix: Resolve mention dropdown issue in @ agent selection for light mode * feat(chat): add rename and delete functionality to chat channels Summary: - Add rename and delete icons to chat channels with hover effects - Implement channel rename functionality with inline editing - Implement channel delete functionality with confirmation - Update channel header to display current channel name - Convert numeric IDs to string format for message handling - Add blue and red color indicators for rename and delete actions * feat: update agent hub navigation and filtering - Redirect Agent Hub card to local development URL (http://localhost:3000/agents) - Add agent category filtering functionality - Remove hardcoded agent categories - Add useState and useEffect hooks to fetch actual agent data - Filter agents dynamically based on selected category - Generate links with version info using real agent data - Display all relevant agents when a category is selected * feat: update agent hub navigation and filtering * feat(chat): add new, rename and delete functionality to chat channels
- Loading branch information
1 parent
a68b0b4
commit 4279cf7
Showing
7 changed files
with
124 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,95 @@ | ||
'use client' | ||
|
||
import { useState } from 'react' | ||
import { useState, useEffect } from 'react' | ||
import classNames from 'classnames' | ||
|
||
import { DatasetsTabList } from '../const' | ||
import { DatasetsTabItem } from '../type' | ||
|
||
import FilterTab from './FilterTab' | ||
import TabTasks from './TabTasks' | ||
import TabOther from './TabOther' | ||
import TabLicenses from './TabLicenses' | ||
import TabLanguages from './TabLanguages' | ||
import TabSubTasks from './TabSubTasks' | ||
import TabSizes from './TabSizes' | ||
import { ApplySVG, ExitSVG } from '@/ui/svgs' | ||
import { AgentTabList } from '../const' | ||
import { DatasetsTabItem, AgentItem } from '../type' | ||
import { ExitSVG } from '@/ui/svgs' | ||
import { baseUrl } from '@/lib/env' | ||
import AgentCard from '../ContentLayout/AgentCard' | ||
import { DatasetsHeader } from '../ContentLayout/DatasetsHeader' | ||
|
||
export default function LeftTabsLayout() { | ||
const [currentTab, setCurrentTab] = useState<DatasetsTabItem>('Tasks') | ||
//linter | ||
// const [isAddFilterModalDisplay, setIsAddFilterModalDisplay] = useState<boolean>(false) | ||
const [currentTab, setCurrentTab] = useState<DatasetsTabItem>('Academic') | ||
const [agents, setAgents] = useState<AgentItem[]>([]) | ||
const isAddFilterModalDisplay = false; | ||
|
||
useEffect(() => { | ||
const fetchAgents = async () => { | ||
const res = await fetch(`${baseUrl}/api/get_all_agents/light`, { cache: 'no-store' }); | ||
const data = await res.json(); | ||
setAgents(Object.values(data)); | ||
}; | ||
|
||
fetchAgents(); | ||
}, []); | ||
|
||
const onTabClick = (tabName: DatasetsTabItem) => { | ||
setCurrentTab(tabName) | ||
} | ||
|
||
// Filter agents based on current selected category | ||
const filteredAgents = agents.filter(agent => { | ||
const name = agent.name.toLowerCase(); | ||
switch(currentTab) { | ||
case 'Academic': | ||
return name.includes('academic') || name.includes('math'); | ||
case 'Creative': | ||
return name.includes('creator') || name.includes('designer') || name.includes('composer'); | ||
case 'Lifestyle': | ||
return name.includes('therapist') || name.includes('trainer') || name.includes('mixologist'); | ||
case 'Entertainment': | ||
return name.includes('entertainment') || name.includes('game'); | ||
default: | ||
return true; | ||
} | ||
}); | ||
|
||
return ( | ||
<section | ||
className={classNames( | ||
'pt-8 border-gray-100 bg-white lg:static lg:px-0 lg:col-span-4 xl:col-span-3 lg:border-r lg:bg-gradient-to-l from-gray-50-to-white', | ||
isAddFilterModalDisplay ? 'fixed overflow-y-auto overflow-x-hidden z-40 inset-0 !px-4 !pt-4' : 'hidden lg:block' | ||
)} | ||
> | ||
<div className="mb-4 flex items-center justify-between lg:hidden"> | ||
<h3 className="text-base font-semibold">Edit Datasets filters</h3> | ||
<button className="text-xl" type="button"> | ||
<ExitSVG /> | ||
</button> | ||
</div> | ||
<ul className="flex gap-1 text-sm flex-wrap mt-1.5 mb-5"> | ||
{DatasetsTabList.map((tabName, index) => ( | ||
<li key={index}> | ||
<button | ||
className={classNames( | ||
'flex items-center whitespace-nowrap rounded-lg px-2', | ||
currentTab === tabName | ||
? 'bg-black text-white dark:bg-gray-800' | ||
: 'text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-900 dark:hover:text-gray-300' | ||
)} | ||
onClick={() => { | ||
onTabClick(tabName) | ||
}} | ||
> | ||
{tabName} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
<FilterTab /> | ||
<div className="mb-3"> | ||
{currentTab === 'Tasks' && <TabTasks />} | ||
{currentTab === 'Sizes' && <TabSizes />} | ||
{currentTab === 'Sub-tasks' && <TabSubTasks />} | ||
{currentTab === 'Languages' && <TabLanguages />} | ||
{currentTab === 'Licenses' && <TabLicenses />} | ||
{currentTab === 'Other' && <TabOther />} | ||
</div> | ||
<div className="fixed inset-x-4 bottom-0 flex h-16 items-center border-t bg-white dark:bg-gray-950 lg:hidden"> | ||
<button className="btn btn-lg -mt-px w-full font-semibold" type="button"> | ||
<ApplySVG /> | ||
Apply filters | ||
</button> | ||
</div> | ||
</section> | ||
<> | ||
<section | ||
className={classNames( | ||
'pt-8 border-gray-100 bg-white lg:static lg:px-0 lg:col-span-4 xl:col-span-3 lg:border-r lg:bg-gradient-to-l from-gray-50-to-white', | ||
isAddFilterModalDisplay ? 'fixed overflow-y-auto overflow-x-hidden z-40 inset-0 !px-4 !pt-4' : '' | ||
)} | ||
> | ||
{/* Left sidebar category menu */} | ||
<div className="mb-4 flex items-center justify-between lg:hidden"> | ||
<h3 className="text-base font-semibold">Agent Categories</h3> | ||
<button className="text-xl" type="button"> | ||
<ExitSVG /> | ||
</button> | ||
</div> | ||
<ul className="flex gap-1 text-sm flex-wrap mt-1.5 mb-5"> | ||
{AgentTabList.map((tabName, index) => ( | ||
<li key={index}> | ||
<button | ||
className={classNames( | ||
'flex items-center whitespace-nowrap rounded-lg px-3 py-1.5', | ||
currentTab === tabName | ||
? 'bg-black text-white dark:bg-gray-800' | ||
: 'text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-900 dark:hover:text-gray-300' | ||
)} | ||
onClick={() => { | ||
onTabClick(tabName) | ||
}} | ||
> | ||
{tabName} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
</section> | ||
|
||
{/* Main content section with filtered agents */} | ||
<section className="pt-8 col-span-full lg:col-span-6 xl:col-span-7 pb-12"> | ||
<DatasetsHeader filteredCount={filteredAgents.length} /> | ||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3"> | ||
{filteredAgents.map((agent) => ( | ||
<AgentCard key={agent.id} item={agent} /> | ||
))} | ||
</div> | ||
</section> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import TabsLayout from './TabsLayout/index.client' | ||
import ContentLayout from './ContentLayout' | ||
import LeftTabsLayout from './TabsLayout/index.client' | ||
|
||
export default function Datasets({ searchParams }: | ||
{ searchParams: { [key: string]: string | string[] | undefined } }) { | ||
export default function Datasets() { | ||
return ( | ||
<main className="flex flex-1 flex-col"> | ||
<div className="SVELTE_HYDRATER contents" data-props="" data-target="DatasetList"> | ||
<div className="container relative flex flex-col lg:grid lg:space-y-0 w-full lg:grid-cols-10 md:flex-1 md:grid-rows-full md:gap-6 "> | ||
<TabsLayout /> | ||
<ContentLayout searchParams={searchParams} /> | ||
</div> | ||
<div className="flex min-h-[calc(100vh_-_64px)]"> | ||
<div className="container relative flex flex-col lg:grid lg:space-y-0 w-full lg:grid-cols-10 md:flex-1 md:grid-rows-full md:gap-6"> | ||
<LeftTabsLayout /> | ||
</div> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
export const inDevEnvironment = !!process && process.env.NODE_ENV === 'development'; | ||
// export const serverUrl = inDevEnvironment ? 'http://localhost:8000' : 'https://myapp-y5z35kuonq-uk.a.run.app' | ||
export const baseUrl = inDevEnvironment ? 'http://localhost:3000' : 'https://my.aios.foundation' | ||
export const baseUrl = process.env.NODE_ENV === 'development' | ||
? 'http://localhost:3000' | ||
: 'https://my.aios.foundation'; | ||
// export const serverUrl = inDevEnvironment ? 'http://localhost:8000' : 'http://35.232.56.61:8000' | ||
export const serverUrl = 'http://35.232.56.61:8000'; | ||
export const serverUrl = process.env.NODE_ENV === 'development' | ||
? 'http://localhost:8000' | ||
: 'https://api.aios.chat'; | ||
|