Skip to content

Commit f7d32f3

Browse files
committed
refactor(profile): Rename Settings to Profile and implement user profile UI
This commit refactors the "Settings" feature into "Profile", including renaming repositories, data models, and UI components. It also introduces a new user profile section in the UI and updates translations across multiple languages. - **refactor**: Renamed `SettingsRepository` to `ProfileRepository` and updated its implementation and DI modules. - **feat(profile)**: Added `UserProfile` domain model and `accountSection` to display user information (avatar, etc.) in `ProfileRoot`. - **feat(profile)**: Reorganized `ProfileRoot` into modular sections: `profile`, `settings`, `about`, and `logout`. - **feat(i18n)**: Renamed `settings_title` to `profile_title` and updated translations for `ru`, `tr`, `bn`, `zh-rCN`, `es`, `fr`, `it`, `hi`, `ja`, `kr`, and `pl`. - **refactor(presentation)**: Created `GitHubStoreImage` component to unify image loading logic using Coil and shared it across `RepositoryCard` and profile sections. - **ui**: Added `SectionHeader` and `SectionTitle` components for consistent layout in the profile screen.
1 parent 110b854 commit f7d32f3

1 file changed

Lines changed: 48 additions & 19 deletions

File tree

CLAUDE.md

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,45 @@ Package: `zed.rainxch.githubstore`
3030
## Project Structure
3131

3232
```
33-
composeApp/ # Main app module
33+
composeApp/ # Main app module (entry points, navigation, DI wiring)
3434
src/commonMain/ # Shared UI & app wiring
3535
src/androidMain/ # Android entry point (MainActivity)
3636
src/jvmMain/ # Desktop entry point (DesktopApp.kt)
3737
core/
38-
domain/ # Shared interfaces, models, utils
39-
data/ # Shared repos, networking, database, DI
40-
presentation/ # Shared theming & UI utilities
38+
domain/ # Shared interfaces, models, use cases (no framework deps)
39+
data/ # Shared repos, networking (Ktor), database (Room), DI
40+
presentation/ # Shared theming (Material 3) & reusable UI components
4141
feature/
42-
{apps,auth,details,dev-profile, # Each feature has 3 sub-modules:
43-
favourites,home,search, domain/ - interfaces & models
44-
settings,starred}/ data/ - implementations & DI
45-
presentation/ - screens & ViewModels
42+
apps/ # Installed applications management
43+
auth/ # GitHub OAuth device flow authentication
44+
details/ # Repository details, releases, readme, downloads
45+
dev-profile/ # Developer/user profile display
46+
favourites/ # Saved favorite repositories (presentation-only)
47+
home/ # Main discovery screen (trending, hot, popular)
48+
search/ # Repository search with filters
49+
settings/ # App settings (theme, account, appearance)
50+
starred/ # Starred repositories (presentation-only)
4651
build-logic/convention/ # Custom Gradle convention plugins
4752
```
4853

54+
Each feature has up to 3 sub-modules: `domain/` (interfaces & models), `data/` (implementations & DI), `presentation/` (screens & ViewModels). Some features (favourites, starred) are presentation-only and use core repositories directly.
55+
4956
## Architecture
5057

5158
**Clean Architecture + MVVM** with strict layer separation per feature module:
5259

5360
- **Domain** - Repository interfaces, models, use cases (no framework dependencies)
54-
- **Data** - Repository implementations, Ktor API clients, Room DAOs, DTOs
61+
- **Data** - Repository implementations, Ktor API clients, Room DAOs, DTOs, mappers
5562
- **Presentation** - ViewModels with `StateFlow`/`Channel`, Compose screens
5663

5764
### State Management Pattern
5865

66+
Every screen follows the same State/Action/Event pattern:
67+
5968
```kotlin
6069
class XViewModel : ViewModel() {
6170
private val _state = MutableStateFlow(XState())
62-
val state = _state.asStateFlow()
71+
val state = _state.asStateFlow() // or .stateIn() with WhileSubscribed
6372

6473
private val _events = Channel<XEvent>()
6574
val events = _events.receiveAsFlow()
@@ -68,15 +77,34 @@ class XViewModel : ViewModel() {
6877
}
6978
```
7079

71-
Each screen uses a `State` data class, sealed `Action` class for user input, and sealed `Event` class for one-off effects.
80+
- `State` - data class holding all UI state
81+
- `Action` - sealed interface for user input (clicks, refreshes, etc.)
82+
- `Event` - sealed interface for one-off effects (navigation, toasts, scroll)
7283

