openuispec 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/cli/index.ts +80 -2
- package/cli/init.ts +23 -8
- package/docs/cli.md +42 -7
- package/drift/index.ts +41 -15
- package/mcp-server/index.ts +247 -117
- package/mcp-server/screenshot-android.ts +185 -44
- package/mcp-server/screenshot-ios.ts +242 -30
- package/mcp-server/screenshot.ts +96 -1
- package/package.json +5 -2
- package/prepare/index.ts +16 -0
- package/scripts/take-all-screenshots.ts +507 -0
- package/status/index.ts +2 -2
- package/examples/social-app/.mcp.json +0 -10
- package/examples/social-app/AGENTS.md +0 -124
- package/examples/social-app/CLAUDE.md +0 -124
- package/examples/social-app/backend/.gitkeep +0 -1
- package/examples/social-app/generated/android/social-app/app/.paparazzi-hashes.json +0 -3
- package/examples/social-app/generated/android/social-app/app/build.gradle.kts +0 -94
- package/examples/social-app/generated/android/social-app/app/src/main/AndroidManifest.xml +0 -26
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/AppContainer.kt +0 -20
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/MainActivity.kt +0 -35
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/SocialAppApplication.kt +0 -13
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/MockData.kt +0 -98
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/AppPreferences.kt +0 -19
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/DataStorePreferencesRepository.kt +0 -68
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/PreferencesRepository.kt +0 -15
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/model/Models.kt +0 -34
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/MainShell.kt +0 -390
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/Components.kt +0 -234
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/ContractPrimitives.kt +0 -641
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/navigation/RootComponent.kt +0 -113
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ChatDetailScreen.kt +0 -212
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/CreatePostScreen.kt +0 -113
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/DiscoverScreen.kt +0 -137
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/EditProfileScreen.kt +0 -180
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/HomeFeedScreen.kt +0 -169
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/MessagesInboxScreen.kt +0 -85
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/NotificationsScreen.kt +0 -74
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/PostDetailScreen.kt +0 -293
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ProfileSelfScreen.kt +0 -116
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SearchResultsScreen.kt +0 -161
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsScreen.kt +0 -164
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsStore.kt +0 -95
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/UserProfileScreen.kt +0 -123
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Color.kt +0 -33
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Shape.kt +0 -41
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Spacing.kt +0 -20
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Theme.kt +0 -82
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Type.kt +0 -60
- package/examples/social-app/generated/android/social-app/app/src/main/res/drawable/ic_launcher_foreground.xml +0 -9
- package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
- package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
- package/examples/social-app/generated/android/social-app/app/src/main/res/values/strings.xml +0 -91
- package/examples/social-app/generated/android/social-app/app/src/main/res/values/themes.xml +0 -10
- package/examples/social-app/generated/android/social-app/app/src/main/res/values-ru/strings.xml +0 -79
- package/examples/social-app/generated/android/social-app/app/src/main/res/values-uz/strings.xml +0 -79
- package/examples/social-app/generated/android/social-app/app/src/main/xml/AndroidManifest.xml +0 -23
- package/examples/social-app/generated/android/social-app/app/src/test/kotlin/com/social/app/screenshots/HomeFeedScreenshotTest.kt +0 -34
- package/examples/social-app/generated/android/social-app/build.gradle.kts +0 -7
- package/examples/social-app/generated/android/social-app/gradle/libs.versions.toml +0 -50
- package/examples/social-app/generated/android/social-app/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/social-app/generated/android/social-app/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/examples/social-app/generated/android/social-app/gradle.properties +0 -11
- package/examples/social-app/generated/android/social-app/gradlew +0 -248
- package/examples/social-app/generated/android/social-app/settings.gradle.kts +0 -27
- package/examples/social-app/generated/web/social-app/index.html +0 -12
- package/examples/social-app/generated/web/social-app/package-lock.json +0 -2517
- package/examples/social-app/generated/web/social-app/package.json +0 -27
- package/examples/social-app/generated/web/social-app/src/app/App.tsx +0 -58
- package/examples/social-app/generated/web/social-app/src/components/Shell.tsx +0 -259
- package/examples/social-app/generated/web/social-app/src/components/cards.tsx +0 -317
- package/examples/social-app/generated/web/social-app/src/components/ui.tsx +0 -340
- package/examples/social-app/generated/web/social-app/src/flows/CreatePostFlow.tsx +0 -86
- package/examples/social-app/generated/web/social-app/src/i18n.tsx +0 -59
- package/examples/social-app/generated/web/social-app/src/lib/icons.tsx +0 -85
- package/examples/social-app/generated/web/social-app/src/lib/tokens.ts +0 -70
- package/examples/social-app/generated/web/social-app/src/lib/utils.ts +0 -97
- package/examples/social-app/generated/web/social-app/src/locales/en.json +0 -67
- package/examples/social-app/generated/web/social-app/src/locales/ru.json +0 -67
- package/examples/social-app/generated/web/social-app/src/locales/uz.json +0 -67
- package/examples/social-app/generated/web/social-app/src/main.tsx +0 -16
- package/examples/social-app/generated/web/social-app/src/screens/ChatDetailScreen.tsx +0 -90
- package/examples/social-app/generated/web/social-app/src/screens/DiscoverScreen.tsx +0 -86
- package/examples/social-app/generated/web/social-app/src/screens/EditProfileScreen.tsx +0 -57
- package/examples/social-app/generated/web/social-app/src/screens/HomeFeedScreen.tsx +0 -103
- package/examples/social-app/generated/web/social-app/src/screens/MessagesInboxScreen.tsx +0 -52
- package/examples/social-app/generated/web/social-app/src/screens/NotificationsScreen.tsx +0 -41
- package/examples/social-app/generated/web/social-app/src/screens/PostDetailScreen.tsx +0 -115
- package/examples/social-app/generated/web/social-app/src/screens/ProfileSelfScreen.tsx +0 -57
- package/examples/social-app/generated/web/social-app/src/screens/ProfileUserScreen.tsx +0 -76
- package/examples/social-app/generated/web/social-app/src/screens/SearchResultsScreen.tsx +0 -96
- package/examples/social-app/generated/web/social-app/src/screens/SettingsScreen.tsx +0 -79
- package/examples/social-app/generated/web/social-app/src/state/store.ts +0 -592
- package/examples/social-app/generated/web/social-app/src/styles.css +0 -125
- package/examples/social-app/generated/web/social-app/src/vite-env.d.ts +0 -1
- package/examples/social-app/generated/web/social-app/tsconfig.json +0 -22
- package/examples/social-app/generated/web/social-app/tsconfig.node.json +0 -13
- package/examples/social-app/generated/web/social-app/tsconfig.node.tsbuildinfo +0 -1
- package/examples/social-app/generated/web/social-app/tsconfig.tsbuildinfo +0 -1
- package/examples/social-app/generated/web/social-app/vite.config.d.ts +0 -2
- package/examples/social-app/generated/web/social-app/vite.config.js +0 -6
- package/examples/social-app/generated/web/social-app/vite.config.ts +0 -7
- package/examples/social-app/package.json +0 -13
- package/examples/social-app/take-web-screenshots.ts +0 -97
- package/examples/taskflow/.codex/config.toml +0 -4
- package/examples/taskflow/.mcp.json +0 -10
- package/examples/taskflow/AGENTS.md +0 -124
- package/examples/taskflow/CLAUDE.md +0 -124
- package/examples/taskflow/backend/.gitkeep +0 -1
- package/examples/taskflow/generated/android/TaskFlow/README.md +0 -43
- package/examples/taskflow/generated/android/TaskFlow/app/build.gradle.kts +0 -76
- package/examples/taskflow/generated/android/TaskFlow/app/proguard-rules.pro +0 -1
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/AndroidManifest.xml +0 -21
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/MainActivity.kt +0 -19
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/TaskFlowApp.kt +0 -283
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/DomainModels.kt +0 -106
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/SampleData.kt +0 -57
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/components/Common.kt +0 -109
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/HomeScreen.kt +0 -112
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/ProjectsScreen.kt +0 -61
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/SettingsScreen.kt +0 -82
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/TaskDetailScreen.kt +0 -111
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/sheets/Sheets.kt +0 -77
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Color.kt +0 -30
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Theme.kt +0 -86
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Type.kt +0 -57
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/strings.xml +0 -155
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/themes.xml +0 -4
- package/examples/taskflow/generated/android/TaskFlow/build.gradle.kts +0 -5
- package/examples/taskflow/generated/android/TaskFlow/gradle/gradle-daemon-jvm.properties +0 -12
- package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/examples/taskflow/generated/android/TaskFlow/gradle.properties +0 -4
- package/examples/taskflow/generated/android/TaskFlow/gradlew +0 -18
- package/examples/taskflow/generated/android/TaskFlow/gradlew.bat +0 -12
- package/examples/taskflow/generated/android/TaskFlow/settings.gradle.kts +0 -18
- package/examples/taskflow/generated/ios/TaskFlow/README.md +0 -21
- package/examples/taskflow/generated/ios/TaskFlow/Resources/en.lproj/Localizable.strings +0 -115
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/App/TaskFlowApp.swift +0 -24
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Components/AppChrome.swift +0 -150
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Flows/TaskEditorSheet.swift +0 -220
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Models/DomainModels.swift +0 -122
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/CalendarView.swift +0 -21
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/HomeView.swift +0 -201
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProfileEditView.swift +0 -48
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectDetailView.swift +0 -59
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectsView.swift +0 -63
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/SettingsView.swift +0 -85
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/TaskDetailView.swift +0 -219
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppModel.swift +0 -320
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppSupport.swift +0 -41
- package/examples/taskflow/generated/ios/TaskFlow/project.yml +0 -26
- package/examples/taskflow/generated/web/TaskFlow/README.md +0 -19
- package/examples/taskflow/generated/web/TaskFlow/index.html +0 -12
- package/examples/taskflow/generated/web/TaskFlow/package-lock.json +0 -1908
- package/examples/taskflow/generated/web/TaskFlow/package.json +0 -24
- package/examples/taskflow/generated/web/TaskFlow/src/App.tsx +0 -58
- package/examples/taskflow/generated/web/TaskFlow/src/AppShell.tsx +0 -55
- package/examples/taskflow/generated/web/TaskFlow/src/components/Common.tsx +0 -82
- package/examples/taskflow/generated/web/TaskFlow/src/components/Modals.tsx +0 -191
- package/examples/taskflow/generated/web/TaskFlow/src/components/Nav.tsx +0 -41
- package/examples/taskflow/generated/web/TaskFlow/src/generated/messages.ts +0 -131
- package/examples/taskflow/generated/web/TaskFlow/src/hooks.ts +0 -25
- package/examples/taskflow/generated/web/TaskFlow/src/i18n.ts +0 -39
- package/examples/taskflow/generated/web/TaskFlow/src/locales.en.json +0 -111
- package/examples/taskflow/generated/web/TaskFlow/src/main.tsx +0 -13
- package/examples/taskflow/generated/web/TaskFlow/src/screens/HomeScreen.tsx +0 -111
- package/examples/taskflow/generated/web/TaskFlow/src/screens/ProjectsScreen.tsx +0 -82
- package/examples/taskflow/generated/web/TaskFlow/src/screens/SettingsScreens.tsx +0 -132
- package/examples/taskflow/generated/web/TaskFlow/src/screens/TaskDetail.tsx +0 -105
- package/examples/taskflow/generated/web/TaskFlow/src/store.ts +0 -216
- package/examples/taskflow/generated/web/TaskFlow/src/styles.css +0 -617
- package/examples/taskflow/generated/web/TaskFlow/src/types.ts +0 -64
- package/examples/taskflow/generated/web/TaskFlow/src/utils.ts +0 -78
- package/examples/taskflow/generated/web/TaskFlow/tsconfig.json +0 -21
- package/examples/taskflow/generated/web/TaskFlow/vite.config.ts +0 -6
- package/examples/todo-orbit/.codex/config.toml +0 -4
- package/examples/todo-orbit/.mcp.json +0 -10
- package/examples/todo-orbit/AGENTS.md +0 -124
- package/examples/todo-orbit/CLAUDE.md +0 -124
- package/examples/todo-orbit/backend/.gitkeep +0 -1
- package/examples/todo-orbit/generated/android/Todo Orbit/README.md +0 -14
- package/examples/todo-orbit/generated/android/Todo Orbit/app/build.gradle.kts +0 -58
- package/examples/todo-orbit/generated/android/Todo Orbit/app/proguard-rules.pro +0 -1
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/AndroidManifest.xml +0 -20
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/MainActivity.kt +0 -14
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/TodoOrbitApp.kt +0 -345
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/support/AppLogic.kt +0 -231
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/support/Models.kt +0 -169
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/support/Strings.kt +0 -8
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/components/CommonComponents.kt +0 -236
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/screens/AnalyticsScreen.kt +0 -193
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/screens/SettingsScreen.kt +0 -102
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/screens/TasksScreen.kt +0 -347
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/sheets/EditorSheets.kt +0 -347
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/theme/TodoOrbitTheme.kt +0 -59
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/res/values/strings.xml +0 -149
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/res/values-ru/strings.xml +0 -155
- package/examples/todo-orbit/generated/android/Todo Orbit/build.gradle.kts +0 -4
- package/examples/todo-orbit/generated/android/Todo Orbit/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/todo-orbit/generated/android/Todo Orbit/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/examples/todo-orbit/generated/android/Todo Orbit/gradle.properties +0 -4
- package/examples/todo-orbit/generated/android/Todo Orbit/gradlew +0 -248
- package/examples/todo-orbit/generated/android/Todo Orbit/gradlew.bat +0 -93
- package/examples/todo-orbit/generated/android/Todo Orbit/settings.gradle.kts +0 -18
- package/examples/todo-orbit/generated/ios/Todo Orbit/.screenshot-uitest/Sources/ScreenshotUITest.swift +0 -36
- package/examples/todo-orbit/generated/ios/Todo Orbit/README.md +0 -29
- package/examples/todo-orbit/generated/ios/Todo Orbit/Resources/en.lproj/Localizable.strings +0 -119
- package/examples/todo-orbit/generated/ios/Todo Orbit/Resources/ru.lproj/Localizable.strings +0 -119
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/App/TodoOrbitApp.swift +0 -50
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Components/OrbitChrome.swift +0 -204
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Components/SchedulePreviewView.swift +0 -126
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Components/TrendChartView.swift +0 -70
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Flows/RecurringRuleSheet.swift +0 -126
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Flows/TaskEditorSheet.swift +0 -61
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Models/DomainModels.swift +0 -238
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Screens/AnalyticsView.swift +0 -94
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Screens/SettingsView.swift +0 -76
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Screens/TasksHomeView.swift +0 -364
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Support/AppModel.swift +0 -324
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/project.pbxproj +0 -400
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/examples/todo-orbit/generated/ios/Todo Orbit/project.yml +0 -25
- package/examples/todo-orbit/generated/web/Todo Orbit/index.html +0 -16
- package/examples/todo-orbit/generated/web/Todo Orbit/package-lock.json +0 -1087
- package/examples/todo-orbit/generated/web/Todo Orbit/package.json +0 -24
- package/examples/todo-orbit/generated/web/Todo Orbit/src/App.tsx +0 -2167
- package/examples/todo-orbit/generated/web/Todo Orbit/src/main.tsx +0 -13
- package/examples/todo-orbit/generated/web/Todo Orbit/src/styles.css +0 -926
- package/examples/todo-orbit/generated/web/Todo Orbit/tsconfig.json +0 -19
- package/examples/todo-orbit/generated/web/Todo Orbit/vite.config.ts +0 -6
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
package com.social.app.data.preferences
|
|
2
|
-
|
|
3
|
-
import kotlinx.coroutines.flow.Flow
|
|
4
|
-
|
|
5
|
-
interface PreferencesRepository {
|
|
6
|
-
val preferences: Flow<AppPreferences>
|
|
7
|
-
|
|
8
|
-
suspend fun updateThemeMode(themeMode: ThemeMode)
|
|
9
|
-
|
|
10
|
-
suspend fun updatePushNotifications(enabled: Boolean)
|
|
11
|
-
|
|
12
|
-
suspend fun updateMessagePreviews(enabled: Boolean)
|
|
13
|
-
|
|
14
|
-
suspend fun updateAutoTranslate(enabled: Boolean)
|
|
15
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
package com.social.app.model
|
|
2
|
-
|
|
3
|
-
data class User(
|
|
4
|
-
val id: String,
|
|
5
|
-
val handle: String,
|
|
6
|
-
val displayName: String,
|
|
7
|
-
val avatarUrl: String? = null,
|
|
8
|
-
val bio: String? = null,
|
|
9
|
-
val followers: Int = 0,
|
|
10
|
-
val following: Int = 0,
|
|
11
|
-
val isFollowed: Boolean = false
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
data class Post(
|
|
15
|
-
val id: String,
|
|
16
|
-
val authorId: String,
|
|
17
|
-
val authorName: String,
|
|
18
|
-
val authorHandle: String,
|
|
19
|
-
val authorAvatar: String? = null,
|
|
20
|
-
val body: String,
|
|
21
|
-
val mediaUrl: String? = null,
|
|
22
|
-
val likeCount: Int = 0,
|
|
23
|
-
val commentCount: Int = 0,
|
|
24
|
-
val timestamp: String,
|
|
25
|
-
val liked: Boolean = false
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
data class Story(
|
|
29
|
-
val id: String,
|
|
30
|
-
val authorId: String,
|
|
31
|
-
val authorName: String,
|
|
32
|
-
val authorAvatar: String? = null,
|
|
33
|
-
val previewUrl: String? = null
|
|
34
|
-
)
|
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
package com.social.app.ui
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.clickable
|
|
4
|
-
import androidx.compose.foundation.layout.Arrangement
|
|
5
|
-
import androidx.compose.foundation.layout.Box
|
|
6
|
-
import androidx.compose.foundation.layout.Column
|
|
7
|
-
import androidx.compose.foundation.layout.Row
|
|
8
|
-
import androidx.compose.foundation.layout.fillMaxHeight
|
|
9
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
10
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
-
import androidx.compose.foundation.layout.padding
|
|
12
|
-
import androidx.compose.foundation.layout.width
|
|
13
|
-
import androidx.compose.material.icons.Icons
|
|
14
|
-
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|
15
|
-
import androidx.compose.material.icons.filled.AddCircle
|
|
16
|
-
import androidx.compose.material.icons.filled.Explore
|
|
17
|
-
import androidx.compose.material.icons.filled.Home
|
|
18
|
-
import androidx.compose.material.icons.filled.Notifications
|
|
19
|
-
import androidx.compose.material.icons.filled.Person
|
|
20
|
-
import androidx.compose.material3.Badge
|
|
21
|
-
import androidx.compose.material3.BadgedBox
|
|
22
|
-
import androidx.compose.material3.BottomSheetDefaults
|
|
23
|
-
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
24
|
-
import androidx.compose.material3.Icon
|
|
25
|
-
import androidx.compose.material3.MaterialTheme
|
|
26
|
-
import androidx.compose.material3.ModalBottomSheet
|
|
27
|
-
import androidx.compose.material3.NavigationBar
|
|
28
|
-
import androidx.compose.material3.NavigationBarItem
|
|
29
|
-
import androidx.compose.material3.NavigationBarItemDefaults
|
|
30
|
-
import androidx.compose.material3.NavigationRail
|
|
31
|
-
import androidx.compose.material3.Scaffold
|
|
32
|
-
import androidx.compose.material3.SnackbarHostState
|
|
33
|
-
import androidx.compose.material3.Surface
|
|
34
|
-
import androidx.compose.material3.Text
|
|
35
|
-
import androidx.compose.material3.TopAppBar
|
|
36
|
-
import androidx.compose.material3.IconButton
|
|
37
|
-
import androidx.compose.runtime.Composable
|
|
38
|
-
import androidx.compose.runtime.getValue
|
|
39
|
-
import androidx.compose.runtime.mutableIntStateOf
|
|
40
|
-
import androidx.compose.runtime.remember
|
|
41
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
42
|
-
import androidx.compose.runtime.setValue
|
|
43
|
-
import androidx.compose.ui.Alignment
|
|
44
|
-
import androidx.compose.ui.Modifier
|
|
45
|
-
import androidx.compose.ui.platform.LocalConfiguration
|
|
46
|
-
import androidx.compose.ui.res.stringResource
|
|
47
|
-
import androidx.compose.ui.text.style.TextAlign
|
|
48
|
-
import androidx.compose.ui.unit.dp
|
|
49
|
-
import com.arkivanov.decompose.extensions.compose.subscribeAsState
|
|
50
|
-
import com.social.app.R
|
|
51
|
-
import com.social.app.data.preferences.PreferencesRepository
|
|
52
|
-
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
|
53
|
-
import com.social.app.data.MockData
|
|
54
|
-
import com.social.app.ui.navigation.RootComponent
|
|
55
|
-
import com.social.app.ui.screens.ChatDetailScreen
|
|
56
|
-
import com.social.app.ui.screens.CreatePostScreen
|
|
57
|
-
import com.social.app.ui.screens.DiscoverScreen
|
|
58
|
-
import com.social.app.ui.screens.EditProfileScreen
|
|
59
|
-
import com.social.app.ui.screens.HomeFeedScreen
|
|
60
|
-
import com.social.app.ui.screens.MessagesInboxScreen
|
|
61
|
-
import com.social.app.ui.screens.NotificationsScreen
|
|
62
|
-
import com.social.app.ui.screens.PostDetailScreen
|
|
63
|
-
import com.social.app.ui.screens.ProfileSelfScreen
|
|
64
|
-
import com.social.app.ui.screens.SearchResultsScreen
|
|
65
|
-
import com.social.app.ui.screens.SettingsScreen
|
|
66
|
-
import com.social.app.ui.screens.UserProfileScreen
|
|
67
|
-
import com.social.app.ui.components.ContractSnackbarHost
|
|
68
|
-
import com.social.app.ui.theme.Shapes
|
|
69
|
-
import kotlinx.coroutines.delay
|
|
70
|
-
import kotlinx.coroutines.launch
|
|
71
|
-
|
|
72
|
-
private enum class MainDestination {
|
|
73
|
-
Home,
|
|
74
|
-
Discover,
|
|
75
|
-
Notifications,
|
|
76
|
-
Profile,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private data class NavItem(
|
|
80
|
-
val destination: MainDestination?,
|
|
81
|
-
val labelRes: Int,
|
|
82
|
-
val icon: @Composable () -> Unit,
|
|
83
|
-
val onClick: () -> Unit,
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
@OptIn(ExperimentalMaterial3Api::class)
|
|
87
|
-
@Composable
|
|
88
|
-
fun MainShell(
|
|
89
|
-
root: RootComponent,
|
|
90
|
-
preferencesRepository: PreferencesRepository,
|
|
91
|
-
storeFactory: StoreFactory,
|
|
92
|
-
) {
|
|
93
|
-
val stack by root.stack.subscribeAsState()
|
|
94
|
-
val activeChild = stack.active.instance
|
|
95
|
-
val previousChild = stack.backStack.lastOrNull()?.instance
|
|
96
|
-
val mainChild =
|
|
97
|
-
if (activeChild is RootComponent.Child.CreatePost && previousChild != null) previousChild else activeChild
|
|
98
|
-
|
|
99
|
-
val isExpanded = LocalConfiguration.current.screenWidthDp >= 1025
|
|
100
|
-
var unreadCount by remember { mutableIntStateOf(MockData.notifications.size) }
|
|
101
|
-
val snackbarHostState = remember { SnackbarHostState() }
|
|
102
|
-
val scope = rememberCoroutineScope()
|
|
103
|
-
val createPostSuccessMessage = stringResource(R.string.create_post_success)
|
|
104
|
-
val activeDestination = activeDestinationFor(mainChild)
|
|
105
|
-
val primaryScreen =
|
|
106
|
-
mainChild is RootComponent.Child.Home ||
|
|
107
|
-
mainChild is RootComponent.Child.Discover ||
|
|
108
|
-
mainChild is RootComponent.Child.Notifications ||
|
|
109
|
-
mainChild is RootComponent.Child.Profile
|
|
110
|
-
|
|
111
|
-
val navItems = listOf(
|
|
112
|
-
NavItem(
|
|
113
|
-
destination = MainDestination.Home,
|
|
114
|
-
labelRes = R.string.nav_home,
|
|
115
|
-
icon = { Icon(Icons.Default.Home, contentDescription = null) },
|
|
116
|
-
onClick = root::onHomeTabClicked,
|
|
117
|
-
),
|
|
118
|
-
NavItem(
|
|
119
|
-
destination = MainDestination.Discover,
|
|
120
|
-
labelRes = R.string.nav_discover,
|
|
121
|
-
icon = { Icon(Icons.Default.Explore, contentDescription = null) },
|
|
122
|
-
onClick = root::onDiscoverTabClicked,
|
|
123
|
-
),
|
|
124
|
-
NavItem(
|
|
125
|
-
destination = null,
|
|
126
|
-
labelRes = R.string.nav_create,
|
|
127
|
-
icon = { Icon(Icons.Default.AddCircle, contentDescription = null) },
|
|
128
|
-
onClick = root::onCreatePostClicked,
|
|
129
|
-
),
|
|
130
|
-
NavItem(
|
|
131
|
-
destination = MainDestination.Notifications,
|
|
132
|
-
labelRes = R.string.nav_notifications,
|
|
133
|
-
icon = {
|
|
134
|
-
BadgedBox(
|
|
135
|
-
badge = {
|
|
136
|
-
if (unreadCount > 0) {
|
|
137
|
-
Badge {
|
|
138
|
-
Text(unreadCount.toString())
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
) {
|
|
143
|
-
Icon(Icons.Default.Notifications, contentDescription = null)
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
onClick = root::onNotificationsTabClicked,
|
|
147
|
-
),
|
|
148
|
-
NavItem(
|
|
149
|
-
destination = MainDestination.Profile,
|
|
150
|
-
labelRes = R.string.nav_profile,
|
|
151
|
-
icon = { Icon(Icons.Default.Person, contentDescription = null) },
|
|
152
|
-
onClick = root::onProfileTabClicked,
|
|
153
|
-
),
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
Scaffold(
|
|
157
|
-
modifier = Modifier.fillMaxSize(),
|
|
158
|
-
snackbarHost = {
|
|
159
|
-
ContractSnackbarHost(hostState = snackbarHostState)
|
|
160
|
-
},
|
|
161
|
-
bottomBar = {
|
|
162
|
-
if (primaryScreen && !isExpanded) {
|
|
163
|
-
CompactTabBar(
|
|
164
|
-
items = navItems,
|
|
165
|
-
activeDestination = activeDestination,
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
) { padding ->
|
|
170
|
-
Row(
|
|
171
|
-
modifier = Modifier
|
|
172
|
-
.fillMaxSize()
|
|
173
|
-
.padding(padding),
|
|
174
|
-
) {
|
|
175
|
-
if (primaryScreen && isExpanded) {
|
|
176
|
-
ExpandedSidebar(
|
|
177
|
-
items = navItems,
|
|
178
|
-
activeDestination = activeDestination,
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
Box(
|
|
183
|
-
modifier = Modifier
|
|
184
|
-
.fillMaxHeight()
|
|
185
|
-
.weight(1f),
|
|
186
|
-
) {
|
|
187
|
-
Surface(
|
|
188
|
-
modifier = Modifier.fillMaxSize(),
|
|
189
|
-
color = MaterialTheme.colorScheme.surface,
|
|
190
|
-
) {
|
|
191
|
-
RenderChild(
|
|
192
|
-
child = mainChild,
|
|
193
|
-
root = root,
|
|
194
|
-
preferencesRepository = preferencesRepository,
|
|
195
|
-
storeFactory = storeFactory,
|
|
196
|
-
onNotificationRead = {
|
|
197
|
-
unreadCount = (unreadCount - 1).coerceAtLeast(0)
|
|
198
|
-
},
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (activeChild is RootComponent.Child.CreatePost) {
|
|
205
|
-
ModalBottomSheet(
|
|
206
|
-
onDismissRequest = root::onBackClicked,
|
|
207
|
-
containerColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
208
|
-
dragHandle = { BottomSheetDefaults.DragHandle() },
|
|
209
|
-
shape = Shapes.SheetShape,
|
|
210
|
-
) {
|
|
211
|
-
CreatePostScreen(
|
|
212
|
-
onDismiss = root::onBackClicked,
|
|
213
|
-
onPublish = { _, _ ->
|
|
214
|
-
scope.launch {
|
|
215
|
-
snackbarHostState.currentSnackbarData?.dismiss()
|
|
216
|
-
snackbarHostState.showSnackbar(message = createPostSuccessMessage)
|
|
217
|
-
}
|
|
218
|
-
scope.launch {
|
|
219
|
-
delay(3000)
|
|
220
|
-
snackbarHostState.currentSnackbarData?.dismiss()
|
|
221
|
-
}
|
|
222
|
-
root.onBackClicked()
|
|
223
|
-
},
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
@Composable
|
|
231
|
-
private fun CompactTabBar(
|
|
232
|
-
items: List<NavItem>,
|
|
233
|
-
activeDestination: MainDestination?,
|
|
234
|
-
) {
|
|
235
|
-
NavigationBar(
|
|
236
|
-
containerColor = MaterialTheme.colorScheme.surface,
|
|
237
|
-
contentColor = MaterialTheme.colorScheme.onSurface,
|
|
238
|
-
) {
|
|
239
|
-
items.forEach { item ->
|
|
240
|
-
NavigationBarItem(
|
|
241
|
-
selected = item.destination != null && item.destination == activeDestination,
|
|
242
|
-
onClick = item.onClick,
|
|
243
|
-
icon = item.icon,
|
|
244
|
-
label = { Text(stringResource(item.labelRes)) },
|
|
245
|
-
colors = NavigationBarItemDefaults.colors(
|
|
246
|
-
selectedIconColor = MaterialTheme.colorScheme.primary,
|
|
247
|
-
selectedTextColor = MaterialTheme.colorScheme.primary,
|
|
248
|
-
indicatorColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
249
|
-
),
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
@Composable
|
|
256
|
-
private fun ExpandedSidebar(
|
|
257
|
-
items: List<NavItem>,
|
|
258
|
-
activeDestination: MainDestination?,
|
|
259
|
-
) {
|
|
260
|
-
NavigationRail(
|
|
261
|
-
modifier = Modifier.fillMaxHeight(),
|
|
262
|
-
containerColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
263
|
-
) {
|
|
264
|
-
Column(
|
|
265
|
-
modifier = Modifier
|
|
266
|
-
.fillMaxHeight()
|
|
267
|
-
.padding(vertical = 16.dp, horizontal = 10.dp),
|
|
268
|
-
horizontalAlignment = Alignment.CenterHorizontally,
|
|
269
|
-
verticalArrangement = Arrangement.spacedBy(10.dp),
|
|
270
|
-
) {
|
|
271
|
-
items.forEach { item ->
|
|
272
|
-
val isActive = item.destination != null && item.destination == activeDestination
|
|
273
|
-
Surface(
|
|
274
|
-
modifier = Modifier
|
|
275
|
-
.width(92.dp)
|
|
276
|
-
.clickable(onClick = item.onClick),
|
|
277
|
-
shape = Shapes.RoundedCapPrimary,
|
|
278
|
-
color = if (isActive) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.surface,
|
|
279
|
-
contentColor = if (isActive) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurfaceVariant,
|
|
280
|
-
) {
|
|
281
|
-
Column(
|
|
282
|
-
modifier = Modifier
|
|
283
|
-
.fillMaxWidth()
|
|
284
|
-
.padding(horizontal = 8.dp, vertical = 12.dp),
|
|
285
|
-
horizontalAlignment = Alignment.CenterHorizontally,
|
|
286
|
-
verticalArrangement = Arrangement.spacedBy(6.dp),
|
|
287
|
-
) {
|
|
288
|
-
item.icon()
|
|
289
|
-
Text(
|
|
290
|
-
text = stringResource(item.labelRes),
|
|
291
|
-
style = MaterialTheme.typography.labelSmall,
|
|
292
|
-
textAlign = TextAlign.Center,
|
|
293
|
-
)
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
@Composable
|
|
302
|
-
private fun RenderChild(
|
|
303
|
-
child: RootComponent.Child,
|
|
304
|
-
root: RootComponent,
|
|
305
|
-
preferencesRepository: PreferencesRepository,
|
|
306
|
-
storeFactory: StoreFactory,
|
|
307
|
-
onNotificationRead: (String) -> Unit,
|
|
308
|
-
) {
|
|
309
|
-
when (child) {
|
|
310
|
-
is RootComponent.Child.Home -> HomeFeedScreen(
|
|
311
|
-
onPostClick = { postId -> root.onPostClicked(postId) },
|
|
312
|
-
onUserClick = { userId -> root.onUserClicked(userId) },
|
|
313
|
-
)
|
|
314
|
-
is RootComponent.Child.Discover -> DiscoverScreen(
|
|
315
|
-
onUserClick = { userId -> root.onUserClicked(userId) },
|
|
316
|
-
onSearchClick = { query -> root.onSearchClicked(query) },
|
|
317
|
-
)
|
|
318
|
-
is RootComponent.Child.CreatePost -> Unit
|
|
319
|
-
is RootComponent.Child.Notifications -> NotificationsScreen(
|
|
320
|
-
onNotificationRead = onNotificationRead,
|
|
321
|
-
)
|
|
322
|
-
is RootComponent.Child.MessagesInbox -> MessagesInboxScreen(
|
|
323
|
-
onConversationClick = { conversationId -> root.onConversationClicked(conversationId) },
|
|
324
|
-
)
|
|
325
|
-
is RootComponent.Child.Profile -> ProfileSelfScreen(
|
|
326
|
-
onEditProfileClick = root::onEditProfileClicked,
|
|
327
|
-
onPostClick = { postId -> root.onPostClicked(postId) },
|
|
328
|
-
onSettingsClick = root::onSettingsClicked,
|
|
329
|
-
)
|
|
330
|
-
is RootComponent.Child.PostDetail -> PostDetailScreen(
|
|
331
|
-
postId = child.postId,
|
|
332
|
-
onBackClick = root::onBackClicked,
|
|
333
|
-
onUserClick = { userId -> root.onUserClicked(userId) },
|
|
334
|
-
)
|
|
335
|
-
is RootComponent.Child.UserProfile -> UserProfileScreen(
|
|
336
|
-
userId = child.userId,
|
|
337
|
-
onBackClick = root::onBackClicked,
|
|
338
|
-
onPostClick = { postId -> root.onPostClicked(postId) },
|
|
339
|
-
)
|
|
340
|
-
is RootComponent.Child.SearchResults -> SearchResultsScreen(
|
|
341
|
-
query = child.query,
|
|
342
|
-
onBackClick = root::onBackClicked,
|
|
343
|
-
onPostClick = { postId -> root.onPostClicked(postId) },
|
|
344
|
-
onUserClick = { userId -> root.onUserClicked(userId) },
|
|
345
|
-
)
|
|
346
|
-
is RootComponent.Child.EditProfile -> EditProfileScreen(
|
|
347
|
-
onBackClick = root::onBackClicked,
|
|
348
|
-
)
|
|
349
|
-
is RootComponent.Child.ChatDetail -> ChatDetailScreen(
|
|
350
|
-
conversationId = child.conversationId,
|
|
351
|
-
onBackClick = root::onBackClicked,
|
|
352
|
-
)
|
|
353
|
-
is RootComponent.Child.Settings -> SettingsScreen(
|
|
354
|
-
onBackClick = root::onBackClicked,
|
|
355
|
-
onEditProfileClick = root::onEditProfileClicked,
|
|
356
|
-
preferencesRepository = preferencesRepository,
|
|
357
|
-
storeFactory = storeFactory,
|
|
358
|
-
)
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
private fun activeDestinationFor(child: RootComponent.Child): MainDestination? =
|
|
363
|
-
when (child) {
|
|
364
|
-
is RootComponent.Child.Home -> MainDestination.Home
|
|
365
|
-
is RootComponent.Child.Discover -> MainDestination.Discover
|
|
366
|
-
is RootComponent.Child.Notifications -> MainDestination.Notifications
|
|
367
|
-
is RootComponent.Child.Profile -> MainDestination.Profile
|
|
368
|
-
else -> null
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
@OptIn(ExperimentalMaterial3Api::class)
|
|
372
|
-
@Composable
|
|
373
|
-
fun PlaceholderScreen(title: String, onBack: () -> Unit) {
|
|
374
|
-
Scaffold(
|
|
375
|
-
topBar = {
|
|
376
|
-
TopAppBar(
|
|
377
|
-
title = { Text(title) },
|
|
378
|
-
navigationIcon = {
|
|
379
|
-
IconButton(onClick = onBack) {
|
|
380
|
-
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
)
|
|
384
|
-
}
|
|
385
|
-
) { padding ->
|
|
386
|
-
Box(modifier = Modifier.fillMaxSize().padding(padding), contentAlignment = Alignment.Center) {
|
|
387
|
-
Text("This screen is coming soon!", style = MaterialTheme.typography.bodyLarge)
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
package com.social.app.ui.components
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.BorderStroke
|
|
4
|
-
import androidx.compose.foundation.background
|
|
5
|
-
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.layout.*
|
|
7
|
-
import androidx.compose.foundation.lazy.LazyRow
|
|
8
|
-
import androidx.compose.foundation.lazy.items
|
|
9
|
-
import androidx.compose.material.icons.Icons
|
|
10
|
-
import androidx.compose.material.icons.filled.*
|
|
11
|
-
import androidx.compose.material.icons.outlined.*
|
|
12
|
-
import androidx.compose.material3.*
|
|
13
|
-
import androidx.compose.runtime.Composable
|
|
14
|
-
import androidx.compose.ui.Alignment
|
|
15
|
-
import androidx.compose.ui.Modifier
|
|
16
|
-
import androidx.compose.ui.draw.clip
|
|
17
|
-
import androidx.compose.ui.graphics.Color
|
|
18
|
-
import androidx.compose.ui.layout.ContentScale
|
|
19
|
-
import androidx.compose.ui.unit.dp
|
|
20
|
-
import coil3.compose.AsyncImage
|
|
21
|
-
import com.social.app.ui.theme.Shapes
|
|
22
|
-
import com.social.app.ui.theme.Spacing
|
|
23
|
-
|
|
24
|
-
@Composable
|
|
25
|
-
fun StoryItem(
|
|
26
|
-
name: String,
|
|
27
|
-
imageUrl: String?,
|
|
28
|
-
onClick: () -> Unit
|
|
29
|
-
) {
|
|
30
|
-
Column(
|
|
31
|
-
horizontalAlignment = Alignment.CenterHorizontally,
|
|
32
|
-
modifier = Modifier
|
|
33
|
-
.padding(end = Spacing.ListItemGap)
|
|
34
|
-
.clickable { onClick() }
|
|
35
|
-
) {
|
|
36
|
-
Box(
|
|
37
|
-
modifier = Modifier
|
|
38
|
-
.size(64.dp)
|
|
39
|
-
.clip(Shapes.RoundedCapPrimary)
|
|
40
|
-
.background(MaterialTheme.colorScheme.surfaceVariant)
|
|
41
|
-
) {
|
|
42
|
-
if (imageUrl != null) {
|
|
43
|
-
AsyncImage(
|
|
44
|
-
model = imageUrl,
|
|
45
|
-
contentDescription = null,
|
|
46
|
-
modifier = Modifier.fillMaxSize(),
|
|
47
|
-
contentScale = ContentScale.Crop
|
|
48
|
-
)
|
|
49
|
-
} else {
|
|
50
|
-
Icon(
|
|
51
|
-
Icons.Default.Person,
|
|
52
|
-
contentDescription = null,
|
|
53
|
-
modifier = Modifier.align(Alignment.Center)
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
Spacer(modifier = Modifier.height(Spacing.XS))
|
|
58
|
-
Text(
|
|
59
|
-
text = name,
|
|
60
|
-
style = MaterialTheme.typography.labelSmall,
|
|
61
|
-
maxLines = 1,
|
|
62
|
-
color = MaterialTheme.colorScheme.onSurface
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@OptIn(ExperimentalMaterial3Api::class)
|
|
68
|
-
@Composable
|
|
69
|
-
fun FilterChipRow(
|
|
70
|
-
selectedFilter: String,
|
|
71
|
-
onFilterSelected: (String) -> Unit
|
|
72
|
-
) {
|
|
73
|
-
val filters = listOf("all", "following", "popular")
|
|
74
|
-
LazyRow(
|
|
75
|
-
contentPadding = PaddingValues(horizontal = Spacing.MD),
|
|
76
|
-
horizontalArrangement = Arrangement.spacedBy(Spacing.SM)
|
|
77
|
-
) {
|
|
78
|
-
items(filters) { filter ->
|
|
79
|
-
FilterChip(
|
|
80
|
-
selected = selectedFilter == filter,
|
|
81
|
-
onClick = { onFilterSelected(filter) },
|
|
82
|
-
label = { Text(filter.replaceFirstChar { it.uppercase() }) },
|
|
83
|
-
shape = Shapes.RoundedCapPrimary,
|
|
84
|
-
colors = FilterChipDefaults.filterChipColors(
|
|
85
|
-
selectedContainerColor = MaterialTheme.colorScheme.secondary,
|
|
86
|
-
selectedLabelColor = MaterialTheme.colorScheme.onSecondary
|
|
87
|
-
),
|
|
88
|
-
border = FilterChipDefaults.filterChipBorder(
|
|
89
|
-
enabled = true,
|
|
90
|
-
selected = selectedFilter == filter,
|
|
91
|
-
borderColor = MaterialTheme.colorScheme.outline,
|
|
92
|
-
selectedBorderColor = Color.Transparent
|
|
93
|
-
)
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@Composable
|
|
100
|
-
fun PostItem(
|
|
101
|
-
authorName: String,
|
|
102
|
-
authorHandle: String,
|
|
103
|
-
authorAvatar: String? = null,
|
|
104
|
-
body: String,
|
|
105
|
-
likeCount: Int,
|
|
106
|
-
commentCount: Int,
|
|
107
|
-
timestamp: String,
|
|
108
|
-
mediaUrl: String? = null,
|
|
109
|
-
onAuthorClick: () -> Unit = {},
|
|
110
|
-
onLikeClick: () -> Unit = {},
|
|
111
|
-
onCommentClick: () -> Unit = {}
|
|
112
|
-
) {
|
|
113
|
-
Card(
|
|
114
|
-
modifier = Modifier
|
|
115
|
-
.fillMaxWidth()
|
|
116
|
-
.padding(horizontal = Spacing.MD, vertical = Spacing.XS),
|
|
117
|
-
shape = Shapes.CardShape,
|
|
118
|
-
colors = CardDefaults.cardColors(
|
|
119
|
-
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
|
120
|
-
),
|
|
121
|
-
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outline)
|
|
122
|
-
) {
|
|
123
|
-
Column(modifier = Modifier.padding(Spacing.MD)) {
|
|
124
|
-
Row(
|
|
125
|
-
verticalAlignment = Alignment.CenterVertically,
|
|
126
|
-
modifier = Modifier.clickable { onAuthorClick() }
|
|
127
|
-
) {
|
|
128
|
-
Box(
|
|
129
|
-
modifier = Modifier
|
|
130
|
-
.size(40.dp)
|
|
131
|
-
.clip(Shapes.RoundedCapPrimary)
|
|
132
|
-
.background(MaterialTheme.colorScheme.surface)
|
|
133
|
-
) {
|
|
134
|
-
if (authorAvatar != null) {
|
|
135
|
-
AsyncImage(
|
|
136
|
-
model = authorAvatar,
|
|
137
|
-
contentDescription = null,
|
|
138
|
-
modifier = Modifier.fillMaxSize(),
|
|
139
|
-
contentScale = ContentScale.Crop
|
|
140
|
-
)
|
|
141
|
-
} else {
|
|
142
|
-
Icon(
|
|
143
|
-
Icons.Default.Person,
|
|
144
|
-
contentDescription = null,
|
|
145
|
-
modifier = Modifier.align(Alignment.Center)
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
Spacer(modifier = Modifier.width(Spacing.SM))
|
|
150
|
-
Column {
|
|
151
|
-
Text(
|
|
152
|
-
text = authorName,
|
|
153
|
-
style = MaterialTheme.typography.headlineSmall,
|
|
154
|
-
color = MaterialTheme.colorScheme.onSurface
|
|
155
|
-
)
|
|
156
|
-
Text(
|
|
157
|
-
text = "@$authorHandle",
|
|
158
|
-
style = MaterialTheme.typography.bodyMedium,
|
|
159
|
-
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
Spacer(modifier = Modifier.weight(1f))
|
|
163
|
-
Text(
|
|
164
|
-
text = timestamp,
|
|
165
|
-
style = MaterialTheme.typography.labelSmall,
|
|
166
|
-
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
Spacer(modifier = Modifier.height(Spacing.SM))
|
|
171
|
-
Text(
|
|
172
|
-
text = body,
|
|
173
|
-
style = MaterialTheme.typography.bodyLarge,
|
|
174
|
-
color = MaterialTheme.colorScheme.onSurface
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
if (mediaUrl != null) {
|
|
178
|
-
Spacer(modifier = Modifier.height(Spacing.MD))
|
|
179
|
-
AsyncImage(
|
|
180
|
-
model = mediaUrl,
|
|
181
|
-
contentDescription = null,
|
|
182
|
-
modifier = Modifier
|
|
183
|
-
.fillMaxWidth()
|
|
184
|
-
.heightIn(max = 300.dp)
|
|
185
|
-
.clip(Shapes.CardShape)
|
|
186
|
-
.clickable { onCommentClick() }, // Open detail on image click too
|
|
187
|
-
contentScale = ContentScale.Crop
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
Spacer(modifier = Modifier.height(Spacing.MD))
|
|
192
|
-
Row(
|
|
193
|
-
horizontalArrangement = Arrangement.spacedBy(Spacing.LG),
|
|
194
|
-
verticalAlignment = Alignment.CenterVertically
|
|
195
|
-
) {
|
|
196
|
-
Row(
|
|
197
|
-
verticalAlignment = Alignment.CenterVertically,
|
|
198
|
-
modifier = Modifier.clickable { onLikeClick() }
|
|
199
|
-
) {
|
|
200
|
-
Icon(
|
|
201
|
-
Icons.Outlined.FavoriteBorder,
|
|
202
|
-
contentDescription = "Like",
|
|
203
|
-
modifier = Modifier.size(20.dp)
|
|
204
|
-
)
|
|
205
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
206
|
-
Text(text = likeCount.toString(), style = MaterialTheme.typography.bodyMedium)
|
|
207
|
-
}
|
|
208
|
-
Row(
|
|
209
|
-
verticalAlignment = Alignment.CenterVertically,
|
|
210
|
-
modifier = Modifier.clickable { onCommentClick() }
|
|
211
|
-
) {
|
|
212
|
-
Icon(
|
|
213
|
-
Icons.Outlined.ChatBubbleOutline,
|
|
214
|
-
contentDescription = "Comment",
|
|
215
|
-
modifier = Modifier.size(20.dp)
|
|
216
|
-
)
|
|
217
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
218
|
-
Text(text = commentCount.toString(), style = MaterialTheme.typography.bodyMedium)
|
|
219
|
-
}
|
|
220
|
-
Icon(
|
|
221
|
-
Icons.Outlined.Share,
|
|
222
|
-
contentDescription = "Share",
|
|
223
|
-
modifier = Modifier.size(20.dp).clickable { }
|
|
224
|
-
)
|
|
225
|
-
Spacer(modifier = Modifier.weight(1f))
|
|
226
|
-
Icon(
|
|
227
|
-
Icons.Outlined.BookmarkBorder,
|
|
228
|
-
contentDescription = "Save",
|
|
229
|
-
modifier = Modifier.size(20.dp).clickable { }
|
|
230
|
-
)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|