diff --git a/.gitignore b/.gitignore index 5ef6a52078..90e480342a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# cursorrules +.cursorrules diff --git a/app/w/components/toolbar/components/toolbar-tabs/toolbar-tabs.tsx b/app/w/components/toolbar/components/toolbar-tabs/toolbar-tabs.tsx index 8aa9c9e3d6..5b104d176f 100644 --- a/app/w/components/toolbar/components/toolbar-tabs/toolbar-tabs.tsx +++ b/app/w/components/toolbar/components/toolbar-tabs/toolbar-tabs.tsx @@ -1,29 +1,55 @@ 'use client' +import { useRef, useEffect, useState } from 'react' + interface ToolbarTabsProps { - activeTab: 'basic' | 'advanced' - onTabChange: (tab: 'basic' | 'advanced') => void + activeTab: 'blocks' | 'tools' + onTabChange: (tab: 'blocks' | 'tools') => void } export function ToolbarTabs({ activeTab, onTabChange }: ToolbarTabsProps) { + const blocksRef = useRef(null) + const toolsRef = useRef(null) + const [underlineStyle, setUnderlineStyle] = useState({ + width: 0, + transform: '', + }) + + useEffect(() => { + const activeRef = activeTab === 'blocks' ? blocksRef : toolsRef + if (activeRef.current) { + const rect = activeRef.current.getBoundingClientRect() + const parentRect = + activeRef.current.parentElement?.getBoundingClientRect() + const offsetLeft = parentRect ? rect.left - parentRect.left : 0 + + setUnderlineStyle({ + width: rect.width, + transform: `translateX(${offsetLeft}px)`, + }) + } + }, [activeTab]) + return (
@@ -32,10 +58,8 @@ export function ToolbarTabs({ activeTab, onTabChange }: ToolbarTabsProps) {
diff --git a/app/w/components/toolbar/toolbar.tsx b/app/w/components/toolbar/toolbar.tsx index 505fd88794..c24b22fcec 100644 --- a/app/w/components/toolbar/toolbar.tsx +++ b/app/w/components/toolbar/toolbar.tsx @@ -15,7 +15,7 @@ import { import { ScrollArea } from '@/components/ui/scroll-area' export function Toolbar() { - const [activeTab, setActiveTab] = useState('basic') + const [activeTab, setActiveTab] = useState('blocks') const [searchQuery, setSearchQuery] = useState('') const [isCollapsed, setIsCollapsed] = useState(false) diff --git a/blocks/blocks/agent.ts b/blocks/blocks/agent.ts index 2d908dae7d..790e9b628b 100644 --- a/blocks/blocks/agent.ts +++ b/blocks/blocks/agent.ts @@ -10,7 +10,7 @@ export const AgentBlock: BlockConfig = { description: 'Use any LLM', bgColor: '#7F2FFF', icon: AgentIcon, - category: 'basic', + category: 'blocks', }, tools: { access: ['openai.chat', 'anthropic.chat', 'google.chat', 'xai.chat', 'deepseek.chat', 'deepseek.reasoner'], diff --git a/blocks/blocks/api.ts b/blocks/blocks/api.ts index bcb9ae1a7e..6f1e0ec4f1 100644 --- a/blocks/blocks/api.ts +++ b/blocks/blocks/api.ts @@ -9,7 +9,7 @@ export const ApiBlock: BlockConfig = { description: 'Use any API', bgColor: '#2F55FF', icon: ApiIcon, - category: 'basic', + category: 'blocks', }, tools: { access: ['http.request'] diff --git a/blocks/blocks/crewai.ts b/blocks/blocks/crewai.ts index 149ab6750b..b8b6aad562 100644 --- a/blocks/blocks/crewai.ts +++ b/blocks/blocks/crewai.ts @@ -9,7 +9,7 @@ export const CrewAIVisionBlock: BlockConfig = { description: 'Analyze images with vision models', bgColor: '#FF5A50', icon: CrewAIIcon, - category: 'advanced' + category: 'tools' }, tools: { access: ['crewai.vision'] diff --git a/blocks/blocks/firecrawl.ts b/blocks/blocks/firecrawl.ts index e9b7cbbb51..8f5525def5 100644 --- a/blocks/blocks/firecrawl.ts +++ b/blocks/blocks/firecrawl.ts @@ -9,7 +9,7 @@ export const FirecrawlScrapeBlock: BlockConfig = { description: 'Scrape website content', bgColor: '#FF613A', icon: FirecrawlIcon, - category: 'advanced' + category: 'tools' }, tools: { access: ['firecrawl.scrape'] diff --git a/blocks/blocks/function.ts b/blocks/blocks/function.ts index b1a68403d3..6bc040c58d 100644 --- a/blocks/blocks/function.ts +++ b/blocks/blocks/function.ts @@ -9,7 +9,7 @@ export const FunctionBlock: BlockConfig = { description: 'Add custom logic', bgColor: '#FF8D2F', icon: CodeIcon, - category: 'advanced', + category: 'blocks', }, tools: { access: ['function.execute'] diff --git a/blocks/blocks/github.ts b/blocks/blocks/github.ts index 944c00b64c..e86cd80be5 100644 --- a/blocks/blocks/github.ts +++ b/blocks/blocks/github.ts @@ -9,7 +9,7 @@ export const GitHubBlock: BlockConfig = { description: 'Fetch GitHub repository information and metadata', bgColor: '#ffffff', icon: GithubIcon, - category: 'advanced', + category: 'tools', }, tools: { access: ['github.repoinfo'] diff --git a/blocks/blocks/jina.ts b/blocks/blocks/jina.ts index 7b91ea1c76..ed21dae280 100644 --- a/blocks/blocks/jina.ts +++ b/blocks/blocks/jina.ts @@ -9,7 +9,7 @@ export const JinaBlock: BlockConfig = { description: 'Convert website content into text', bgColor: '#333333', icon: JinaAIIcon, - category: 'advanced', + category: 'tools', }, tools: { access: ['jina.readurl'] diff --git a/blocks/blocks/slack.ts b/blocks/blocks/slack.ts index 9e031a7cca..aa85b90feb 100644 --- a/blocks/blocks/slack.ts +++ b/blocks/blocks/slack.ts @@ -9,7 +9,7 @@ export const SlackMessageBlock: BlockConfig = { description: 'Send a message to Slack', bgColor: '#611f69', icon: SlackIcon, - category: 'advanced' + category: 'tools' }, tools: { access: ['slack.message'] diff --git a/blocks/blocks/translate.ts b/blocks/blocks/translate.ts index 986d29a3aa..76f2ee5fc9 100644 --- a/blocks/blocks/translate.ts +++ b/blocks/blocks/translate.ts @@ -19,7 +19,7 @@ export const TranslateBlock: BlockConfig = { description: 'Translate text to any language', bgColor: '#FF4B4B', icon: TranslateIcon, - category: 'advanced', + category: 'tools', }, tools: { access: ['openai.chat', 'anthropic.chat', 'google.chat'], diff --git a/blocks/index.ts b/blocks/index.ts index 29762ef636..4165a835d6 100644 --- a/blocks/index.ts +++ b/blocks/index.ts @@ -50,7 +50,7 @@ export const getBlock = (type: string): BlockConfig | undefined => blocks[type] -export const getBlocksByCategory = (category: 'basic' | 'advanced'): BlockConfig[] => +export const getBlocksByCategory = (category: 'blocks' | 'tools'): BlockConfig[] => Object.values(blocks).filter(block => block.toolbar.category === category) export const getAllBlockTypes = (): string[] => diff --git a/blocks/types.ts b/blocks/types.ts index 0a111ee325..7147ab70f9 100644 --- a/blocks/types.ts +++ b/blocks/types.ts @@ -4,7 +4,7 @@ import { ToolResponse } from '@/tools/types' import { ExtractToolOutput, ToolOutputToValueType } from './utils' export type BlockIcon = (props: SVGProps) => JSX.Element -export type BlockCategory = 'basic' | 'advanced' +export type BlockCategory = 'blocks' | 'tools' export type PrimitiveValueType = 'string' | 'number' | 'json' | 'boolean' | 'any' export type ValueType = PrimitiveValueType | Record diff --git a/serializer/__tests__/serializer.test.ts b/serializer/__tests__/serializer.test.ts index 1e537c0e07..2458457852 100644 --- a/serializer/__tests__/serializer.test.ts +++ b/serializer/__tests__/serializer.test.ts @@ -55,7 +55,7 @@ describe('Serializer', () => { toolbar: { title: 'Agent Block', description: 'Use any LLM', - category: 'basic', + category: 'blocks', bgColor: '#7F2FFF' } } @@ -87,7 +87,7 @@ describe('Serializer', () => { toolbar: { title: 'API Block', description: 'Make HTTP requests', - category: 'basic', + category: '', bgColor: '#00FF00' } } @@ -359,7 +359,7 @@ describe('Serializer', () => { metadata: { title: 'Agent Block', description: 'Use any LLM', - category: 'basic', + category: 'blocks', color: '#7F2FFF', type: 'agent' }, diff --git a/test.tsx b/test.tsx deleted file mode 100644 index e69de29bb2..0000000000