aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-05-03 22:01:04 +0800
committercrupest <crupest@outlook.com>2022-05-03 22:01:04 +0800
commitfc6805afcc73900162df5ee7742c22450d9f8ec0 (patch)
treef5a3301a3097aeb040daabe33743871444eaa295 /FrontEnd
parent28ee8811b60e782f1b8d556f5c73f64d49d1707b (diff)
downloadtimeline-fc6805afcc73900162df5ee7742c22450d9f8ec0.tar.gz
timeline-fc6805afcc73900162df5ee7742c22450d9f8ec0.tar.bz2
timeline-fc6805afcc73900162df5ee7742c22450d9f8ec0.zip
...
Diffstat (limited to 'FrontEnd')
-rw-r--r--FrontEnd/src/locales/en/translation.json1
-rw-r--r--FrontEnd/src/locales/zh/translation.json1
-rw-r--r--FrontEnd/src/views/settings/index.tsx18
3 files changed, 19 insertions, 1 deletions
diff --git a/FrontEnd/src/locales/en/translation.json b/FrontEnd/src/locales/en/translation.json
index c0bde4be..5ce4d70e 100644
--- a/FrontEnd/src/locales/en/translation.json
+++ b/FrontEnd/src/locales/en/translation.json
@@ -188,6 +188,7 @@
"myRegisterCodeDesc": "Click to create a new register code.",
"renewRegisterCode": "Renew Register Code",
"renewRegisterCodeDesc": "Confirm to renew register code? The old one will no longer be used.",
+ "myRegisterCodeCopied": "Register code copied!",
"dialogChangePassword": {
"title": "Change Password",
"prompt": "You are changing your password. You need to input the correct old password. After change, you need to login again and all old login will be invalid.",
diff --git a/FrontEnd/src/locales/zh/translation.json b/FrontEnd/src/locales/zh/translation.json
index 1b538f2a..721ac81a 100644
--- a/FrontEnd/src/locales/zh/translation.json
+++ b/FrontEnd/src/locales/zh/translation.json
@@ -188,6 +188,7 @@
"myRegisterCodeDesc": "点击以创建新的注册码。",
"renewRegisterCode": "创建新的注册码",
"renewRegisterCodeDesc": "确定要创建新的注册码吗?旧的注册码将无法再使用。",
+ "myRegisterCodeCopied": "注册码已复制!",
"dialogChangePassword": {
"title": "修改密码",
"prompt": "您正在修改密码,您需要输入正确的旧密码。成功修改后您需要重新登陆,而且以前所有的登录都会失效。",
diff --git a/FrontEnd/src/views/settings/index.tsx b/FrontEnd/src/views/settings/index.tsx
index 3cd5d889..31726dc2 100644
--- a/FrontEnd/src/views/settings/index.tsx
+++ b/FrontEnd/src/views/settings/index.tsx
@@ -16,6 +16,7 @@ import ChangeAvatarDialog from "./ChangeAvatarDialog";
import ChangeNicknameDialog from "./ChangeNicknameDialog";
import "./index.css";
+import { pushAlert } from "@/services/alert";
interface SettingSectionProps {
title: I18nText;
@@ -196,7 +197,22 @@ const SettingsPage: React.FC = (_) => {
) : registerCode === null ? (
<span>Noop</span>
) : (
- <code className="register-code">{registerCode}</code>
+ <code
+ className="register-code"
+ onClick={(event) => {
+ void navigator.clipboard
+ .writeText(registerCode)
+ .then(() => {
+ pushAlert({
+ type: "success",
+ message: "settings.myRegisterCodeCopied",
+ });
+ });
+ event.stopPropagation();
+ }}
+ >
+ {registerCode}
+ </code>
)}
</SettingItemContainer>
<ButtonSettingItem