Commit Graph

52 Commits

Author SHA1 Message Date
bb4ca8ae40 feat: add localStorage persistence for battle result map
- Initialize `resultMap` from `localStorage` on component mount if data exists.
- Save updated `resultMap` back to `localStorage` when the component unmounts.
- Removed debug console.log statement for cleaner logs.
2026-03-10 17:21:44 +09:00
65195289bd refactor: extract BattleTable to dedicated component and add score calculation utils
- Move `BattleTable` logic from `GroupMember` to its own `BattleTable.tsx` component.
- Clean up `GroupMember` by removing unused imports (`Divider`, `Flex`, `Space`, `Table`, `getRoundTable`).
- Add new utility functions in `src/utils/common.ts`:
  - `higherWin` and `lowerWin` to calculate scores based on point difference thresholds.
  - `calculate` to determine the final score return value based on win/loss status.
2026-03-10 17:11:49 +09:00
cc23ca5594 feat(logto): handle redirect navigation after successful login
- Refactor `useHandleSignInCallback` to return only hook data without an internal callback.
- Move redirect logic into a separate `useEffect` to decouple navigation from the callback lifecycle.
- Ensure the user is redirected to the saved path or `/user-center` immediately upon authentication.
2026-03-10 13:46:49 +09:00
2315503388 feat(UserCenter): remove icon from logout modal cancel button
Remove the HomeOutlined icon from the cancel button of the logout
confirmation modal. The button now only displays the text "保持登录".
2026-03-10 12:51:47 +09:00
73354d0394 refactor(auth): migrate user center logout and refactor callback logic
- Migrate from static `Modal.confirm` to `App.useModal` in UserCenter for better context support.
- Refactor Logto Callback page:
  - Remove unused `useEffect` dependency on `isAuthenticated`.
  - Inline redirect logic directly into the `onSuccess` callback of `useHandleSignInCallback`.
  - Preserve existing redirect flow logic while simplifying the component structure.
2026-03-10 12:50:00 +09:00
2032cec715 fix(xcxApi): change redis cache key 2026-03-10 11:23:58 +09:00
54d275796e feat: add player profile cache & manual sync button
- Cache user profile data in Redis with 10-minute expiration in XcxAPI service to reduce API overhead.
- Added a refresh/sync button on FavPlayersPage to manually trigger fetching players from the account.
- Refactored authentication logic to properly set and use ID token claims for syncing.
- Improved UX by removing automatic view switching logic that caused layout shifts, relying on state-driven rendering instead.
- Unified login redirect flow using the new `useAutoLogin` hook.
2026-03-10 11:19:30 +09:00
06665f3371 feat(FavPlayersPage): cache 2026-03-09 17:52:40 +09:00
d0aee38df8 fix: display correct local player count in FavPlayersPage dropdown
Update the label for the LOCAL filter option to reference `localList.length` instead of `list.length`, ensuring the item count displayed in the dropdown matches the actual filtered list size.

