From 74ce55ce211758d23aa0aed7d4fa27a287efc43a Mon Sep 17 00:00:00 2001 From: "sipc.ink" <92251518+SIPC@users.noreply.github.com> Date: Sun, 10 Mar 2024 11:12:34 +0800 Subject: [PATCH] update to 1.2 Fix the issue where the source language and target language are the same. --- src/components/ResultBox.tsx | 2 +- src/pages/index.tsx | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/ResultBox.tsx b/src/components/ResultBox.tsx index 0822aa4..3786631 100644 --- a/src/components/ResultBox.tsx +++ b/src/components/ResultBox.tsx @@ -92,7 +92,7 @@ export function ResultContainer({ isExpanded, }: ResultContainerProps) { useEffect(() => { - const version = "1.1"; + const version = "1.2"; const localVersion = localStorage.getItem("version"); if (version !== localVersion) { const keys = Object.keys(localStorage); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index fe23537..f9bb08e 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -173,7 +173,16 @@ export default function Home() { className={`mt-2`} variant={`default`} disabled={loader.translate} - onClick={submit} + onClick={() => { + if (from === to) { + toast({ + title: "Translate Error", + description: '源语言和目标语言不能相同', + }); + } else { + submit() + } + }} > {loader.translate && (