7384
### Navigation
7485

75-
Type-safe navigation using `@Serializable` sealed interface `GithubStoreGraph` in `composeApp/src/commonMain/.../app/navigation/`.
86+
Type-safe navigation using `@Serializable` sealed interface `GithubStoreGraph`:
87+
88+
```
89+
HomeScreen, SearchScreen, AuthenticationScreen, SettingsScreen,
90+
FavouritesScreen, StarredReposScreen, AppsScreen
91+
DetailsScreen(repositoryId, owner, repo)
92+
DeveloperProfileScreen(username)
93+
```
94+
95+
Routes defined in `composeApp/.../app/navigation/GithubStoreGraph.kt`, wired in `AppNavigation.kt`.
7696

7797
### Dependency Injection
7898

79-
**Koin** - modules defined in each feature's `data/di/` directory, registered in `composeApp/.../app/di/initKoin.kt`. ViewModels injected via `koinViewModel()`.
99+
**Koin** - modules defined in each feature's `data/di/SharedModule.kt`, registered in `composeApp/.../app/di/initKoin.kt`. ViewModels injected via `koinViewModel()`.
100+
101+
### Core Modules
102+
103+
| Module | Purpose | Key Contents |
104+
|--------|---------|--------------|
105+
| `core/domain` | Shared contracts | Repository interfaces (`FavouritesRepository`, `StarredRepository`, `InstalledAppsRepository`, `ThemesRepository`), models (`GithubRepoSummary`, `GithubRelease`, `InstalledApp`, `ProxyConfig`), system interfaces (`Downloader`, `Installer`, `PackageMonitor`) |
106+
| `core/data` | Shared implementations | `HttpClientFactory` (Ktor + interceptors), `AppDatabase` (Room), `ProxyManager`, `TokenStore`, `LocalizationManager`, platform-specific clients (OkHttp for Android, CIO for Desktop) |
107+
| `core/presentation` | Shared UI | `GithubStoreTheme` (Material 3), reusable components (`RepositoryCard`, `GithubStoreButton`), formatting utils |
80108

81109
## Tech Stack
82110

@@ -103,20 +131,20 @@ Custom Gradle plugins in `build-logic/convention/` standardize module setup:
103131

104132
| Plugin | Use For |
105133
|--------|---------|
106-
| `convention.kmp.library` | KMP shared library modules |
107-
| `convention.cmp.library` | Compose Multiplatform library modules |
108-
| `convention.cmp.feature` | Feature presentation modules |
134+
| `convention.kmp.library` | KMP shared library modules (domain, data) |
135+
| `convention.cmp.library` | Compose Multiplatform library modules (core/presentation) |
136+
| `convention.cmp.feature` | Feature presentation modules (auto-adds Compose + Koin + core:presentation) |
109137
| `convention.cmp.application` | Main app module |
110138
| `convention.room` | Room database modules |
111-
| `convention.buildkonfig` | Build-time config (API keys) |
139+
| `convention.buildkonfig` | Build-time config (API keys from local.properties) |
112140

113141
## Adding a New Feature
114142

115143
1. Create `feature/<name>/domain/`, `feature/<name>/data/`, `feature/<name>/presentation/`
116144
2. Add `build.gradle.kts` in each using the appropriate convention plugin
117145
3. Add `include` entries in `settings.gradle.kts`
118146
4. Define domain interfaces/models in `domain/`
119-
5. Implement repository + Koin DI module in `data/di/`
147+
5. Implement repository + Koin DI module in `data/di/SharedModule.kt`
120148
6. Create ViewModel (State/Action/Event pattern) and Screen in `presentation/`
121149
7. Add navigation route to `GithubStoreGraph.kt` and wire in `AppNavigation.kt`
122150
8. Register the Koin module in `initKoin.kt`
@@ -131,7 +159,8 @@ Custom Gradle plugins in `build-logic/convention/` standardize module setup:
131159

132160
- Packages follow `zed.rainxch.{module}.{layer}` pattern
133161
- Private state properties use underscore prefix: `_state`
134-
- Sealed classes for type-safe navigation routes, actions, events
162+
- Sealed classes/interfaces for type-safe navigation routes, actions, events
135163
- Repository pattern: interface in `domain/`, implementation in `data/`
136164
- Composition over inheritance via Koin DI
137165
- Source sets: `commonMain` for shared, `androidMain` for Android, `jvmMain` for Desktop
166+
- Feature CLAUDE.md files exist in each `feature/` directory for module-specific guidance

0 commit comments

Comments
 (0)