mirror of
https://github.com/infinilabs/coco-app.git
synced 2026-02-24 04:01:27 +01:00
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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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": "",
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user