fix few bugs

This commit is contained in:
pj committed 2026-09-02 19:12:19 +05:30
1 parent c1c6db1406
commit 1c709967f8
7 files changed
+61 -22

No files matched your search

+5 -2
View File
@@ -27,7 +27,7 @@ import { useSync } from "./store/useSync";
import { notify } from "./store/useToast";
import { useCompact, usePhone, useTouch } from "./useMedia";
import { syncFlush } from "./api/sync";
import { isDesktop, isTauri, live, type AuthEvent, type SyncStatus } from "./ipc";
import { isDesktop, isMacDesktop, isTauri, live, type AuthEvent, type SyncStatus } from "./ipc";
/** Long enough for sync_flush's own 1s lock wait plus its 4s drain budget. */
const FLUSH_TIMEOUT_MS = 5500;
@@ -91,8 +91,11 @@ function App() {
// `isDesktop` genuinely means desktop here: there is no close to intercept on a phone, and the
// window commands live in a capability that platform does not get, so this would be a rejected
// IPC call rather than a no-op. The outbox still drains on the next launch either way.
//
// Not on macOS, where closing the window hides it (lib.rs) and the process, sync loop included,
// carries on behind it. A listener here would be the thing that destroyed the window instead.
useEffect(() => {
if (!isDesktop) return;
if (!isDesktop || isMacDesktop) return;
const win = getCurrentWindow();
const unlisten = win.onCloseRequested(async (event) => {
if (useSync.getState().pendingWrites === 0) return;
+3 -13
View File
@@ -1,8 +1,6 @@
// The only persistent chrome. It carries the date range, the view switcher and the current time
// range, and on macOS the traffic lights float over it, so it costs no extra height.
import { getCurrentWindow } from "@tauri-apps/api/window";
import type { MouseEvent as ReactMouseEvent } from "react";
import { Icon } from "./Icon";
import { useCalendarView, spanFor, type View } from "../store/useCalendarView";
import { useOverlays } from "../store/useOverlays";
@@ -10,7 +8,6 @@ import { useSync } from "../store/useSync";
import { useTheme } from "../store/useTheme";
import { addDays, formatRange } from "../time";
import { keyLabel, keysFor } from "../keys/bindings";
import { isDesktop } from "../ipc";
import type { CommandId } from "../keys/commands";
// Exported where the phone bar shows the same thing: two rows of chrome that disagreed about which
@@ -55,17 +52,10 @@ export function Header() {
const { from, to } = spanFor(view, anchor);
const step = moveDay;
// Double click to zoom, the way a native title bar does. Tauri's drag region only handles this
// when the header itself is the event target, and the layout children cover it end to end, so
// it is wired explicitly. A double click on a control is not a title bar gesture.
const onDoubleClick = (e: ReactMouseEvent<HTMLElement>) => {
if (!isDesktop) return;
if ((e.target as HTMLElement).closest("button, input, select, a")) return;
void getCurrentWindow().toggleMaximize();
};
// Dragging and double click to zoom both come from Tauri's drag region script, which skips
// buttons on its own. A second toggle from here would undo the first.
return (
<header className="titlebar" data-tauri-drag-region onDoubleClick={onDoubleClick}>
<header className="titlebar" data-tauri-drag-region>
<div className="lead" data-tauri-drag-region>
<button
className="icon-button"
+4
View File
@@ -112,6 +112,10 @@ select {
padding: var(--safe-top) 14px 0;
background: var(--shell);
border-bottom: 1px solid var(--line);
/* Tauri's drag region lets the second click of a double click through to the webview so it can
zoom on mouseup, and WebKit would otherwise read that click as "select the nearest word". */
-webkit-user-select: none;
user-select: none;
}
/* The macOS traffic lights float over this row, so it opens a lane for them and costs no extra