From 23b452f5794eaf659ee1d69ec91aa130e229fb97 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Sun, 29 Jan 2023 08:13:53 +0800 Subject: [PATCH] fix: update license error tip --- package.json | 3 +-- src/routes/setting/License/UpdateLicenseModal.tsx | 10 ++++++---- src/routes/setting/License/index.tsx | 4 ++-- yarn.lock | 7 ------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 87856f23..9daf83ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vocechat-web", - "version": "0.3.37", + "version": "0.3.38", "private": true, "homepage": "https://voce.chat", "dependencies": { @@ -123,7 +123,6 @@ "@types/emoji-mart": "^3.0.9", "@types/masonry-layout": "^4.2.5", "@types/react-helmet": "^6.1.6", - "@types/react-linkify": "^1.0.1", "@types/react-syntax-highlighter": "^15.5.6", "@types/styled-components": "^5.1.26", "@typescript-eslint/eslint-plugin": "^5.49.0", diff --git a/src/routes/setting/License/UpdateLicenseModal.tsx b/src/routes/setting/License/UpdateLicenseModal.tsx index 32579f70..74c049e5 100644 --- a/src/routes/setting/License/UpdateLicenseModal.tsx +++ b/src/routes/setting/License/UpdateLicenseModal.tsx @@ -8,7 +8,7 @@ import Textarea from "../../../common/component/styled/Textarea"; import { useTranslation } from "react-i18next"; interface Props { closeModal: () => void; - updateLicense: (param: string) => void; + updateLicense: (param: string) => Promise; updated: boolean; updating: boolean // domain: string; @@ -19,9 +19,11 @@ const UpdateLicenseModal: FC = ({ closeModal, updateLicense, updating, up const { t } = useTranslation("setting"); const { t: ct } = useTranslation(); - const handleRenew = () => { - updateLicense(value); - + const handleRenew = async () => { + const updateSuccess = await updateLicense(value); + if (typeof updateSuccess == "boolean" && !updateSuccess) { + toast.error("Check License Invalid!"); + } }; const handleLicenseUpdate = (evt: ChangeEvent) => { setValue(evt.target.value); diff --git a/src/routes/setting/License/index.tsx b/src/routes/setting/License/index.tsx index f975d5af..fcf4b3d8 100644 --- a/src/routes/setting/License/index.tsx +++ b/src/routes/setting/License/index.tsx @@ -6,7 +6,7 @@ import LicensePriceListModal from "./LicensePriceListModal"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; import UpdateLicenseModal from "./UpdateLicenseModal"; -import Tippy from "@tippyjs/react"; +// import Tippy from "@tippyjs/react"; interface ItemProps extends HTMLAttributes { label: string, data?: string | number | string[], foldable?: boolean } const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => { @@ -26,7 +26,7 @@ const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => { }; export default function License() { const { t, i18n } = useTranslation("setting"); - const { t: ct } = useTranslation(); + // const { t: ct } = useTranslation(); const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense(); const [modalVisible, setModalVisible] = useState(false); const [updateVisible, setUpdateVisible] = useState(false); diff --git a/yarn.lock b/yarn.lock index d3f19c75..3844e0cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3103,13 +3103,6 @@ dependencies: "@types/react" "*" -"@types/react-linkify@^1.0.1": - version "1.0.1" - resolved "https://mirrors.cloud.tencent.com/npm/@types%2freact-linkify/-/react-linkify-1.0.1.tgz#4ece351faef22bfde1280b6d9ace5e88683a74d4" - integrity sha512-qPxYwjB41ezoKdLXs0MrQ1FnhF3apyyxf3J7WVQQCBu/GyZQAW7Y3TY4317jdh0450QJ4fLqj0rnhIJvFZOamQ== - dependencies: - "@types/react" "*" - "@types/react-syntax-highlighter@^15.5.6": version "15.5.6" resolved "https://mirrors.cloud.tencent.com/npm/@types%2freact-syntax-highlighter/-/react-syntax-highlighter-15.5.6.tgz#77c95e6b74d2be23208fcdcf187b93b47025f1b1"