File: src/page/FavPlayersPage.tsx
- { label: `${ShowType.LOCAL}(${list.length})`, ... }
+ { label: `${ShowType.LOCAL}(${localList.length})`, ... }
2026-03-09 17:49:11 +09:00
d171e496ff refactor(page): 合并本地与远程球员收藏列表逻辑并简化组件
- 将本地列表 (localList) 和请求数据 (favListRequest.data) 的映射逻辑统一至主 list useMemo 中。
- 移除冗余的 showList useMemo,直接基于 showType 动态生成 list。
- 修正 sortType 默认分支显式返回 localList,确保排序逻辑一致性。
- 更新依赖数组并清理未使用的 isAuthenticated 相关逻辑。
- 调整空状态判断条件以匹配新的 list 结构。
2026-03-09 17:16:21 +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
76bb126c4e fix(common): toReversed -> array.reverse() 2026-03-07 12:05:50 +09:00
bcfedd0009 feat(GameSelector): request only once 2026-03-07 11:37:11 +09:00
23888b31bc feat: integrate Logto for authentication
- Add @logto/react dependencies to package.json and lockfile.
- Replace custom App layout with LogtoProvider for authentication handling.
- Configure Logto settings (endpoint, appId) in frontend.tsx.
- Refactor FindUserPage search logic to trigger request on value change instead of manual search key refresh.
2026-03-07 02:24:01 +09:00
4d73ce5f2b Fix and enhance cache handling and logging in server utils
- Corrected the default value assignment for REDIS_CACHE_HOUR using logical OR instead of nullish coalescing.
- Added a debug log to output the cache hour value.
- Added error handling for redis.get calls to ensure they return a string or an empty string in case of failure.
2026-03-03 18:36:32 +09:00
0ac1d2e31d feat: add REDIS_CACHE_HOUR to environment variables and update timeout usage
- Added REDIS_CACHE_HOUR to .env.example and src/utils/server.ts.
- Updated TIMEOUT usage in src/services/uidScoreStore.ts and src/utils/server.ts to use REDIS_CACHE_HOUR.
2026-03-03 18:23:12 +09:00
58edba247d feat: Update cache expiration times for event list and match info
- Increased the cache expiration time for event lists from 30 minutes to 72 hours.
- Increased the cache expiration time for match info from 3 minutes to 72 hours.
2026-03-03 18:17:31 +09:00
ac3beb5d8f feat: Add isPassedGame logic and update GroupingPrediction component
- Added `dayjs` import for date manipulation in `GamePanel.tsx`.
- Introduced `isPassedGame` memoized value in `GamePanel.tsx` to determine if the game date has passed.
- Updated `GroupingPrediction` component to accept `isPassedGame` prop and adjust `nowScoreGroup` state accordingly.
2026-03-03 18:11:17 +09:00
da35e0f623 feat(uidScoreStore): increase redis timeout for uid-score keys from 3h to 24h 2026-03-03 17:50:42 +09:00
7b66b30309 fix(env): move validation to server.ts and add debug logging for missing
variables
2026-03-03 17:46:30 +09:00
e97444244a feat: Add REDIS environment variable and update environment checks
- Added REDIS environment variable to .env.example
- Updated src/index.tsx to check for multiple required environment variables
- Updated src/utils/server.ts to use REDIS environment variable for RedisClient
2026-03-03 14:16:29 +09:00
7f8196249b fix(grouping): guard nowScore with numeric check before fallback
Use nowScore only when it can be parsed as a number, otherwise keep original score.
Prevents invalid nowScore values from affecting grouping/sorting.
2026-03-03 01:04:29 +09:00
9e892f6ed1 refactor(api): switch nowScores endpoint from GET query to POST JSON body
- send uids as JSON payload in frontend event loader
- update /api/user/nowScores route to accept POST and parse req.json()
- keep score lookup behavior unchanged
2026-03-03 00:58:58 +09:00
1fae8206f2 refactor(redis): centralize Redis client and add HTML cache for event endpoints
- export shared redis client from utils/server
- reuse shared redis in uidScoreStore
- cache listEvent HTML for 30 minutes
- cache getMatchInfo HTML for 3 minutes
2026-02-26 20:42:18 +09:00
b7d2109f2e refactor(utils): split shared helpers and server scraping modules
- move event scraping/parsing and match lookup logic into src/utils/server.ts
- extract BASE_URL and grouping/round-table helpers into src/utils/common.ts
- update component/service entry imports to new module locations
- remove deprecated src/utils/utils.ts monolith
- clean up unused XCXFindUser type import
- update tests to new utils import path
2026-02-26 00:26:25 +09:00
79c839db00 feat: add current-score grouping flow with cached uid score API
- move shared parsing/grouping helpers into serverUtils and update imports
- add xcxApi singleton in serverUtils
- add Redis-backed uid score store and /api/user/nowScores endpoint
- preload uid scores in event loader and tags in profile loader
- allow grouping prediction to switch sort mode between current/yearly score
- update tags component to consume loader-provided tags
- remove unused zustand game store
- add redis test scaffold and scoreboard component scaffold
2026-02-26 00:13:37 +09:00
c26bb93ffa refactor(profile): replace Descriptions with Flex layout and show rank
- remove unused antd imports (Space, Descriptions)
- refactor equipment section to Flex-based rows
- refactor profile meta fields to structured Flex rows
- add rank display next to name and score
2026-02-18 00:45:12 +09:00
a4fc0d0031 refactor: move round table helper to utils and clean GroupMember
- extract getRoundTable into src/utils.ts as a reusable generic helper
- update GroupMember to import getRoundTable from utils
- remove round pairing debug log from GroupMember
2026-02-16 15:03:14 +09:00
a9b7113173 fix(GroupMember): check no name 2026-02-14 01:07:28 +09:00
aa5061f7ed feat(GroupMember): battle table 2026-02-14 00:58:19 +09:00
60a8bf68d1 fix(User): replace Link with useHref for external profile navigation
- Updated avatar image styling on FavePlayersPage
- Changed default sort type to '注册时间'
- Improved title rendering and structure on EventPage
- Added favUser logic and effect in ProfilePage
2026-02-12 01:12:50 +09:00
59cf101c26 fix(FavPlayersPage): img height 2026-02-11 16:08:26 +09:00
f5f68496c1 fix(FavePlayersPage): add objectFit: 'cover' to avatar image
Added `objectFit: 'cover'` to ensure avatars are displayed consistently.
2026-02-11 16:05:32 +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
789bbb6e03 feat: set pagination page size to 100 in PlayerList table
- Add pageSize configuration to table pagination
- Displays 100 items per page for better data visibility
2026-02-10 22:23:17 +09:00
b6b4dfa3b2 chore(docker): add restart policy for app service 2026-02-10 21:21:11 +09:00
b300d874d2 refact(app): FindUserPage 2026-02-10 18:14:55 +09:00
5d668b2078 feat(Profile): uid param 2026-02-10 16:00:54 +09:00
6fcd54ed34 fix(Profile): disable uid: 0 2026-02-10 15:15:08 +09:00
dada5c28a7 fix(FindUser): fix age 2026-02-10 14:34:18 +09:00
bbc6a592f4 feat(global): find user 2026-02-10 11:11:08 +09:00
4dd3daf909 feat(utils): html request header 2026-02-06 21:35:55 +09:00
73892a5f40 feat(GameTable): css
styled table
2026-02-04 00:16:53 +09:00
44e283852e fix(global): Empty default description 2026-01-30 12:19:35 +09:00
bc8a783edc fix(Profile): fix hasMore check 2026-01-30 12:03:09 +09:00
8831ac456b feat(Profile): GameTable 2026-01-30 11:55:44 +09:00
4c12b609a0 fix(loader): default members 2026-01-30 10:11:08 +09:00
f37be8aded feat(global): HydrateFallback 2026-01-30 09:34:10 +09:00
bf74e99a47 fix(global) .gitkeep 2026-01-29 22:14:39 +09:00