Commit Graph

84 Commits

Author SHA1 Message Date
imeepos b46ad76161 fix: bug 2026-01-28 14:15:33 +08:00
imeepos 30fa29b0ac fix: bug 2026-01-28 14:08:56 +08:00
imeepos 1080fb131c fix: bug 2026-01-28 13:55:22 +08:00
imeepos c5641c1d3c fix: 修复表单相册上传失败bug,优化FormData构造方式
- 移除uploadFile.ts中不必要的Platform判断逻辑
- 保持原始URI不做修改,让React Native底层处理平台差异
- 添加uploadFile单元测试,覆盖主要上传场景
- 简化代码结构,提高可维护性

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 13:46:35 +08:00
imeepos cd1a4f6841 feat: update RefreshControl mocks in tests and improve error handling in useChangePassword hook 2026-01-27 17:18:54 +08:00
imeepos 8f00d4644a feat: implement pull-to-refresh and load more functionality in "My" page, add WebP image support 2026-01-27 17:08:11 +08:00
imeepos c78ad352ba feat: update TAB_BAR_HEIGHT to improve tab layout and add channel definitions in eas.json 2026-01-27 15:00:06 +08:00
imeepos f323d2bea7 feat: remove API integration development plan and report files
- Deleted the `api_integration_development_plan.md` and `api_integration_report.md` files as they are no longer needed.
- Removed `findings.md`, `message-adaptation-plan.md`, `progress.md`, `prompt.md`, and `task_plan.md` files to streamline project documentation.
- Ensured all related code and references are updated accordingly.
2026-01-27 14:19:38 +08:00
imeepos a0beb146d7 feat: update runtimeVersion to use APP_VERSION for better version management 2026-01-27 12:04:27 +08:00
imeepos 3bc113bf9c feat: implement app update checks and add app configuration file 2026-01-27 11:52:59 +08:00
imeepos 533b58ccf4 feat: update TabLayout to improve tab bar styling and handle safe area insets 2026-01-26 18:55:07 +08:00
imeepos 65b61ce05e feat: enhance TabLayout and HomeScreen with safe area insets and optimized refresh handling 2026-01-26 18:36:18 +08:00
imeepos 818f6e8591 feat: optimize home screen data loading with pagination and refresh functionality 2026-01-26 17:33:21 +08:00
imeepos 23fae07a58 feat: add useCategoriesWithTags hook and associated store for category management
- Implemented useCategoriesWithTags hook to fetch categories with tags.
- Created zustand store for managing categories and tags state.
- Added error handling and loading states for improved user experience.

test: add comprehensive tests for useCategoryTemplates hook

- Developed unit tests for useCategoryTemplates to ensure correct functionality.
- Included tests for loading states, error handling, pagination, and category ID changes.
- Verified that templates are fetched and merged correctly based on category ID.

feat: create useCategoryTemplates hook for managing category templates

- Introduced useCategoryTemplates hook to fetch templates based on category ID.
- Implemented pagination and loading states for template fetching.
- Added refetch and loadMore functionalities to enhance data retrieval.
2026-01-26 17:05:44 +08:00
imeepos a529dc03e1 fix: update @repo/sdk to version 1.0.14 and adjust build scripts for production
feat: modify TemplateCard and TemplateGrid to handle optional id and filter templates
refactor: clean up use-template-filter to use CategoryTemplate type
2026-01-26 16:40:32 +08:00
imeepos 01865d94c2 feat: add image picker utility and integrate image upload in DynamicForm component 2026-01-26 13:04:14 +08:00
imeepos 3fd445bb6e feat: implement user balance management with hooks and store 2026-01-26 12:57:21 +08:00
imeepos 2757b68756 feat: add TemplateGrid and TitleBar components with tests
- Implemented TemplateGrid component for displaying templates in a grid layout.
- Added calculateCardWidth helper function for dynamic card sizing.
- Created TitleBar component for displaying the title and points with interaction.
- Added unit tests for TemplateGrid and TitleBar components to ensure proper functionality.
- Introduced useStickyTabs and useTabNavigation hooks with tests for managing sticky tab behavior and navigation logic.
- Implemented useTemplateFilter hook for filtering templates based on video content.
- Added comprehensive tests for all new hooks and components to validate behavior and edge cases.
2026-01-26 12:43:20 +08:00
imeepos bf11241d68 feat: 实现用户名和头像编辑功能
使用 Better Auth 的 updateUser API 更新用户信息,使用 SDK 的 FileController 上传头像。

