diff --git a/web/src/pages/functionTemplate/funcTemplateItem/TemplateFunctionInfo.tsx b/web/src/pages/functionTemplate/funcTemplateItem/TemplateFunctionInfo.tsx deleted file mode 100644 index 574a25f81c..0000000000 --- a/web/src/pages/functionTemplate/funcTemplateItem/TemplateFunctionInfo.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { useState } from "react"; -import { Divider, useColorMode } from "@chakra-ui/react"; -import clsx from "clsx"; - -import MonacoEditor from "../Mods/MonacoEditor"; - -import { TFunctionTemplate } from "@/apis/typing"; - -const TemplateFunctionInfo = ({ - template, - popover = false, -}: { - template: TFunctionTemplate; - popover?: boolean; -}) => { - const { colorMode } = useColorMode(); - const darkMode = colorMode === "dark"; - - const [currentFunction, setCurrentFunction] = useState( - template.items[0], - ); - - return ( - <> -
-
-
{template.name}
-
{template.description}
-
-
- -
- {template.items.map((item) => ( -
{ - setCurrentFunction(item); - }} - key={item.name} - > - {item.name} -
- ))} -
-
- -
- - ); -}; - -export default TemplateFunctionInfo; diff --git a/web/src/pages/functionTemplate/funcTemplateItem/index.tsx b/web/src/pages/functionTemplate/funcTemplateItem/index.tsx deleted file mode 100644 index 6425e04424..0000000000 --- a/web/src/pages/functionTemplate/funcTemplateItem/index.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; -import { ChevronRightIcon } from "@chakra-ui/icons"; -import { useColorMode } from "@chakra-ui/react"; -import clsx from "clsx"; - -import { changeURL } from "@/utils/format"; - -import TemplateInfo from "../Mods/TemplateInfo"; -import { useGetFunctionTemplateUsedByQuery, useGetOneFunctionTemplateQuery } from "../service"; - -import TemplateFunctionInfo from "./TemplateFunctionInfo"; - -import { TFunctionTemplate } from "@/apis/typing"; - -const FuncTemplateItem = (props: { setSelectedItem: any; selectedItem: any; isModal: boolean }) => { - const { setSelectedItem, isModal } = props; - const { colorMode } = useColorMode(); - const { t } = useTranslation(); - const navigate = useNavigate(); - - const [template, setTemplate] = useState(); - const [usedBy, setUsedBy] = useState([]); - const pathname = window.location.href; - const id = pathname.split("/").pop(); - - useGetOneFunctionTemplateQuery( - { id: id }, - { - enabled: (id as string)?.length > 12, - onSuccess: (data: any) => { - setTemplate(data.data[0]); - }, - }, - ); - - useGetFunctionTemplateUsedByQuery( - { id: id }, - { - enabled: (id as string)?.length > 12, - onSuccess: (data: any) => { - setUsedBy(data.data.list); - }, - }, - ); - - return ( -
-
- { - navigate(changeURL(`/recommended`)); - setSelectedItem({ text: t("Template.Recommended"), value: "recommended" }); - }} - > - {t("HomePage.NavBar.funcTemplate")} - - - - - {t("Template.Details")} -
- {template && ( -
-
- -
-
- -
-
- )} -
- ); -}; - -export default FuncTemplateItem;