import { animate } from "motion"; import { Fragment, useRef } from "react"; import EndpointsSearch from "@/components/app/(home)/sections/endpoints/EndpointsSearch/EndpointsSearch"; import EndpointsCrawl from "@/components/app/(home)/sections/endpoints/EndpointsCrawl/EndpointsCrawl"; import EndpointsMap from "@/components/app/(home)/sections/endpoints/EndpointsMap/EndpointsMap"; import EndpointsScrape from "@/components/app/(home)/sections/endpoints/EndpointsScrape/EndpointsScrape"; import EndpointsExtract from "@/components/app/(home)/sections/endpoints/EndpointsExtract/EndpointsExtract"; import { cn } from "@/utils/cn"; import Tooltip from "@/components/ui/shadcn/tooltip"; import { Endpoint } from "@/components/shared/Playground/Context/types"; export const tabs = [ { label: "Scrape", value: Endpoint.Scrape, action: "scraping", description: "Scrapes only the specified URL without crawling subpages. Outputs the content from the page.", icon: EndpointsScrape, }, { label: "Search", value: Endpoint.Search, description: "Search the web and get full content from results", action: "searching", icon: EndpointsSearch, new: true, }, { label: "Map", value: Endpoint.Map, action: "mapping", description: "Attempts to output all website's urls in a few seconds.", icon: EndpointsMap, }, { label: "Crawl", value: Endpoint.Crawl, action: "crawling", description: "Crawls a URL and all its accessible subpages, outputting the content from each page.", icon: EndpointsCrawl, }, { label: "Extract", value: Endpoint.Extract, action: "extracting", description: "Extract structured data from pages using LLMs. Provide URLs and a schema to get organized data.", icon: EndpointsExtract, new: true, }, ]; export default function HeroInputTabs(props: { setTab: (tab: Endpoint) => void; tab: Endpoint; disabled?: boolean; allowedModes?: Endpoint[]; }) { // Filter tabs based on allowedModes if provided const visibleTabs = props.allowedModes ? tabs.filter((tab) => props.allowedModes!.includes(tab.value)) : tabs; const activeIndex = visibleTabs.findIndex((tab) => tab.value === props.tab); const backgroundRef = useRef(null); return (
{visibleTabs.map((tab, index) => ( {index > 0 && (
)} ))}
); }