## 新增功能
- 创建 useUpdateProfile hook 处理用户信息更新
- 支持选择图片上传头像(使用 expo-image-picker)
- 先上传头像到 S3,再更新用户信息

## 更新文件
- lib/auth.ts: 导出 updateUser 方法
- hooks/use-update-profile.ts: 新建更新资料 hook
- hooks/index.ts: 导出 useUpdateProfile
- components/drawer/EditProfileDrawer.tsx:
  - 添加头像选择功能(点击相机按钮)
  - 调用 updateProfile API 保存更改
  - 添加加载状态和禁用状态
  - 更新 onSave 回调参数类型
- app/(tabs)/my.tsx:
  - 传递 initialAvatar 给编辑抽屉
  - 显示用户真实头像(如有)
  - 更新 onSave 回调处理

## 功能流程
1. 点击相机按钮选择图片
2. 调用 uploadFile 上传到 S3
3. 调用 updateUser 更新用户信息
4. 保存成功后刷新 session

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 19:42:13 +08:00
imeepos e4b249f502 fix: 个人中心显示当前登录用户的真实用户名和ID
- 使用 useSession hook 获取当前登录用户信息
- 用户名从 session.user.name 或 session.user.username 获取
- 用户ID显示真实用户ID的前8位
- 添加 useEffect 监听 session 变化自动更新

修复前:显示硬编码的 "乔乔乔乔" 和 "ID 12345678"
修复后:显示当前登录用户的真实信息

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 19:28:41 +08:00
imeepos 7d160d55ea fix: 移除对 @tanstack/react-query 的依赖,使用项目现有 hooks 模式
项目未安装 @tanstack/react-query,将 useWorksSearch hook 改为使用项目现有的模式:
- 使用 useState 管理状态
- 使用 useCallback 封装逻辑
- 使用 useEffect 自动执行搜索
- 使用 handleError 统一错误处理

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 19:26:24 +08:00
imeepos e1340fa101 feat: 实现 API 接口对接功能 (删除作品、作品搜索、修改密码)
按照 TDD 规范完成三个核心功能的接口对接:

## 新增功能

### 1. 删除作品功能 (app/generationRecord.tsx)
- 新增 use-template-generation-actions.ts hook
- 支持单个删除和批量删除作品
- 删除确认对话框
- 删除成功后自动刷新列表
- 完整的错误处理和加载状态

### 2. 作品搜索功能 (app/searchWorksResults.tsx)
- 新增 use-works-search.ts hook
- 替换模拟数据为真实 SDK 接口
- 支持关键词搜索和分类筛选
- 支持分页加载
- 完整的加载、错误、空结果状态处理

### 3. 修改密码功能 (app/changePassword.tsx)
- 新增 use-change-password.ts hook
- 使用 Better Auth 的 changePassword API
- 客户端表单验证(密码长度、确认密码匹配等)
- 成功后自动返回并提示

## 技术实现
- 严格遵循 TDD 规范(先写测试,后写实现)
- 新增 3 个 hooks 和对应的单元测试
- 更新中英文翻译文件
- 更新 jest.setup.js 添加必要的 mock

## 文档
- 新增 api_integration_report.md - API 对接分析报告
- 新增 api_integration_development_plan.md - 开发计划和完成汇总

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 19:15:24 +08:00
imeepos 4c01d8e9e7 fix: bug 2026-01-21 16:25:26 +08:00
imeepos 54867492a7 test: add unit tests for HomeScreen to ensure proper rendering
Following TDD principles (RED-GREEN-REFACTOR):
- RED: Created failing tests for HomeScreen rendering
- Verify RED: Confirmed tests failed due to missing mocks
- GREEN: Added necessary mocks for all dependencies
- Verify GREEN: All 4 tests passing (4/4)

