feat: enable drag area for tauri apps

This commit is contained in:
Yidadaa 2023-06-15 23:20:14 +08:00
parent 47c546fafa
commit 698be6671c
10 changed files with 73 additions and 14 deletions

View File

@ -728,7 +728,7 @@ export function Chat() {
return (
<div className={styles.chat} key={session.id}>
<div className="window-header">
<div className="window-header" data-tauri-drag-region>
<div className="window-header-title">
<div
className={`window-header-main-title " ${styles["chat-body-title"]}`}

View File

@ -291,7 +291,7 @@ export function Settings() {
return (
<ErrorBoundary>
<div className="window-header">
<div className="window-header" data-tauri-drag-region>
<div className="window-header-title">
<div className="window-header-main-title">
{Locale.Settings.Title}

View File

@ -118,8 +118,10 @@ export function SideBar(props: { className?: string }) {
shouldNarrow && styles["narrow-sidebar"]
}`}
>
<div className={styles["sidebar-header"]}>
<div className={styles["sidebar-title"]}>ChatGPT Next</div>
<div className={styles["sidebar-header"]} data-tauri-drag-region>
<div className={styles["sidebar-title"]} data-tauri-drag-region>
ChatGPT Next
</div>
<div className={styles["sidebar-sub-title"]}>
Build your own AI assistant.
</div>

View File

@ -69,7 +69,6 @@ function getLanguage() {
try {
return navigator.language.toLowerCase();
} catch {
console.log("[Lang] failed to detect user lang.");
return DEFAULT_LANG;
}
}

View File

@ -1116,4 +1116,4 @@
.markdown-body ::-webkit-calendar-picker-indicator {
filter: invert(50%);
}
}

View File

@ -12,6 +12,9 @@ const nextConfig = {
return config;
},
output: mode,
images: {
unoptimized: mode === "export",
},
};
if (mode !== "export") {

View File

@ -36,7 +36,6 @@
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"sass": "^1.59.2",
"sharp": "^0.32.1",
"spark-md5": "^3.0.2",
"use-debounce": "^9.0.3",
"zustand": "^4.3.6"

34
src-tauri/Cargo.lock generated
View File

@ -1636,6 +1636,16 @@ version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "open"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8"
dependencies = [
"pathdiff",
"windows-sys 0.42.0",
]
[[package]]
name = "overload"
version = "0.1.1"
@ -1690,6 +1700,12 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "percent-encoding"
version = "2.2.0"
@ -2537,9 +2553,11 @@ dependencies = [
"ignore",
"objc",
"once_cell",
"open",
"percent-encoding",
"rand 0.8.5",
"raw-window-handle",
"regex",
"semver",
"serde",
"serde_json",
@ -2593,6 +2611,7 @@ dependencies = [
"png",
"proc-macro2",
"quote",
"regex",
"semver",
"serde",
"serde_json",
@ -3256,6 +3275,21 @@ version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.45.0"

View File

@ -1,9 +1,9 @@
[package]
name = "chatgpt-next-web"
version = "0.1.0"
description = "A Tauri App"
description = "A cross platform app for LLM ChatBot."
authors = ["Yidadaa"]
license = "anti-996"
license = "mit"
repository = ""
default-run = "chatgpt-next-web"
edition = "2021"
@ -17,7 +17,7 @@ tauri-build = { version = "1.3.0", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.3.0", features = [] }
tauri = { version = "1.3.0", features = ["clipboard-all", "shell-open", "window-close", "window-hide", "window-maximize", "window-minimize", "window-set-icon", "window-set-ignore-cursor-events", "window-set-resizable", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] }
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.

View File

@ -8,16 +8,37 @@
},
"package": {
"productName": "chatgpt-next-web",
"version": "2.8.1"
"version": "2.8.2"
},
"tauri": {
"allowlist": {
"all": false
"all": false,
"shell": {
"all": false,
"open": true
},
"clipboard": {
"all": true
},
"window": {
"all": false,
"close": true,
"hide": true,
"maximize": true,
"minimize": true,
"setIcon": true,
"setIgnoreCursorEvents": true,
"setResizable": true,
"show": true,
"startDragging": true,
"unmaximize": true,
"unminimize": true
}
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"copyright": "2023, Zhang Yifei All Rights Reserved.",
"deb": {
"depends": []
},
@ -59,7 +80,8 @@
"height": 600,
"resizable": true,
"title": "ChatGPT Next Web",
"width": 960
"width": 960,
"titleBarStyle": "Overlay"
}
]
}