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.

2.2 KB
Raw Blame
'use client'

import { useTranslation } from 'react-i18next'
import { SearchInput } from '@/app/components/base/search-input'
import Category from '@/app/components/explore/category'
import { useMarketplace } from '@/features/marketplace/client'

export function HomeTemplatesHeader({
  allCategoriesEn,
  categories,
  currCategory,
  keywords,
  onCategoryChange,
  onKeywordsChange,
}: {
  allCategoriesEn: string
  categories: string[]
  currCategory: string
  keywords: string
  onCategoryChange: (category: string) => void
  onKeywordsChange: (keywords: string) => void
}) {
  const { t } = useTranslation(['explore', 'app'])
  const marketplace = useMarketplace()

  return (
    <div className="sticky top-0 z-10 bg-background-body">
      <div className="flex items-center gap-2 px-8 pt-6">
        <h2
          id="home-templates-title"
          className="min-w-0 flex-1 truncate system-xl-medium text-text-primary"
        >
          {t(($) => $['apps.title'], { ns: 'explore' })}
        </h2>
        {marketplace && (
          <a
            href={marketplace.page('/templates')}
            target="_blank"
            rel="noopener noreferrer"
            className="-my-1 -me-1 flex min-h-6 shrink-0 touch-manipulation items-center gap-1 rounded-md p-1 system-xs-medium text-text-tertiary outline-hidden transition-colors hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid motion-reduce:transition-none"
          >
            {t(($) => $['apps.viewMore'], { ns: 'explore' })}
            <span
              className="i-ri-arrow-right-line size-3 shrink-0 rtl:rotate-180"
              aria-hidden="true"
            />
          </a>
        )}
      </div>

      <div className="flex items-start justify-between gap-2 px-8 pt-3 pb-3">
        <Category
          className="min-w-0"
          list={categories}
          value={currCategory}
          onChange={onCategoryChange}
          allCategoriesEn={allCategoriesEn}
        />
        <SearchInput
          className="w-40 shrink-0"
          aria-label={t(($) => $['newAppFromTemplate.searchAllTemplate'], { ns: 'app' })}
          value={keywords}
          onValueChange={onKeywordsChange}
        />
      </div>
    </div>
  )
}