'use client' import { useTranslation } from 'react-i18next' import { Fragment, useState } from 'react' import { ChevronDownIcon, PlusIcon } from '@heroicons/react/24/solid' import { Menu, Transition } from '@headlessui/react' import { useRouter } from 'next/navigation' import Indicator from '../indicator' import type { AppDetailResponse } from '@/models/app' import CreateAppDialog from '@/app/components/app/create-app-dialog' import AppIcon from '@/app/components/base/app-icon' import { useAppContext } from '@/context/app-context' type IAppSelectorProps = { appItems: AppDetailResponse[] curApp: AppDetailResponse } export default function AppSelector({ appItems, curApp }: IAppSelectorProps) { const router = useRouter() const { isCurrentWorkspaceEditor } = useAppContext() const [showNewAppDialog, setShowNewAppDialog] = useState(false) const { t } = useTranslation() const itemClassName = ` flex items-center w-full h-10 px-3 text-gray-700 text-[14px] rounded-lg font-normal hover:bg-gray-100 cursor-pointer ` return (