diff --git a/src/App.vue b/src/App.vue index d0d069c..13aedf4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,12 +43,6 @@ onMounted(() => { "sidebar content"; } -.n-spin-content, -.n-spin-container { - width: 100%; - height: 100%; -} - .n-message { user-select: none; -webkit-user-select: none; diff --git a/src/components/Device.vue b/src/components/Device.vue index 53b7cca..1b558df 100644 --- a/src/components/Device.vue +++ b/src/components/Device.vue @@ -27,9 +27,7 @@ import { NDataTable, NDropdown, NEmpty, - NTooltip, NFlex, - NIcon, NSpin, DataTableColumns, DropdownOption, @@ -45,6 +43,7 @@ import { useI18n } from "vue-i18n"; import { closeExternalControl, connectExternalControl } from "../websocket"; import { LogicalSize, getCurrentWindow } from "@tauri-apps/api/window"; import { writeText } from "@tauri-apps/plugin-clipboard-manager"; +import ButtonWithTip from "./common/ButtonWithTip.vue"; const { t } = useI18n(); const dialog = useDialog(); @@ -359,8 +358,8 @@ function closeWS() { @@ -480,13 +477,12 @@ function closeWS() { } .device { - flex-grow: 1; + @include common.scrollbar; + @include common.flexFullHeight; color: var(--light-color); background-color: var(--bg-color); padding: 0 20px; - height: 0; overflow-y: auto; - @include common.scrollbar; } .controled-device-list { diff --git a/src/components/common/ButtonWithTip.vue b/src/components/common/ButtonWithTip.vue new file mode 100644 index 0000000..5e28d40 --- /dev/null +++ b/src/components/common/ButtonWithTip.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/components/setting/Basic.vue b/src/components/setting/Basic.vue index 3fec5e4..7a4e626 100644 --- a/src/components/setting/Basic.vue +++ b/src/components/setting/Basic.vue @@ -68,15 +68,17 @@ function changeClipboardSync() { $t("pages.Setting.Basic.adbPath.set") }} - 剪切板同步 + {{ $t("pages.Setting.Basic.clipboardSync.title") }} - - 设备剪切板发生变化时自动同步更新电脑剪切板 + + {{ $t("pages.Setting.Basic.clipboardSync.syncFromDeviceTip") }} - - 在按键输入模式下,按下 Ctrl + V 可将电脑剪切板内容同步粘贴到设备 + + {{ $t("pages.Setting.Basic.clipboardSync.pasteFromPCTip") }} diff --git a/src/components/setting/Data.vue b/src/components/setting/Data.vue index 6f7f92b..965efc1 100644 --- a/src/components/setting/Data.vue +++ b/src/components/setting/Data.vue @@ -11,19 +11,17 @@ import { NInput, useDialog, NCard, - NIcon, } from "naive-ui"; import { relaunch } from "@tauri-apps/plugin-process"; import { onMounted, ref } from "vue"; import { useI18n } from "vue-i18n"; import { LocalStore } from "../../store/localStore"; +import ButtonWithTip from "../common/ButtonWithTip.vue"; const { t } = useI18n(); const dialog = useDialog(); -// TODO add tooltip for btn - const localStoreEntries = ref<[string, unknown][]>([]); const showDataModal = ref(false); const dataModalInputVal = ref(""); @@ -80,28 +78,22 @@ function delLocalStore(key?: string) { {{ $t("pages.Setting.Data.localStore") }} - - - - + - - + :tip="$t('pages.Setting.Data.btnRefresh')" + :icon="Refresh" + /> {{ $t("pages.Setting.Data.delLocalStore.warning") }} diff --git a/src/components/setting/Setting.vue b/src/components/setting/Setting.vue index c7d7b46..fe4eba1 100644 --- a/src/components/setting/Setting.vue +++ b/src/components/setting/Setting.vue @@ -48,12 +48,13 @@ const store = useGlobalStore(); color: var(--light-color); overflow-y: auto; overflow-x: hidden; + // for spin div display: flex; + flex-direction: column; .n-tabs { height: 100%; } - .n-tab-pane { padding: 0; } diff --git a/src/css/common.scss b/src/css/common.scss index 97ccbc8..9f9edbd 100644 --- a/src/css/common.scss +++ b/src/css/common.scss @@ -4,6 +4,14 @@ height: 100%; } +@mixin flexFullHeight { + flex-grow: 1; + height: 0; + // for child + display: flex; + flex-direction: column; +} + @mixin scrollbar { &::-webkit-scrollbar { height: 6px; diff --git a/src/styles.css b/src/css/global.scss similarity index 70% rename from src/styles.css rename to src/css/global.scss index d9f0757..54baa27 100644 --- a/src/styles.css +++ b/src/css/global.scss @@ -1,3 +1,5 @@ +@use "./common.scss"; + :root { --primary-color: #63e2b7; --primary-hover-color: #7fe7c4; @@ -10,8 +12,8 @@ --gray-color: #6b6e76; --red-color: #fc5185; --red-pressed-color: #f4336d; - --blue-color: #70C0E8; - --blue-pressed-color: #66AFD3; + --blue-color: #70c0e8; + --blue-pressed-color: #66afd3; } html, @@ -26,3 +28,10 @@ div#app { height: 100%; box-sizing: border-box; } + +.n-spin-container { + @include common.flexFullHeight; + .n-spin-content { + @include common.flexFullHeight; + } +} diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index ab4cc59..78540ab 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -36,7 +36,9 @@ "wsConnect": "Control", "adbDeviceError": "Unable to get available devices", "adbConnectError": "Wireless connection failed", - "rotation": "Device rotation {0}°" + "rotation": "Device rotation {0}°", + "btnShutdown": "Shutdown control", + "btnRefresh": "Refresh" }, "Mask": { "keyconfigException": "The key mapping config is abnormal, please delete this config", @@ -105,6 +107,13 @@ "set": "Save", "setSuccess": "adb path set successfully", "title": "adb path" + }, + "clipboardSync": { + "title": "Clipboard Sync", + "syncFromDevice": "Sync from device", + "syncFromDeviceTip": "Automatically synchronize and update your computer's clipboard when the device clipboard changes.", + "pasteFromPC": "Paste from PC", + "pasteFromPCTip": "In KeyInpu mode, press Ctrl + V to paste the contents of your computer's clipboard to your device." } }, "Data": { @@ -119,7 +128,9 @@ "warning": "Deleting data may lead to unpredictable consequences, so please operate with caution. \nIf an exception occurs, please try clearing the data and restarting the software." }, "localStore": "Local data", - "delCurData": "Delete current data" + "delCurData": "Delete current data", + "btnRefresh": "Refresh", + "btnDelAll": "Clear local data" }, "About": { "introduction": "A Scrcpy client in Rust & Tarui aimed at providing mouse and key mapping to control Android device.", diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index b22ade6..addb58e 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -36,7 +36,9 @@ "wsConnect": "控制", "adbDeviceError": "无法获取可用设备", "adbConnectError": "无线连接失败", - "rotation": "设备旋转 {0}°" + "rotation": "设备旋转 {0}°", + "btnShutdown": "关闭控制", + "btnRefresh": "刷新" }, "Mask": { "keyconfigException": "按键方案异常,请删除此方案", @@ -105,6 +107,13 @@ "title": "adb 路径", "placeholder": "adb 路径", "set": "设置" + }, + "clipboardSync": { + "title": "剪切板同步", + "syncFromDevice": "从设备同步", + "syncFromDeviceTip": "设备剪切板发生变化时自动同步更新电脑剪切板", + "pasteFromPC": "从电脑粘贴", + "pasteFromPCTip": "在按键输入模式下,按下 Ctrl + V 可将电脑剪切板内容同步粘贴到设备" } }, "Data": { @@ -119,7 +128,9 @@ "warning": "删除数据可能导致无法预料的后果,请慎重操作。若出现异常请尝试清空数据并重启软件。" }, "localStore": "本地数据", - "delCurData": "删除当前数据" + "delCurData": "删除当前数据", + "btnDelAll": "清空本地数据", + "btnRefresh": "刷新" }, "About": { "about": "关于", diff --git a/src/main.ts b/src/main.ts index 89f689e..4f0bc3e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from "vue"; import { createPinia } from "pinia"; -import "./styles.css"; +import "./css/global.scss"; import App from "./App.vue"; import router from "./router"; import i18n from "./i18n";