Commit Graph

7 Commits

Author SHA1 Message Date
2774037012 feat(app): add push notification support and event management logic
- Introduce PermissionControlPanel in UserCenter for managing notification permissions.
- Update Service Worker (sw.ts) to handle background push notifications via Firebase Cloud Messaging.
- Implement EventSubscribeService logic to fetch active events, filter expired ones, and clean up subscriptions.
- Refactor KaiqiuService and parsing utilities to include eventId in event details.
- Remove deprecated ScheduleService and inline sendNotification logic.
- Update utility functions to support new types and notification checks.
- Add VAPI public key configuration and update Firebase exports.
2026-03-24 17:21:50 +09:00
09f3ecaca6 feat(WebSocket & Event System): Add real-time updates and event subscription
Introduces WebSocket connectivity for live data updates and a new subscription model for events.

Key changes:
- Integrated WebSocketService to handle open, message, and close events via the /ws endpoint.
- Added EventSubscribeService APIs to manage user subscriptions to specific events (matchId) via REST endpoints (`/api/subscribe-event` and `/api/subscribe-event/:matchId`).
- Implemented custom message protocol (JSON format) for WebSocket communication with defined topics (ONLINE_MEMBER_CHANGE, etc.).
- Updated database schema to include the `EventSubs` model for storing subscriptions.
- Refactored Dockerfile to use `bun prisma db push` for database migrations on startup.
- UI Updates:
  - Replaced the Rate component in FavButton with Star icons for better UX.
  - Adjusted layout of FavButton to be absolute positioned.
  - Added debounce to ClubSummary data fetching.
  - Removed unused `isMobile` import from ClubSummary.
- Utilities: Added helper functions `toCustomMessage` and `fromCustomMessage` for parsing WebSocket messages.
2026-03-17 17:26:52 +09:00
9c9b3735cb feat: migrate user fav system from session aud to Logto sub
- Update database schema to rename `UserFav` to `LogtoUserFav` with clearer field names (`logto_uid`, `kaiqiu_uid`).
- Bump `jose` dependency to v6.2.1 for improved JWT verification.
- Configure `@logto/react` to request the correct resource token for API access.
- Implement token verification on the server side using `jose` and `jwtVerify`.
- Update API routes (`/api/fav`) to extract the user ID from the verified JWT `sub` claim instead of the URL `aud` parameter.
- Refactor frontend components (`FavButton`, `FavePlayersPage`) to use `useAuthHeaders` for fetching auth headers instead of manual token claims extraction.
- Clean up unused migration and DAO functions related to the old `aud`-based logic.
2026-03-16 12:45:12 +09:00
9044073afd feat: sync favorite player state with server and improve clear confirmation
- Add `isFav` selector to `useFavPlayerStore` to determine initial button state immediately.
- Initialize `FavButton` value based on the store's `isFav` result instead of a stale local state.
- In `FavePlayersPage`, integrate Ant Design message hooks for user feedback during server sync.
  - Show "syncing" loading indicator when starting the sync process.
  - Show "synced" success notification upon completion.
- Enhance the "Clear Local Favorites" confirmation dialog:
  - Update warning text to indicate the action is irreversible.
  - Add custom button labels ("清空", "取消").
  - Make the confirm button dangerous and add a delete icon for better UX.
2026-03-11 11:51:30 +09:00
9499de0180 feat(likes): sync local favorites and add auto-login flow
- Add Prisma code generation in Dockerfile build step.
- Implement instant state updates for favoriting players via store hooks.
- Enhance 'FavPlayersPage' with:
  - New "Sync to cloud" and "Clear local favorites" actions.
  - Updated tabs showing counts for local vs. account favorites.
  - Auto-detection of view mode based on authentication status.
- Add auto-login support in 'UserCenter' triggered by query parameter `autoSignIn=true`.
2026-03-09 16:51:57 +09:00
80aebac57a feat: implement user favorite player system with Logto sync
- Add `FavPlayerDAO` for database operations (create, read, delete, check) against `user_fav` table.
- Integrate Prisma ORM with MariaDB adapter in `src/prisma/db.ts`.
- Implement backend API routes (`/api/fav`) to handle GET, PUT, and DELETE requests for managing favorites based on user audience (aud).
- Create `FavePlayersPage` with support for:
  - Viewing local stored favorites.
  - Syncing server-side favorites via Logto authentication.
  - Visual distinction between "Local" and "Account" favorite lists using Segmented control.
  - Loading states and empty state handling with Ant Design components.
- Enhance `Logto/Callback` to redirect users back to their intended destination (e.g., `FavePlayersPage`) after authentication if a `redirect` param was stored in session storage.
- Update `UserCenter` page to include "Backup Codes" management option under account settings.
- Add necessary dependencies: `@logto/react`, `ahooks`, and update UI imports accordingly.
2026-03-09 10:16:27 +09:00
3b87230173 feat: add favorite player functionality and improve navigation
- components: add FavButton for player favoriting
- store: create useFavPlayerStore for managing favorites
- pages: add FavePlayersPage for displaying favorites
- components: add MenuButtons for navigation controls
- ui: update App and ProfilePage for new features
- meta: update index.html title to "我的开球网"
2026-02-11 16:00:01 +09:00