From a79e25aaa6f2364212f862ebd6e3575b76869774 Mon Sep 17 00:00:00 2001 From: heheer <71265218+newfish-cmyk@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:10:04 +0800 Subject: [PATCH] fix(web): fix the type of sms code for phone reset (#1402) * fix(web): fix reset phone smscode type * feat(web): add function template developer info * refactor(web): add tooltip --- web/public/locales/en/translation.json | 8 +++--- web/public/locales/zh-CN/translation.json | 6 +++-- web/public/locales/zh/translation.json | 6 +++-- web/src/apis/typing.d.ts | 4 +++ .../components/SendSmsCodeButton/index.tsx | 6 +++-- .../setting/UserInfo/Mods/PasswordEditor.tsx | 1 + .../app/setting/UserInfo/Mods/PhoneEditor.tsx | 2 ++ web/src/pages/auth/reset-password/index.tsx | 2 +- .../Mods/TemplateInfo/index.tsx | 26 +++++++++++++++++++ .../Mods/UseTemplateModal/index.tsx | 1 + 10 files changed, 52 insertions(+), 10 deletions(-) diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index 2467ccebce..6323f086ea 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -519,7 +519,8 @@ "Save": "Save", "Recommended": "Recommended Template", "Confirm": "If there are missing dependencies, the application will be automatically restarted. Are you sure you want to use this template?", - "ConfirmDeleteTemplate": "Are you sure you want to delete this function template?" + "ConfirmDeleteTemplate": "Are you sure you want to delete this function template?", + "DeveloperInfo": "Developer Info" }, "Create function template success": "Create function template successfully", "Publish": "release", @@ -567,5 +568,6 @@ "Core": "Core", "No History": "No History", "MyIncomeAndExpenses": "My Income And Expenses", - "Apply": "apply" -} \ No newline at end of file + "Apply": "apply", + "Developing": "Developing" +} diff --git a/web/public/locales/zh-CN/translation.json b/web/public/locales/zh-CN/translation.json index 7570cf0d7b..f1828a9222 100644 --- a/web/public/locales/zh-CN/translation.json +++ b/web/public/locales/zh-CN/translation.json @@ -498,7 +498,8 @@ "Save": "保存", "Recommended": "推荐模板", "Confirm": "如果存在依赖包未安装,将会自动重启应用,确定使用该模板吗?", - "ConfirmDeleteTemplate": "确定删除模板吗" + "ConfirmDeleteTemplate": "确定删除模板吗?", + "DeveloperInfo": "开发者信息" }, "Fee": "费用", "PleaseCloseApplicationFirst": "请先关闭应用", @@ -567,5 +568,6 @@ "Core": "核", "No History": "暂无记录", "MyIncomeAndExpenses": "我的收支", - "Apply": "使用" + "Apply": "使用", + "Developing": "开发中" } diff --git a/web/public/locales/zh/translation.json b/web/public/locales/zh/translation.json index c8f378ee12..9027778ebd 100644 --- a/web/public/locales/zh/translation.json +++ b/web/public/locales/zh/translation.json @@ -498,7 +498,8 @@ "Save": "保存", "Recommended": "推荐模板", "Confirm": "如果存在依赖包未安装,将会自动重启应用,确定使用该模板吗?", - "ConfirmDeleteTemplate": "确定删除模板吗" + "ConfirmDeleteTemplate": "确定删除模板吗?", + "DeveloperInfo": "开发者信息" }, "Fee": "费用", "PleaseCloseApplicationFirst": "请先关闭应用", @@ -567,5 +568,6 @@ "Hour": "小时", "Core": "核", "No History": "暂无记录", - "Apply": "使用" + "Apply": "使用", + "Developing": "开发中" } diff --git a/web/src/apis/typing.d.ts b/web/src/apis/typing.d.ts index d257b165b1..738dbcfbc3 100644 --- a/web/src/apis/typing.d.ts +++ b/web/src/apis/typing.d.ts @@ -296,6 +296,8 @@ export type TFunctionTemplate = { items: { name: string; source: { code: string } }[]; dependencies: string[]; environments: { name: string; value: string }[]; + uid: string; + user: { username: string }; }; export type TemplateList = { @@ -367,3 +369,5 @@ export type TApplicationItem = { }; }; }; + +export type TSmsCode = "Signin" | "Signup" | "ResetPassword" | "Bind" | "Unbind" | "ChangePhone"; diff --git a/web/src/components/SendSmsCodeButton/index.tsx b/web/src/components/SendSmsCodeButton/index.tsx index 5011adfa7f..2bd56f512f 100644 --- a/web/src/components/SendSmsCodeButton/index.tsx +++ b/web/src/components/SendSmsCodeButton/index.tsx @@ -3,6 +3,7 @@ import { Button } from "@chakra-ui/react"; import clsx from "clsx"; import { t } from "i18next"; +import { TSmsCode } from "@/apis/typing"; import { useSendSmsCodeMutation } from "@/pages/auth/service"; import useGlobalStore from "@/pages/globalStore"; @@ -10,8 +11,9 @@ export function SendSmsCodeButton(props: { getPhone: any; className?: string; phoneNumber?: string; + type: TSmsCode; }) { - const { getPhone, className, phoneNumber } = props; + const { getPhone, className, phoneNumber, type } = props; const [isSendSmsCode, setIsSendSmsCode] = useState(false); const [countdown, setCountdown] = useState(60); const sendSmsCodeMutation = useSendSmsCodeMutation(); @@ -46,7 +48,7 @@ export function SendSmsCodeButton(props: { const res = await sendSmsCodeMutation.mutateAsync({ phone, - type: "ResetPassword", + type, }); if (res?.data) { diff --git a/web/src/pages/app/setting/UserInfo/Mods/PasswordEditor.tsx b/web/src/pages/app/setting/UserInfo/Mods/PasswordEditor.tsx index f382fb1d06..1ed46e105c 100644 --- a/web/src/pages/app/setting/UserInfo/Mods/PasswordEditor.tsx +++ b/web/src/pages/app/setting/UserInfo/Mods/PasswordEditor.tsx @@ -103,6 +103,7 @@ export default function UserNameEditor(props: { handleBack: any }) { getPhone={getValues} phoneNumber={"phone"} className="!h-6 !text-[12px]" + type="ResetPassword" /> diff --git a/web/src/pages/app/setting/UserInfo/Mods/PhoneEditor.tsx b/web/src/pages/app/setting/UserInfo/Mods/PhoneEditor.tsx index 5bf0dab83a..3c9b816398 100644 --- a/web/src/pages/app/setting/UserInfo/Mods/PhoneEditor.tsx +++ b/web/src/pages/app/setting/UserInfo/Mods/PhoneEditor.tsx @@ -88,6 +88,7 @@ export default function PhoneEditor(props: { handleBack: any }) { getPhone={getValues} phoneNumber={"oldPhoneNumber"} className="!h-6 !text-[12px]" + type="Unbind" /> @@ -119,6 +120,7 @@ export default function PhoneEditor(props: { handleBack: any }) { getPhone={getValues} phoneNumber={"newPhoneNumber"} className="!h-6 !text-[12px]" + type="Bind" /> diff --git a/web/src/pages/auth/reset-password/index.tsx b/web/src/pages/auth/reset-password/index.tsx index b975c3552e..17e8fbed48 100644 --- a/web/src/pages/auth/reset-password/index.tsx +++ b/web/src/pages/auth/reset-password/index.tsx @@ -104,7 +104,7 @@ export default function ResetPassword() { border={"1px solid #D5D6E1"} /> - + diff --git a/web/src/pages/functionTemplate/Mods/TemplateInfo/index.tsx b/web/src/pages/functionTemplate/Mods/TemplateInfo/index.tsx index 7f70ffc1ff..aaf2c6a791 100644 --- a/web/src/pages/functionTemplate/Mods/TemplateInfo/index.tsx +++ b/web/src/pages/functionTemplate/Mods/TemplateInfo/index.tsx @@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next"; import { Avatar, AvatarGroup, Box, Tooltip, useColorMode } from "@chakra-ui/react"; import clsx from "clsx"; +import { GithubIcon, PhoneIcon, WechatIcon } from "@/components/CommonIcon"; import FileTypeIcon from "@/components/FileTypeIcon"; import { getAvatarUrl } from "@/utils/getAvatarUrl"; @@ -22,6 +23,31 @@ const TemplateInfo = (props: { functionTemplate: TFunctionTemplate; usedBy: any[
+ {t("Template.DeveloperInfo")} + + +
+ + {functionTemplate.user.username} + + + + + + + + +
+
+
+ {t("Template.Function")} {(functionList || []).map((item) => { diff --git a/web/src/pages/functionTemplate/Mods/UseTemplateModal/index.tsx b/web/src/pages/functionTemplate/Mods/UseTemplateModal/index.tsx index cbbbd688a5..9b95d954ad 100644 --- a/web/src/pages/functionTemplate/Mods/UseTemplateModal/index.tsx +++ b/web/src/pages/functionTemplate/Mods/UseTemplateModal/index.tsx @@ -45,6 +45,7 @@ const UseTemplateModal = (props: { children: any; templateId: string; packageLis return ApplicationControllerFindAll({}); }, { + enabled: isOpen, onSuccess(data) { setAppList(data?.data || []); },