'use client' import type { GetAppsData } from '@dify/contracts/api/console/apps/types.gen' import type { AppListUrlQuery } from './query-params' import { useAtomValue } from 'jotai' import { useTranslation } from 'react-i18next' import { CreateAppDropdown } from '@/app/components/app/create-app-dropdown' import { SearchInput } from '@/app/components/base/search-input' import { activeStepByStepTourGuideGroupAtom, activeStepByStepTourGuideIndexAtom, activeStepByStepTourTaskIdAtom, } from '@/app/components/step-by-step-tour/state' import { getStepByStepTourGuides, STEP_BY_STEP_TOUR_TARGETS, } from '@/app/components/step-by-step-tour/target-registry' import { TagFilter } from '@/features/tag-management/components/tag-filter' import Link from '@/next/link' import { AppSortFilter } from './app-sort-filter' import { AppTypeFilter } from './app-type-filter' import CreatorsFilter from './creators-filter' import { StudioListHeader } from './studio-list-header' type AppListQuery = NonNullable type AppListCategory = AppListUrlQuery['category'] type AppListSortBy = NonNullable type AppListHeaderProps = { titleId: string category: AppListCategory tagIDs: string[] keywords: string creatorIDs: string[] sortBy: AppListSortBy onCategoryChange: (category: AppListCategory) => void onTagIDsChange: (tagIDs: string[]) => void onKeywordsChange: (keywords: string) => void onCreatorIDsChange: (creatorIDs: string[]) => void onSortByChange: (sortBy: AppListSortBy) => void onCreateBlank: () => void onCreateTemplate: () => void onImportDSL: () => void onOpenTagManagement: () => void showCreateButton: boolean } export function AppListHeader({ titleId, category, tagIDs, keywords, creatorIDs, sortBy, onCategoryChange, onTagIDsChange, onKeywordsChange, onCreatorIDsChange, onSortByChange, onCreateBlank, onCreateTemplate, onImportDSL, onOpenTagManagement, showCreateButton, }: AppListHeaderProps) { const { t } = useTranslation() const activeStepByStepTourTaskId = useAtomValue(activeStepByStepTourTaskIdAtom) const activeStepByStepTourGuideIndex = useAtomValue(activeStepByStepTourGuideIndexAtom) const activeStepByStepTourGuideGroup = useAtomValue(activeStepByStepTourGuideGroupAtom) const activeStudioGuides = activeStepByStepTourTaskId === 'studio' && activeStepByStepTourGuideGroup ? getStepByStepTourGuides('studio', activeStepByStepTourGuideGroup) : [] const activeStudioGuide = activeStudioGuides[activeStepByStepTourGuideIndex ?? 0] const shouldOpenStepByStepTourCreateMenu = activeStudioGuide?.target === STEP_BY_STEP_TOUR_TARGETS.studioWithAppsCreate return (

{t(($) => $['menus.apps'], { ns: 'common' })}

} >
$['gotoAnything.actions.searchApplications'], { ns: 'app' })} />
{t(($) => $['studio.viewSnippets'], { ns: 'app' })} {showCreateButton && ( )}
) }