chore: adjust the position of the compact mode window (#997)

* chore: adjust the position of the compact mode window

* docs: update release note

* chore: adjust code

* chore: adjust code
This commit is contained in:
BiggerRain
2025-12-05 10:46:37 +08:00
committed by GitHub
parent 6e2514adbd
commit 3b80eb77b4
6 changed files with 16 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ Information about release notes of Coco App is provided here.
- chore: write panic message to stdout in panic hook #989
- refactor: error handling in install_extension interfaces #995
- chore: adjust the position of the compact mode window #997
## 0.9.0 (2025-11-19)

View File

@@ -63,7 +63,10 @@ async fn change_window_height(handle: AppHandle, height: u32) {
let monitor_position = monitor.position();
let monitor_size = monitor.size();
let window_width = window.outer_size().unwrap().width as i32;
let outer_size = window.outer_size().unwrap();
let window_width = outer_size.width as i32;
let window_height = outer_size.height as i32;
let x = monitor_position.x + (monitor_size.width as i32 - window_width) / 2;
let y =

View File

@@ -35,7 +35,7 @@ import {
visibleSearchBar,
} from "@/utils";
import { useTauriFocus } from "@/hooks/useTauriFocus";
import { POPOVER_PANEL_SELECTOR } from "@/constants";
import { POPOVER_PANEL_SELECTOR, WINDOW_CENTER_BASELINE_HEIGHT } from "@/constants";
import { useChatStore } from "@/stores/chatStore";
import { useSearchStore } from "@/stores/searchStore";
@@ -112,7 +112,7 @@ function SearchChat({
}
const width = 680;
let height = 590;
let height = WINDOW_CENTER_BASELINE_HEIGHT;
const updateAppDialog = document.querySelector("#update-app-dialog");
const popoverPanelEl = document.querySelector(POPOVER_PANEL_SELECTOR);
@@ -136,7 +136,7 @@ function SearchChat({
}
}
if (height < 590) {
if (height < WINDOW_CENTER_BASELINE_HEIGHT) {
const { compactModeAutoCollapseDelay } = useConnectStore.getState();
collapseWindowTimer.current = setTimeout(() => {

View File

@@ -13,3 +13,5 @@ export const SETTINGS_WINDOW_LABEL = "settings";
export const CHECK_WINDOW_LABEL = "check";
export const CHAT_WINDOW_LABEL = "chat";
export const WINDOW_CENTER_BASELINE_HEIGHT = 590;

View File

@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import { isPlainObject } from "lodash-es";
import SearchChat from "@/components/SearchChat";
import { WINDOW_CENTER_BASELINE_HEIGHT } from "@/constants";
import { useAppStore } from "@/stores/appStore";
import { useShortcutsStore } from "@/stores/shortcutsStore";
import { useIsMobile } from "@/hooks/useIsMobile";
@@ -41,7 +42,7 @@ interface WebAppProps {
function WebApp({
width = 680,
height = 590,
height = WINDOW_CENTER_BASELINE_HEIGHT,
headers = {
"X-API-TOKEN": "",
"APP-INTEGRATION-ID": "",

View File

@@ -1,4 +1,5 @@
import * as commands from "@/commands";
import { WINDOW_CENTER_BASELINE_HEIGHT } from "@/constants";
// Window operations
export const windowWrapper = {
@@ -14,6 +15,9 @@ export const windowWrapper = {
const window = await this.getCurrentWebviewWindow();
if (window) {
await window.setSize(new LogicalSize(width, height));
if (height < WINDOW_CENTER_BASELINE_HEIGHT) {
await window.center();
}
}
},
};