6 Commits

Author SHA1 Message Date
a528b623b9
feat: Implement Design System screen and enhance UI/UX
This commit introduces a new "Design System" screen for developers and designers, refines navigation animations for a smoother experience, and improves typography consistency across various UI components.

**Key Changes:**

*   **feat(Design System):**
    *   Added a new `DesignSystemScreen.kt` to visually showcase the app's color palette, typography styles, and shape system.
    *   The screen features animated guides and detailed specifications for each design token (e.g., font size, weight, color roles).
    *   A new "About Tangyuan Design System" menu item has been added to the `UserScreen` (for both logged-in and logged-out states), navigating to this new screen.

*   **refactor(Navigation):**
    *   Replaced default navigation transitions with custom animations using `CubicBezierEasing` for a more fluid and responsive feel (e.g., quick spring and fade effects).
    *   Detail screens (`PostDetail`, `UserDetail`, `ImageDetail`) now use a `fadeIn`/`fadeOut` transition to prevent conflicts with shared element animations.
    *   Side-panel screens (`About`, `DesignSystem`) now use a horizontal slide transition.
    *   Navigation between main tabs (`Talk`, `Message`, `User`) is now animated with a horizontal slide and fade.

*   **refactor(Typography & UI):**
    *   Standardized the font weight for titles and important text to `SemiBold` across `PostCardItem`, `PostDetailScreen`, and `CommentComponents` for better visual hierarchy.
    *   Updated the `PostDetailScreen` top bar title to "帖子详情" for clarity.
    *   Replaced the literary font with the general-purpose font in some UI elements like comment interaction labels for improved readability.
    *   Enabled image click navigation from the `UserDetailScreen`'s post feed.

*   **feat(Create Post):**
    *   Introduced `CreatePostDto.kt` and `CreatePostRepository.kt` to support post creation.
    *   The repository now handles fetching categories and creating posts through a two-step process: creating post metadata and then the post body.
    *   Added `CreatePostState` to manage the UI state for the post creation screen, including validation for content length and image limits.
2025-10-08 17:16:33 +08:00
46588259dd
feat: Implement user profile screen and enhance authentication
This commit introduces a dedicated user profile screen (`UserScreen`) and significantly enhances the authentication system by adding registration, auto-login, and robust form validation.

**Key Changes:**

*   **feat(UserScreen):**
    *   Added a new `UserScreen` to display the logged-in user's profile.
    *   Displays user details including avatar, nickname, ID, bio, location, and email in a styled card.
    *   Includes a menu section for actions like "Post Management," "Settings," and "About."
    *   Shows a "not logged in" state to prompt users to log in.

*   **feat(Auth):**
    *   **Registration:** Implemented a registration flow alongside the login flow on the `LoginScreen`. Users can now switch between Login and Register modes.
    *   **Auto-Login:** The app now automatically logs in the user on startup if a valid token or saved credentials exist, improving user experience.
    *   **Token Management:** Enhanced `TokenManager` to handle JWT parsing to extract `userId`, check token validity (expiration), and securely store credentials. Added `java-jwt` dependency for this.
    *   **Logout:** Improved the logout function to clear all stored tokens and user credentials from `SharedPreferences`.

*   **feat(Validation):**
    *   Introduced `ValidationUtils` to provide real-time validation for phone number, password, and nickname fields on the `LoginScreen`.
    *   Input fields now display specific error messages to guide the user (e.g., "Password must contain a letter," "Invalid phone number format").

*   **refactor(LoginScreen):**
    *   Redesigned the `LoginScreen` to support both login and registration (`AuthMode`) with animated transitions between modes and form fields.
    *   Form submission buttons are dynamically enabled based on validation results.
    *   After successful registration, the user is now automatically logged in.

*   **refactor(UserViewModel):**
    *   Integrated auto-login logic (`checkAutoLogin`) that runs on initialization.
    *   Refactored `login` and `register` flows to handle token storage and fetch user profile data immediately after authentication.
    *   Added `isLoggedIn()` to provide a reliable check of the current authentication state.

*   **refactor(TopBar):**
    *   The top bar avatar now correctly reflects the user's login state. It displays the user's avatar when logged in and a generic app icon when logged out.
    *   Clicking the avatar/icon now navigates to the `UserScreen` if logged in, or the `LoginScreen` if not.
2025-10-07 00:06:37 +08:00
0a0491ca1b
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.
2025-10-06 13:13:47 +08:00
6a1bc7ad97
feat: Implement core features with MVVM and Hilt
This commit introduces a comprehensive set of features, establishing the core functionality of the application using an MVVM architecture with Hilt for dependency injection.

**Key Changes:**

*   **UI & Navigation:**
    *   Implemented navigation between the main feed, post details, and login screens using Jetpack Navigation Compose.
    *   Added `TalkScreen` for displaying a feed of posts and `PostDetailScreen` for viewing individual posts and their comments.
    *   Created a `LoginScreen` with input fields and authentication logic.
    *   Introduced `PostCardItem` and `CommentItem` Composables for a consistent and reusable UI.
    *   Added shared element transitions for a smoother user experience when navigating to post details.

*   **Architecture & State Management:**
    *   Integrated Hilt for dependency injection across ViewModels and Repositories.
    *   Created ViewModels (`TalkViewModel`, `PostDetailViewModel`, `UserViewModel`, `CommentViewModel`, etc.) to manage UI state and business logic.
    *   Implemented Repository pattern for abstracting data sources from the backend API.
    *   Defined UI state data classes to ensure a predictable and observable state flow.

*   **Data & Models:**
    *   Introduced data models for `PostCard` and `CommentCard` to aggregate and display complex data structures.
    *   Added `PostDetailRepository` to orchestrate fetching of post and comment data concurrently.
    *   Refined DTOs, such as `CreateCommentDto`, for API interactions.

*   **Dependencies & Tooling:**
    *   Added Hilt, Navigation Compose, and Lifecycle ViewModel dependencies.
    *   Included the `pangu-jvm` library for improved text formatting with spacing between Chinese and English characters.
2025-10-06 00:29:51 +08:00
6d1c03ec85
refactor: change mutable properties to immutable in data classes 2025-10-05 11:42:29 +08:00
586425998d
Initial Commit 2025-10-05 01:20:02 +08:00