Commit Graph

15 Commits

Author SHA1 Message Date
69c5e20d8e display date in user's selected calendar on main menu and reports
buildStatusText and buildDailyReport now use formatDateForCalendar
to convert the stored Gregorian date to the user's calendar type
(jalali/hijri/gregorian).
2026-06-24 10:06:39 +03:30
07306cb0f0 remove reply keyboard; keep Clock In/Out as inline buttons only
- Removed smartKeyboard, defaultKeyboard, updateReplyKeyboard
- Removed statusMsg/keyboardMsg tracking from Handler
- sendText now sends plain messages (no reply keyboard)
- handleActionMsg sends result with mainKeyboard() inline keyboard
- handleActionCallback edits message with backKeyboard (unchanged)
- handleStart sends welcome + menu with mainKeyboard
- SendDailyReport sends plain text report
- Removed text-trigger 'Clock In'/'Clock Out' message handlers
  (only /clockin and /clockout commands remain)
2026-06-24 10:00:27 +03:30
9c83ed98c6 fix: keep keyboard update message alive instead of send-delete pattern
Previous approach (send \u200C then immediately delete it) lost the
reply keyboard because Telegram may not persist the keyboard from a
deleted message. Now we delete the OLD keyboard message and keep the
new one, ensuring the reply keyboard is always present and correct.
2026-06-24 09:52:28 +03:30
b6c7cf81c8 fix: prefix calendar type callbacks with caltype_ to avoid conflict with cal_day/cal_prev/cal_next
Routes caltype_gregorian/jalali/hijri to selectCalendar and
cal_day/cal_prev/cal_next to handleHistoryCallback as intended.
2026-06-24 09:50:28 +03:30
9d123316e6 feat: Hijri calendar, virtual midnight crossover, overlap rejection, WAL mode
- Hijri (قمری) calendar added as 3rd calendar option with tabular conversion
- Calendar type select menu (like accent) with gregorian/jalali/hijri
- Calendar type applied to exports and reports
- Midnight crossover: virtual splits at computation time (no synthetic DB events)
  - Handles both UTC and local timezone boundaries
  - Timezone changes handled naturally (recomputed on-the-fly)
- Rate limiting per user ID instead of chat ID
- WAL mode enabled for SQLite
- Smart reply keyboard updates after every state change
- Overlapping time edits rejected (must preserve in/out alternation)
- Single event deletion warns if timeline needs repair
- Day off no longer prevents clock in/out
- Accent colors shown with descriptive names in select menu
- Delete button label changed to DEL for visual distinction
2026-06-24 09:39:15 +03:30
6f6cc6f184 feat: midnight crossover, rate limit, smart keyboard, status menu, settings
- Midnight crossover: auto-close previous day session on clock-in
- Rate limiting: 2s cooldown per chat_id in both messages and callbacks
- Smart reply keyboard: single button changes to Clock In/Out based on state
- Status info on main menu shows: date, work type, working status, today's total
- Settings sub-menu with inline buttons for accent, report toggle, report time
- Accent selection inline keyboard with > indicator and back button
- Notes displayed in daily report (e.g. 'auto midnight')
- Back buttons on all sub-menus (work type, accent, settings)
- Settings button added to main menu
2026-06-24 07:56:04 +03:30
2970b7d3fc feat: redesigned DB schema with users, work_types, days, events 2026-06-24 00:36:16 +03:30
8616ed0867 feat: multi-user isolation and graceful shutdown
- Add chat_id to events, settings, and days_off for per-user data
- Add proper graceful shutdown (signal handling, WaitGroup)
- Separate polling and webhook modes with goroutine management
- Add schema migration from single-user to multi-user schema
- Refactor handlers with shared actionFunc pattern (msg + callback)
- Fix schema path for Docker deployment (/app/db/schema.sql)
- Remove emoji from output text for cleaner formatting
2026-06-24 00:14:41 +03:30
b4fab29d45 Clean up: remove unused packages, switch to slog, tidy Makefile 2026-06-23 22:34:01 +03:30
32446a99d1 Fix break tracking (out→in gap), add startup log, clean up /start message 2026-06-23 22:00:25 +03:30
7da6f4cb49 Add BOT_ALLOWED_USERS, fix SetColWidth params, drop fmt import, save chat_id on start 2026-06-23 21:56:18 +03:30
a92c72f46a feat: add persistent reply keyboard with Clock In / Clock Out buttons
Also handle button text (English + Persian) in message router.
2026-06-23 21:44:41 +03:30
4a5778afe5 feat: add inline keyboard, /start command, and callback handlers
- Show main menu with Clock In/Out, Report, Export, Remote, Day Off buttons
- Each action result includes a 'Back to Menu' button
- Handle callback queries alongside text commands
- Delete stale webhook before switching to polling
- Log i18n initialization error instead of silently ignoring it
2026-06-23 21:42:52 +03:30
0a9175add4 handlers: replace fmt.Errorf with errors.New to satisfy vet
All checks were successful
CI / build (push) Successful in 55s
2026-06-23 20:50:03 +03:30
7176f9b81d Bot handlers: clock‑in/out, remote flag, day‑off toggle, daily report, monthly Excel export 2026-06-23 20:22:54 +03:30