Skip to content

refactor(ui): implement responsive layout for Home, User Profile, and Topics#40

Merged
lackary merged 3 commits intomainfrom
refactor/39-update-ui-layout-rwd
Jan 25, 2026
Merged

refactor(ui): implement responsive layout for Home, User Profile, and Topics#40
lackary merged 3 commits intomainfrom
refactor/39-update-ui-layout-rwd

Conversation

@lackary
Copy link
Owner

@lackary lackary commented Jan 25, 2026

Related Issues

Closes #39

Type of Change

Please check the main type of change this PR introduces. If there are multiple, please select the most significant one.

  • feat: New feature
  • fix: Bug fix
  • refactor: Code refactoring
  • docs: Documentation update
  • chore: Chore (e.g., updating dependencies, build tooling)
  • style: Style changes (e.g., formatting, no code logic changes)
  • test: Adding or modifying tests
  • other: Other: [Please briefly describe]

Description

This PR refactors the UI of the main screens (HomeScreen, UserDetailScreen, and GalleryScreen) to implement Responsive Web Design (RWD), ensuring a better user experience across mobile and desktop devices.

Key Changes:

  1. User Profile (UserHeader):

    • Responsive Design: Introduced BoxWithConstraints to detect screen width.
    • Desktop Layout (>600dp): Optimized space by moving social link buttons to the same row as user statistics (aligned to the far right).
    • Mobile Layout: Kept social links in a separate row below the bio.
    • Refactoring: Extracted social links logic into a reusable SocialLinkItems component to reduce duplication.
    • Styling: Updated UserStatItem to use explicit 24.dp spacing for better visual separation.
  2. Home Screen:

    • Adaptive Grid: Replaced the single-column LazyColumn with an adaptive LazyVerticalGrid using GridCells.Adaptive(minSize = 250.dp).
    • Cleanup: Removed the "Available Services" header text for a cleaner look.
  3. Topic List (Gallery):

    • Grid Layout: Updated the topic list to use GridCells.Adaptive(minSize = 200.dp) instead of a fixed 2-column layout.
    • Data Fetching: Increased the pagination fetch size (perPage) from 10 to 20 to improve content density on larger screens.

How to test it?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Tested Platforms:

  • Android
  • iOS
  • Desktop (JVM)
  • Web (Wasm/JS)
  • Shared Logic (Unit Tests)

Test Details:

  • Unit tests: Did you write new tests to verify the smallest units of code?
  • Integration tests: Did you test how different parts of the system work together?
  • Manual testing:
    1. Mobile View (Portrait): Launch the app on a phone emulator. Verify that HomeScreen shows a single column (or 2 narrow ones) and UserHeader stacks social links at the bottom.
    2. Desktop/Tablet View (Landscape): Rotate the device or run on a Desktop emulator. Verify that:
      • HomeScreen displays multiple columns adaptive to width.
      • UserHeader moves the social links next to the "Likes/Photos" stats.
      • Topics load more items per page (20 items).

Review Checklist

Before submitting this PR, please confirm the following:

  • My code follows the project's coding style guidelines.
  • I have added sufficient comments to my code, especially in complex areas.
  • I have updated the relevant documentation.
  • My changes don't introduce new bugs.
  • I have tested my code locally.

This commit replaces the `LazyColumn` in `HomeScreen` with an adaptive `LazyVerticalGrid` to better support various screen sizes and improves the preview configuration.

Key changes:
- **Layout**: Migrated from a single-column list to a `LazyVerticalGrid` using `GridCells.Adaptive(minSize = 250.dp)`.
- **Styling**: Updated padding and spacing logic to utilize `Arrangement.spacedBy` for both horizontal and vertical axes within the grid.
- **Cleanup**: Removed the "Available Services" header text to streamline the grid presentation.
- **Previews**: Added explicit "Mobile" and "Desktop" `@Preview` configurations with specific dimensions to verify responsiveness.
This commit refactors the topics display to be more responsive and increases the number of topics loaded per request.

Key changes:
- **UI**: Updated `TopicGrid` to use `GridCells.Adaptive` with a minimum size of `200.dp`, replacing the fixed 2-column layout for better multi-device support.
- **ViewModel**: Increased `perPage` parameter from 10 to 20 in `fetchTopics` to improve content density during pagination.
- **Documentation**: Fixed a minor casing inconsistency in the `AttributionDisplay` documentation.
This commit refactors the `UserHeader` component to improve its layout and responsiveness across different screen sizes.

Key changes:
- **Responsive Design**: Introduced `BoxWithConstraints` to detect screen width. On large screens (>600dp), social links are now moved to the same row as user statistics to optimize space.
- **Component Refactoring**: Extracted social link logic into a standalone `SocialLinkItems` composable to reduce duplication and improve maintainability.
- **UI Tweaks**:
    - Updated `UserStatItem` row to use explicit spacing (`24.dp`) instead of `Arrangement.spacedBy`.
    - Adjusted vertical padding and spacing between the avatar, stats, bio, and social links for a tighter visual density.
    - Added `modifier` support to `UserHeader` and `SocialLinkItems`.
@lackary lackary self-assigned this Jan 25, 2026
@lackary lackary added the refactor Code changes that neither fix a bug nor add a feature. label Jan 25, 2026
@lackary lackary merged commit 06447f2 into main Jan 25, 2026
2 checks passed
@lackary lackary deleted the refactor/39-update-ui-layout-rwd branch January 25, 2026 04:35
@github-actions
Copy link

🎉 This PR is included in version 0.14.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code changes that neither fix a bug nor add a feature. released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: update layout and apply RWD for Home, User Profile, and Topic List

1 participant