Commit Graph

27 Commits

Author SHA1 Message Date
zikai
1c6ecf9d86 refactor: 移除重做/应用按钮, 自动应用更改, 删除死代码, 修复性能问题
UI 变更:
- 移除重做按钮及 redo/canRedo/redoStack 相关逻辑 (useCalendar, HeaderBar)
- 移除应用更改按钮, EventDetail 改为 watch form 自动应用 (deep watch)
- 用 syncing 标志防止 syncForm 回写时触发自动应用的循环

死代码清理:
- weekday.js: 移除未使用的 BYDAY_TO_INDEX 和 dowLabel
- date.js: 移除未使用的 toHHMM
- App.vue: 移除未使用的 .empty CSS
- DropZone.vue: 移除空的 .icon 容器及 CSS
- test/weekday.test.js: 移除对应死代码的 2 个测试用例

性能修复:
- WeekPreview: layoutEvents 从模板内联调用改为 computed (laidOutByDate),
  避免每次渲染重新计算布局
- MonthPreview: occByDate 过滤为仅网格内 42 天, 避免展开全部 occurrence

代码质量:
- useCalendar: prevMonth/nextMonth 合并为 shiftMonth(delta), 消除重复
- WeekPreview/MonthPreview: 移除未使用导入 (toISODate, toDate)
2026-07-22 04:18:05 +00:00
zikai
add471eb44 feat: 新增月预览和周预览组件及视图切换滑块
- App.vue: 新增三段式视图切换滑块 (编辑/月预览/周预览), 条件渲染对应组件
- MonthPreview.vue (新增): 月历网格, 每天显示事件标题色块, 悬停显示详情,
  支持上一月/下一月翻页, 今天高亮
- WeekPreview.vue (新增): 时间网格 (7列周一~周日, 24行每小时), 事件按真实
  时间定位 (top/height), 重叠事件并排布局, 支持上一周/下一周翻页
- 编辑模式显示左侧事件列表, 预览模式隐藏列表占满宽度
2026-07-22 04:07:16 +00:00
zikai
f4c11bdc3e feat: 新增视图切换状态管理及颜色/日期工具
- date.js: 新增 startOfWeek, startOfMonth, hhmmToMinutes 辅助函数
- colors.js (新增): 基于 uid 哈希的事件颜色分配, 12 色调色板
- useCalendar.js: 新增 viewMode (edit/month/week) 和 previewDate 状态,
  以及 setViewMode/prevMonth/nextMonth/prevWeek/nextWeek 操作
2026-07-22 04:04:29 +00:00
zikai
50fc8de9eb fix: 移除拖拽区中央的占位文字 2026-07-22 04:03:02 +00:00
zikai
a475315eb7 fix: 解析 ICS 时缺失 UID 导致全部日程被同时选中
ical-io.js 中 UID 缺失时回退为空字符串, 导致所有事件共享 uid='',
EventList 的 active 判断和 selectedEvent 的 find() 全部命中第一个事件。
改为缺失时调用 genUUID() 生成唯一 UID。
2026-07-22 04:02:43 +00:00
zikai
84dbaf9cd2 style: 移除 emoji, 注释改为中文 (保留专业名词)
- 移除所有 Vue 组件和 README 中的 emoji (按钮文字、标题、功能列表)
- 将 src 下所有英文注释改为中文, 保留专业名词 (RRULE, EXDATE, ICS 等)
- 涉及文件: date.js, event-factory.js, ical-io.js, organize.js,
  recur.js, split.js, weekday.js, useCalendar.js, EventDetail.vue,
  App.vue, DropZone.vue, EventList.vue, HeaderBar.vue, README.md
2026-07-22 02:55:45 +00:00
zikai
e9fc10c89d fix: WEEKLY 事件的 BYDAY 与 dtstartDate 不一致导致 ICS 输出错误
applyChanges 中 BYDAY 此前取自表单下拉框(默认 'MO'), 与 dtstartDate
的星期可能不一致。expandOccurrences 按 dtstartDate 展开 occurrence,
但序列化的 RRULE 写入表单选择的 BYDAY, 两者不匹配时日历应用会显示
错误的星期。

修复: BYDAY 始终由 dtstartDate 的星期自动推导(bydayFromDate), 下拉框
改为只读展示。确保 RRULE BYDAY 与实际 occurrence 日期始终一致。
2026-07-22 02:45:04 +00:00
zikai
4a2c53204f fix: crypto.randomUUID 在非安全上下文(非HTTPS)下崩溃
新增 src/lib/uuid.js 提供 genUUID(), 优先使用 crypto.randomUUID,
不可用时回退到 getRandomValues 手动拼装 v4 UUID, 最终回退到 Math.random。

原因: crypto.randomUUID() 仅在安全上下文(HTTPS 或 localhost)可用。
当前站点通过 http://f.zikai.wang:8888 访问, 属于非安全上下文,
导致 event-factory.js 的新增日程和 split.js 的拆分事件功能崩溃。

