Skip to content

Commit

Permalink
feat: enable drag area for tauri apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Jun 15, 2023
1 parent 47c546f commit 698be66
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}`}
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 4 additions & 2 deletions app/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion app/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ function getLanguage() {
try {
return navigator.language.toLowerCase();
} catch {
console.log("[Lang] failed to detect user lang.");
return DEFAULT_LANG;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/styles/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1116,4 +1116,4 @@

.markdown-body ::-webkit-calendar-picker-indicator {
filter: invert(50%);
}
}
3 changes: 3 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const nextConfig = {
return config;
},
output: mode,
images: {
unoptimized: mode === "export",
},
};

if (mode !== "export") {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
34 changes: 34 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down
30 changes: 26 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
},
Expand Down Expand Up @@ -59,7 +80,8 @@
"height": 600,
"resizable": true,
"title": "ChatGPT Next Web",
"width": 960
"width": 960,
"titleBarStyle": "Overlay"
}
]
}
Expand Down

0 comments on commit 698be66

Please sign in to comment.