diff --git a/client/electron/src/App.tsx b/client/electron/src/App.tsx index 882a652..d8722f2 100644 --- a/client/electron/src/App.tsx +++ b/client/electron/src/App.tsx @@ -195,7 +195,7 @@ export default function App() { * 外层 `relative` 是给悬浮加号定位用的 —— 窄屏时它正好落在底部导航之上。 */ const list = isComm && listBody ? ( -
+
{listBody} diff --git a/client/electron/src/components/CalendarView.tsx b/client/electron/src/components/CalendarView.tsx index 98c7aba..b70ca54 100644 --- a/client/electron/src/components/CalendarView.tsx +++ b/client/electron/src/components/CalendarView.tsx @@ -118,6 +118,34 @@ export default function CalendarView() { else setAnchor(a => addDays(a, dir)); } + /* + * 左右滑动手势(2026-09-14 用户:「日历页面还不支持左右滑动手势」)。 + * + * 复用 shift() —— 手势与「上一月/下一月」按钮必须是同一套翻页逻辑, + * 各写一遍的话阈值、边界、"周/日/月"三种刻度的行为迟早分叉。 + * + * 判据:水平位移 ≥ 40px 且明显大于垂直位移(否则会把纵向滚动列表误判成翻页, + * 那是移动端最容易犯的手势错误);同时要求时间 < 600ms,避免"慢慢拖"也翻页。 + */ + const touch = useRef<{ x: number; y: number; t: number } | null>(null); + const onTouchStart = (e: React.TouchEvent) => { + const t = e.touches[0]; + if (!t) return; + touch.current = { x: t.clientX, y: t.clientY, t: Date.now() }; + }; + const onTouchEnd = (e: React.TouchEvent) => { + const start = touch.current; + touch.current = null; + const t = e.changedTouches[0]; + if (!start || !t) return; + const dx = t.clientX - start.x; + const dy = t.clientY - start.y; + const fast = Date.now() - start.t < 600; + if (Math.abs(dx) < 40 || Math.abs(dx) < Math.abs(dy) * 1.5 || !fast) return; + // 左滑 = 看下一段(与翻页按钮的"下一月"同向),右滑 = 上一段 + shift(dx < 0 ? 1 : -1); + }; + function goToday() { const now = new Date(); setAnchor(now); @@ -199,7 +227,11 @@ export default function CalendarView() { // ─── 左栏:工具条 + 网格 ─── const gridPane = ( -
+