Tests cover:
- Title bar rendering with app name
- Category tabs rendering when data is loaded
- Template cards rendering when category has templates
- Loading state not showing when data is loaded

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:28:18 +08:00
imeepos 57b92ac52f fix: replace FlashList with FlatList to fix black screen in ScrollView
FlashList cannot be nested inside ScrollView. Changed to FlatList with scrollEnabled=false to allow proper rendering within the parent ScrollView.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:24:52 +08:00
imeepos a8b5ee5256 fix: add estimatedItemSize to FlashList to fix black screen issue
FlashList requires estimatedItemSize prop to properly render content. Without it, the list may appear blank even when data is present.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:22:48 +08:00
imeepos 0b344b6b5f debug: add detailed logging for template filtering
Add console logs to track template filtering process on home and video pages to diagnose black screen issue. Logs include all preview URL fields and filtering decisions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:20:58 +08:00
imeepos a344410374 fix: change type parameter from array to single value for API compatibility
SDK API only accepts single MessageType value, not array. Updated to use client-side filtering for Tab-based message type filtering (all/notice/other) instead of server-side filtering.

Changes:
- hooks/use-messages.ts: Changed type parameter from array to single value
- app/(tabs)/message.tsx: Replaced getMessageTypeByTab with filterMessagesByTab for client-side filtering
- Removed useEffect dependency on activeTab to prevent unnecessary refetches

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:15:47 +08:00
imeepos 4868ff8660 feat: integrate real message data with SDK in message page
Replace mock data with useMessages hook and useMessageActions for real-time message management. Add support for tab-based filtering (all/notice/other), pull-to-refresh, infinite scroll pagination, and mark-as-read functionality. Integrate LoadingState, ErrorState, and PaginationLoader components for better UX.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:58:32 +08:00
imeepos 6c17d720ca feat: add announcement action hooks with TDD
Add useAnnouncementActions hook for marking announcements as read and useAnnouncementUnreadCount hook for fetching unread announcement count. Both hooks follow TDD principles with complete test coverage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:53:03 +08:00
imeepos 83c3183be8 feat: add message action hooks with TDD
Implement useMessageActions and useMessageUnreadCount hooks following strict TDD principles (RED → GREEN → REFACTOR).

useMessageActions provides:
- markRead(id) - mark single message as read
- batchMarkRead(ids) - batch mark messages as read
- deleteMessage(id) - delete message
- Independent loading/error states for each operation

useMessageUnreadCount provides:
- Fetch total unread count and counts by message type
- refetch() method for manual refresh
- loading and error state management

All operations use MessageController from SDK with proper error handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:48:27 +08:00
imeepos 21dcdc0be3 feat: add use-announcements hook with TDD
Implement useAnnouncements hook following TDD principles and use-templates golden standard pattern. Includes complete test coverage for pagination, loading states, error handling, and refetch functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:44:16 +08:00
imeepos 05fb680fe2 refactor: migrate use-messages hook to MessageController with TDD
Replace ChatController.chat() with MessageController.list() and import types from @repo/sdk. Updated tests to match new implementation. All tests passing (8/8).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:41:47 +08:00
imeepos 3171b7c3bf docs: add hooks review and finalize task plan
- Added comprehensive hooks/REVIEW.md analyzing all 15 hooks
- Marked all completed phases in task_plan.md
- Documented SDK limitations and TODO items

All major development work completed:
- 4 UI components created with TDD
- 3 hooks enhanced with tests
- 7 pages integrated with new components
- All with proper pagination, refresh, and error handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:22:02 +08:00
imeepos 1d1d382822 docs: update progress and task plan - mark phases as completed
Summary of completed work:
- Phase 2: Enhanced 3 existing hooks with tests and retry functionality
- Phase 6: Created 4 reusable UI components (all with TDD)
- Phase 4-5: Integrated UI components into 7 pages with pagination/refresh
- Added TODO comments for features requiring backend API support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:21:30 +08:00
imeepos 1f34b4c273 feat: integrate UI components into Search pages with pagination and loading
- Add useDebounce hook for future search optimization
- Integrate LoadingState, ErrorState, RefreshControl, and PaginationLoader into searchResults.tsx
- Add pull-to-refresh functionality with RefreshControl component
- Implement pagination with loadMore and PaginationLoader
- Add error handling with retry functionality using ErrorState
- Update SearchResultsGrid to support refreshControl, onEndReached, and ListFooterComponent props
- Add scroll event handling for pagination trigger
- Add TODO comment in searchWorksResults.tsx for backend API integration
- Reduce initial search limit from 50 to 20 for better performance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:20:11 +08:00
imeepos 10ee380051 feat: integrate UI components into Works List with pagination and refresh
- Add useWorksList hook for data fetching with pagination support
- Integrate RefreshControl for pull-to-refresh functionality
- Add LoadingState for initial loading display
- Add ErrorState with retry functionality
- Add PaginationLoader for load more indication
- Update WorksGallery to support refresh control and pagination
- Add comprehensive tests for worksList screen and hook
- Use useMemo for performance optimization