涉及文件:
- src/lib/uuid.js (新增): 带 fallback 的 UUID 生成
- src/lib/event-factory.js: crypto.randomUUID -> genUUID
- src/lib/split.js: crypto.randomUUID -> genUUID
2026-07-22 02:43:29 +00:00
zikai
6997f7a708 docs: 精简 README, 补充 Ubuntu 安装与 systemd 部署说明
- 重写 README 为精简版, 包含项目结构/Ubuntu 从零安装/启动关闭使用说明
- vite.config.js 添加 preview.allowedHosts 允许 f.zikai.wang 域名访问
- package-lock.json 随 npm 版本差异更新
2026-07-22 02:27:24 +00:00
timeTable2 dev
51461ff5f2 fix: use JSON clone instead of structuredClone for Vue reactive proxies
structuredClone cannot clone Vue reactive Proxy objects (DataCloneError).
EventModel contains only plain data, so JSON round-trip is safe and
lossless. Verified: organize, toggle, undo, download all work correctly.
2026-07-13 20:13:19 +08:00
timeTable2 dev
b352c4e116 refactor: high-cohesion low-coupling cleanup across store and components
ical-io.js:
- Import pad2/parseISODate from date.js (remove local duplicates)
- Rename ICAL.Time helpers to icalTimeTo* for clarity

useCalendar.js:
- Delegate addEvent to createEvent() factory
- Delegate splitEvent to splitRecurringEvent() pure function
- Use cloneEvent() instead of JSON.parse(JSON.stringify())
- Add selectEvent() action (components no longer mutate state.selectedUid directly)

Components:
- EventList: use selectEvent action + toDate() from date.js
- HeaderBar: destructure loadFile at top level (was re-calling useCalendar in handler)
- EventDetail: import DOW from weekday.js (was inlining the array)
- OccurrenceGrid: use toDate() from date.js
2026-07-13 20:06:00 +08:00
timeTable2 dev
02cfdda900 refactor: extract date.js, event-factory.js, split.js; use shared date helpers in recur/organize
- date.js: single source of truth for ISO date formatting/arithmetic
  (toISODate, parseISODate, addDays, daysBetween, todayISO, nowCompactTimestamp)
- event-factory.js: createEvent/cloneEvent (structuredClone with JSON fallback)
- split.js: splitRecurringEvent pure function using intervalDays from recur.js
- recur.js: replaced local toISO() and inline Date math with date.js helpers
- organize.js: replaced inline date formatting and gap math with date.js helpers,
  extracted buildGrid() helper and byDate comparator
2026-07-13 20:01:10 +08:00
timeTable2 dev
e4f549f848 docs: add README 2026-07-13 18:53:39 +08:00
timeTable2 dev
3af6b856e3 fix: store VTIMEZONEs as raw jCal arrays for Vue reactivity safety
ICAL.Component instances break when wrapped by Vue's reactive proxy
(the .jCal getter returns undefined through the proxy, causing
serializeICS to crash with 'Cannot read properties of undefined').
Storing vtz.jCal (plain arrays) instead makes meta fully serializable
for both reactivity and JSON snapshot cloning.
2026-07-13 18:53:01 +08:00
timeTable2 dev
15b6f30896 feat: add EventDetail with edit form, occurrence grid, split 2026-07-13 18:43:28 +08:00
timeTable2 dev
8a1d547001 feat: add OccurrenceGrid component 2026-07-13 18:41:51 +08:00
timeTable2 dev
f52f5315e6 feat: add EventList and HeaderBar with organize/undo/download 2026-07-13 18:40:44 +08:00
timeTable2 dev
906679fc11 feat: add DropZone and App layout skeleton 2026-07-13 18:39:15 +08:00
timeTable2 dev
361cc38384 feat: add central store with snapshot undo/redo 2026-07-13 18:37:58 +08:00
timeTable2 dev
dc70a04b54 feat: port GCD dedup algorithm from ical_organizer.py 2026-07-13 18:36:29 +08:00
timeTable2 dev
e187337127 feat: add recurrence grid expansion 2026-07-13 18:32:46 +08:00
timeTable2 dev
7e708932b1 feat: implement serializeICS with round-trip support 2026-07-13 18:30:52 +08:00
timeTable2 dev
138b89e3bf feat: implement parseICS with ical.js 2026-07-13 18:26:14 +08:00
timeTable2 dev
76e08d67d8 feat: add weekday constants and helpers 2026-07-13 18:22:57 +08:00
timeTable2 dev
f64c0a2a10 feat: scaffold Vite + Vue3 project with npmmirror 2026-07-13 18:21:17 +08:00
timeTable2 dev
1affa0b021 docs: add implementation plan 2026-07-13 18:18:23 +08:00
timeTable2 dev
64dd8c5cd1 docs: add timeTable2 design spec 2026-07-13 17:31:43 +08:00