From 073c728868407571aabce82999aca179c8df7625 Mon Sep 17 00:00:00 2001 From: gantrol Date: Thu, 2 Mar 2023 20:22:10 +0800 Subject: [PATCH] UI: popup ui modified --- components/Collapse.svelte | 4 +-- components/LinkButton.svelte | 2 +- components/PromiseWaiting.svelte | 20 ++++++----- components/SimpleCheckbox.svelte | 2 +- components/SimpleSelect.svelte | 2 +- components/popup/ExportSettings.svelte | 48 ++++++++----------------- components/popup/RequestSettings.svelte | 9 ++--- components/popup/UISettings.svelte | 9 ++--- locales/en/messages.json | 14 +++++--- locales/zh_CN/messages.json | 10 ++++-- popup.svelte | 34 ++++++++++++++---- todo.md | 1 + utils/constants.ts | 1 + 13 files changed, 81 insertions(+), 75 deletions(-) diff --git a/components/Collapse.svelte b/components/Collapse.svelte index 87972aa..32da452 100644 --- a/components/Collapse.svelte +++ b/components/Collapse.svelte @@ -6,9 +6,9 @@
+ class="collapse collapse-arrow border bg-base-100"> -
+
{title}
diff --git a/components/LinkButton.svelte b/components/LinkButton.svelte index 7192cdc..2ad0d6c 100644 --- a/components/LinkButton.svelte +++ b/components/LinkButton.svelte @@ -15,7 +15,7 @@ }; -
{/each} - diff --git a/components/popup/RequestSettings.svelte b/components/popup/RequestSettings.svelte index a77d55f..58f2bde 100644 --- a/components/popup/RequestSettings.svelte +++ b/components/popup/RequestSettings.svelte @@ -1,20 +1,16 @@ - - +
-
diff --git a/components/popup/UISettings.svelte b/components/popup/UISettings.svelte index 0283119..8e1422c 100644 --- a/components/popup/UISettings.svelte +++ b/components/popup/UISettings.svelte @@ -1,9 +1,9 @@ - - +
-
diff --git a/locales/en/messages.json b/locales/en/messages.json index c58847f..d6801eb 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -20,11 +20,11 @@ "description": "Record button" }, "popup_bing_chat_website_button": { - "message": "Bing Chat Website", + "message": "Bing Chat", "description": "Bing Website button" }, "popup_bing_new_website_button": { - "message": "Bing Chat Demo", + "message": "Chat Demo", "description": "Bing New Website button" }, "popup_bing_demo_website_button": { @@ -36,11 +36,11 @@ "description": "Link title" }, "popup_export_settings_title": { - "message": "Export Settings", + "message": "Export", "description": "Export title" }, "popup_ui_settings_title": { - "message": "UI Settings", + "message": "UI", "description": "UI title" }, "popup_hidden_welcome": { @@ -72,7 +72,7 @@ "description": "Export JSON button" }, "popup_request_setting": { - "message": "Request Settings", + "message": "Request", "description": "Request Setting" }, "popup_export_type_as_seen": { @@ -91,6 +91,10 @@ "message": "Not jump to cn.bing.com", "description": "Request IP" }, + "popup_settings": { + "message": "Settings", + "description": "Settings" + }, "end": { "message": "End", "description": "Just for end" diff --git a/locales/zh_CN/messages.json b/locales/zh_CN/messages.json index 16687d5..d1ec6f3 100644 --- a/locales/zh_CN/messages.json +++ b/locales/zh_CN/messages.json @@ -36,11 +36,11 @@ "description": "Link title" }, "popup_export_settings_title": { - "message": "导出设置", + "message": "导出", "description": "Export title" }, "popup_ui_settings_title": { - "message": "界面设置", + "message": "界面", "description": "UI title" }, "popup_hidden_welcome": { @@ -80,7 +80,7 @@ "description": "Export mobile button" }, "popup_request_setting": { - "message": "请求设置", + "message": "请求", "description": "Request setting" }, "popup_request_browser": { @@ -91,6 +91,10 @@ "message": "避免跳转到cn.bing.com", "description": "Request IP" }, + "popup_settings": { + "message": "设置", + "description": "Settings" + }, "end": { "message": "End", "description": "结尾的占位符" diff --git a/popup.svelte b/popup.svelte index 3583f06..099bb27 100644 --- a/popup.svelte +++ b/popup.svelte @@ -4,8 +4,18 @@ import ExportSettings from "~components/popup/ExportSettings.svelte"; import UISettings from "~components/popup/UISettings.svelte"; import RequestSettings from "~components/popup/RequestSettings.svelte"; + import Collapse from "~components/Collapse.svelte"; + import { popupPageI18nValue } from "~utils/constants"; let debug = false; + let activeTab = "export-setting-tab"; + + const tabOnClick = (e) => { + const tab_group = document.querySelector("#setting-tabs"); + tab_group.querySelector(".tab-active").classList.remove("tab-active"); + e.target.classList.add("tab-active"); + activeTab = e.target.id; + }; - - - diff --git a/todo.md b/todo.md index 4b949bc..3df8853 100644 --- a/todo.md +++ b/todo.md @@ -33,6 +33,7 @@ ## others - [ ] logger +- [ ] popup: page resize - [ ] make some function appear only in dev mode - [ ] how to add unittest for shadow-roots? - [ ] 改英文文档 diff --git a/utils/constants.ts b/utils/constants.ts index b5cd5f5..6cc08e3 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -75,6 +75,7 @@ const popupPageI18nKey = { HIDDEN_FEEDBACK: "popup_hidden_feedback", REQUEST_BROWSER: "popup_request_browser", REQUEST_IP: "popup_request_ip", + SETTINGS: "popup_settings", WAITING: "popup_waiting" };