TODO: Replace mock API with actual backend endpoint when available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:15:53 +08:00
imeepos beba2f2428 feat: integrate UI components into Generation Record page with pagination
Transform Generation Record from static detail view to dynamic list with:
- useTemplateGenerations hook for data fetching
- RefreshControl for pull-to-refresh functionality
- LoadingState and ErrorState for proper state handling
- PaginationLoader for infinite scroll
- FlatList with onEndReached for pagination
- Comprehensive test coverage following TDD principles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:11:31 +08:00
imeepos e0a56710d0 feat: integrate UI components into Video tab
Replace inline LoadingState, ErrorState, and FooterLoading components with reusable UI components (LoadingState, ErrorState, RefreshControl, PaginationLoader). Add retry functionality to ErrorState and maintain consistent styling with #FFE500 color theme.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:06:46 +08:00
imeepos 141ccabe06 feat: integrate UI components into Home tab
Replace custom loading/error states with reusable components (RefreshControl, LoadingState, ErrorState). Add pull-to-refresh functionality and remove duplicate styles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:03:44 +08:00
imeepos 9703bb8fce feat: add retry functionality to use-template-actions hook
Add retry function to handle failed template operations by storing last params in ref and allowing retry without re-passing parameters. Includes comprehensive test coverage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:00:07 +08:00
imeepos 7ebd225976 test: add comprehensive tests for use-template-detail hook
Add complete test coverage for use-template-detail hook including:
- Initial state verification
- Execute function with success and error cases
- Loading state management
- Refetch functionality
- Error handling and clearing

All tests passing (10/10). Hook already has complete loading states and refetch functionality as documented in REVIEW.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:57:17 +08:00
imeepos c65d368656 test: verify use-templates hook has complete functionality
Verified that use-templates hook already implements all required features:
- loading and loadingMore states
- error handling with proper state management
- pagination with loadMore function
- hasMore flag for infinite scroll
- refetch function for pull-to-refresh
- 17 comprehensive tests covering all scenarios

All tests pass successfully. Hook follows gold standard pattern per hooks/REVIEW.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:54:34 +08:00
imeepos ec548ed95f docs: update task plan with SDK limitations
- Mark video list hook as not needed (already uses useTemplates)
- Document SDK limitations: no message list API, no user info API
- Add SDK Support column to findings.md
- Clarify which features need backend customization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:48:50 +08:00
imeepos 7fd5f3da44 chore: remove incorrect use-videos hook
Removed use-videos.ts that incorrectly used ProjectController.
Video tab already uses useTemplates hook with TemplateController which is correct.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:48:22 +08:00
imeepos 100f059bb7 feat: add use-videos hook for video list management
Implement video list hook following TDD principles and use-templates.ts pattern.
Supports pagination, loading states, error handling, and data refresh.

- Add useVideos hook with execute, loadMore, and refetch functions
- Add comprehensive test suite with 11 test cases
- Follow DI pattern using ProjectController from @repo/sdk
- Calculate pagination using total/limit for hasMore flag

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:39:34 +08:00
imeepos 3bc6789660 feat: add reusable PaginationLoader component with TDD
Add minimal PaginationLoader component for infinite scroll/pagination scenarios. Displays small ActivityIndicator with optional text, supports theme colors, and is designed for use in FlatList ListFooterComponent.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:33:49 +08:00
imeepos 9084075482 feat: add reusable ErrorState component with TDD
Add minimal ErrorState component for displaying error messages with optional retry functionality. Supports light/dark themes via TailwindCSS and follows project patterns. All 6 tests passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:31:25 +08:00
imeepos 47ebbc53db feat: add reusable LoadingState component with TDD
Add minimal LoadingState component for displaying loading states across the app. Includes ActivityIndicator, optional message text, theme support, and comprehensive test coverage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:28:50 +08:00
imeepos 111939dd0c feat: add reusable RefreshControl component
Add minimal RefreshControl wrapper component for pull-to-refresh functionality across screens. Includes theme colors for light/dark mode support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:24:59 +08:00