Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

783 B
Raw Blame
import type { IntegrationSection } from '@/app/components/integrations/routes'
import { parseAsStringLiteral, useQueryState } from 'nuqs'
import {
  INTEGRATION_SECTION_VALUES,
  sectionByToolCategory,
  TOOL_CATEGORY_VALUES,
} from '@/app/components/integrations/routes'

const parseAsIntegrationSection = parseAsStringLiteral(INTEGRATION_SECTION_VALUES)
const parseAsToolCategory = parseAsStringLiteral(TOOL_CATEGORY_VALUES)

export function useIntegrationSection(routeSection?: IntegrationSection) {
  const [sectionParam] = useQueryState('section', parseAsIntegrationSection)
  const [categoryParam] = useQueryState('category', parseAsToolCategory)

  return (
    routeSection ??
    sectionParam ??
    (categoryParam ? sectionByToolCategory[categoryParam] : 'provider')
  )
}