From 0a0491ca1ba34445012b3d85ad4ef2c3657c9522 Mon Sep 17 00:00:00 2001 From: grtsinry43 Date: Mon, 6 Oct 2025 13:13:47 +0800 Subject: [PATCH] refactor: Overhaul UserDetailScreen and enhance user post feed This commit introduces a significant redesign of the `UserDetailScreen`, transforming it from a simple card-based layout to a more modern and refined profile view. It also replaces the basic list of user posts with a full-featured `PostCardItem` feed. **Key Changes:** * **feat(UserDetailScreen):** * Redesigned the user profile section with a cleaner, borderless layout, moving from a `Card` to a `Column`-based design. * Enhanced user info display to include email and location as decorative "pills." * Replaced the previous list of post metadata with a full `PostCardItem`-based feed, showing complete post content directly on the user's profile. * Added loading skeletons for the profile and post list, as well as an improved empty state for users with no posts. * Added a "bottom indicator" to signify the end of the post list. * **refactor(ViewModel):** * Modified `UserDetailViewModel` to fetch and construct full `PostCard` objects for the user's posts, instead of just `PostMetadata`. * This involves fetching `PostBody` and `Category` details for each post to provide a rich feed experience. * **refactor(Shared Element Transition):** * Introduced `sharedElementPrefix` to `PostCardItem` and `UserDetailScreen` to create unique transition keys for elements (like avatars and names) that appear in multiple screens (e.g., `talk_post_...`, `userdetail_post_...`). * This ensures that shared element animations are correctly scoped and avoids conflicts when navigating between different feeds and detail screens. * The shared element transition for user avatar and name now works correctly from any `PostCard` to the `UserDetailScreen`. * **feat(Repository):** * Added `getPostBody(postId)` and `getCategory(categoryId)` methods to `UserRepository` to support fetching the detailed data required for constructing `PostCard` objects. --- .idea/deploymentTargetSelector.xml | 2 +- .../main/java/com/qingshuige/tangyuan/App.kt | 8 +- .../tangyuan/repository/UserRepository.kt | 22 + .../ui/components/CommentComponents.kt | 66 +- .../tangyuan/ui/components/PostCardItem.kt | 28 +- .../tangyuan/ui/screens/ImageDetailScreen.kt | 44 +- .../tangyuan/ui/screens/PostDetailScreen.kt | 41 +- .../tangyuan/ui/screens/TalkScreen.kt | 3 +- .../tangyuan/ui/screens/UserDetailScreen.kt | 862 ++++++++++-------- .../tangyuan/viewmodel/UserDetailViewModel.kt | 127 ++- 10 files changed, 763 insertions(+), 440 deletions(-) diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index 64eb97d..a9a15e9 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -4,7 +4,7 @@