openuispec 0.2.10 → 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 +4 -2
- package/cli/init.ts +23 -8
- package/docs/cli.md +13 -8
- package/drift/index.ts +41 -15
- package/mcp-server/index.ts +155 -116
- package/mcp-server/screenshot.ts +19 -4
- 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 -31
- 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 -439
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/xcshareddata/xcschemes/TodoOrbit.xcscheme +0 -89
- package/examples/todo-orbit/generated/ios/Todo Orbit/project.yml +0 -32
- 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,592 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
import type { LocaleCode, ThemePreference } from "../lib/tokens";
|
|
3
|
-
|
|
4
|
-
export type User = {
|
|
5
|
-
id: string;
|
|
6
|
-
handle: string;
|
|
7
|
-
displayName: string;
|
|
8
|
-
avatarUrl?: string;
|
|
9
|
-
bio?: string;
|
|
10
|
-
website?: string;
|
|
11
|
-
followers: number;
|
|
12
|
-
following: number;
|
|
13
|
-
isFollowed?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type Post = {
|
|
17
|
-
id: string;
|
|
18
|
-
authorId: string;
|
|
19
|
-
body: string;
|
|
20
|
-
mediaUrl?: string;
|
|
21
|
-
mediaType?: "image" | "video";
|
|
22
|
-
likeCount: number;
|
|
23
|
-
commentCount: number;
|
|
24
|
-
publishedAt: string;
|
|
25
|
-
liked?: boolean;
|
|
26
|
-
saved?: boolean;
|
|
27
|
-
tags: string[];
|
|
28
|
-
audience: string;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type Comment = {
|
|
32
|
-
id: string;
|
|
33
|
-
postId: string;
|
|
34
|
-
authorId: string;
|
|
35
|
-
body: string;
|
|
36
|
-
createdAt: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type Story = {
|
|
40
|
-
id: string;
|
|
41
|
-
authorId: string;
|
|
42
|
-
previewUrl?: string;
|
|
43
|
-
active: boolean;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type Trend = {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
postCount: number;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type Tag = {
|
|
53
|
-
id: string;
|
|
54
|
-
name: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type Conversation = {
|
|
58
|
-
id: string;
|
|
59
|
-
participantIds: string[];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type Message = {
|
|
63
|
-
id: string;
|
|
64
|
-
conversationId: string;
|
|
65
|
-
senderId: string;
|
|
66
|
-
body: string;
|
|
67
|
-
createdAt: string;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type NotificationItem = {
|
|
71
|
-
id: string;
|
|
72
|
-
type: string;
|
|
73
|
-
actorId?: string;
|
|
74
|
-
postId?: string;
|
|
75
|
-
message: string;
|
|
76
|
-
createdAt: string;
|
|
77
|
-
read: boolean;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type Preferences = {
|
|
81
|
-
theme: ThemePreference;
|
|
82
|
-
pushNotifications: boolean;
|
|
83
|
-
messagePreviews: boolean;
|
|
84
|
-
autoTranslate: boolean;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type DialogAction = {
|
|
88
|
-
label: string;
|
|
89
|
-
variant?: "secondary" | "destructive" | "primary";
|
|
90
|
-
onPress: () => void;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
type DialogState = {
|
|
94
|
-
title: string;
|
|
95
|
-
message: string;
|
|
96
|
-
actions: DialogAction[];
|
|
97
|
-
} | null;
|
|
98
|
-
|
|
99
|
-
type ToastState = {
|
|
100
|
-
message: string;
|
|
101
|
-
} | null;
|
|
102
|
-
|
|
103
|
-
type AppState = {
|
|
104
|
-
locale: LocaleCode;
|
|
105
|
-
currentUserId: string;
|
|
106
|
-
users: User[];
|
|
107
|
-
posts: Post[];
|
|
108
|
-
comments: Comment[];
|
|
109
|
-
stories: Story[];
|
|
110
|
-
trends: Trend[];
|
|
111
|
-
tags: Tag[];
|
|
112
|
-
conversations: Conversation[];
|
|
113
|
-
messages: Message[];
|
|
114
|
-
notifications: NotificationItem[];
|
|
115
|
-
preferences: Preferences;
|
|
116
|
-
toast: ToastState;
|
|
117
|
-
dialog: DialogState;
|
|
118
|
-
setLocale: (locale: LocaleCode) => void;
|
|
119
|
-
setThemePreference: (theme: ThemePreference) => void;
|
|
120
|
-
showToast: (message: string) => void;
|
|
121
|
-
clearToast: () => void;
|
|
122
|
-
openDialog: (dialog: Exclude<DialogState, null>) => void;
|
|
123
|
-
closeDialog: () => void;
|
|
124
|
-
toggleLike: (postId: string) => void;
|
|
125
|
-
toggleSave: (postId: string) => void;
|
|
126
|
-
createPost: (input: { body: string; media: string; audience: string }) => string;
|
|
127
|
-
addComment: (postId: string, body: string) => void;
|
|
128
|
-
updateProfile: (input: { displayName: string; handle: string; bio: string; website: string }) => void;
|
|
129
|
-
followUser: (userId: string) => void;
|
|
130
|
-
sendMessage: (conversationId: string, body: string) => void;
|
|
131
|
-
markNotificationRead: (notificationId: string) => void;
|
|
132
|
-
updatePreference: <K extends keyof Preferences>(key: K, value: Preferences[K]) => void;
|
|
133
|
-
logout: () => void;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
function minutesAgo(value: number) {
|
|
137
|
-
return new Date(Date.now() - value * 60 * 1000).toISOString();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function hoursAgo(value: number) {
|
|
141
|
-
return new Date(Date.now() - value * 60 * 60 * 1000).toISOString();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function daysAgo(value: number) {
|
|
145
|
-
return new Date(Date.now() - value * 24 * 60 * 60 * 1000).toISOString();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function makeId(prefix: string) {
|
|
149
|
-
return `${prefix}-${Math.random().toString(36).slice(2, 8)}`;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const seedUsers: User[] = [
|
|
153
|
-
{
|
|
154
|
-
id: "user-me",
|
|
155
|
-
handle: "rustam",
|
|
156
|
-
displayName: "Rustam Abdurahmonov",
|
|
157
|
-
avatarUrl: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=320&q=80",
|
|
158
|
-
bio: "Designing interface systems that feel editorial, human, and alive.",
|
|
159
|
-
website: "https://example.com",
|
|
160
|
-
followers: 1240,
|
|
161
|
-
following: 184,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: "user-lina",
|
|
165
|
-
handle: "linaframes",
|
|
166
|
-
displayName: "Lina Morales",
|
|
167
|
-
avatarUrl: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=320&q=80",
|
|
168
|
-
bio: "Photographer collecting small city rituals and late-night color palettes.",
|
|
169
|
-
website: "https://lina.example.com",
|
|
170
|
-
followers: 18920,
|
|
171
|
-
following: 502,
|
|
172
|
-
isFollowed: true,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
id: "user-yuki",
|
|
176
|
-
handle: "yuki.codes",
|
|
177
|
-
displayName: "Yuki Tan",
|
|
178
|
-
avatarUrl: "https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?auto=format&fit=crop&w=320&q=80",
|
|
179
|
-
bio: "Front-end engineer obsessed with motion systems, type, and tiny details.",
|
|
180
|
-
website: "https://yuki.example.com",
|
|
181
|
-
followers: 9540,
|
|
182
|
-
following: 121,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: "user-samira",
|
|
186
|
-
handle: "samirastudio",
|
|
187
|
-
displayName: "Samira Noor",
|
|
188
|
-
avatarUrl: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&w=320&q=80",
|
|
189
|
-
bio: "Creative director building warm digital products for cultural brands.",
|
|
190
|
-
website: "https://samira.example.com",
|
|
191
|
-
followers: 30210,
|
|
192
|
-
following: 86,
|
|
193
|
-
isFollowed: true,
|
|
194
|
-
},
|
|
195
|
-
];
|
|
196
|
-
|
|
197
|
-
const seedPosts: Post[] = [
|
|
198
|
-
{
|
|
199
|
-
id: "post-1",
|
|
200
|
-
authorId: "user-lina",
|
|
201
|
-
body: "Spent the morning photographing a cafe before it opened. The cups were already warm, the chairs still slightly crooked. Those in-between moments always feel the most honest.",
|
|
202
|
-
mediaUrl: "https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?auto=format&fit=crop&w=1200&q=80",
|
|
203
|
-
mediaType: "image",
|
|
204
|
-
likeCount: 243,
|
|
205
|
-
commentCount: 12,
|
|
206
|
-
publishedAt: hoursAgo(4),
|
|
207
|
-
liked: true,
|
|
208
|
-
saved: false,
|
|
209
|
-
tags: ["coffee", "photojournal"],
|
|
210
|
-
audience: "public",
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: "post-2",
|
|
214
|
-
authorId: "user-yuki",
|
|
215
|
-
body: "A small interaction detail I keep coming back to: buttons that feel directional. Diagonal corners create a subtle sense of movement before anything even animates.",
|
|
216
|
-
mediaUrl: "https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80",
|
|
217
|
-
mediaType: "image",
|
|
218
|
-
likeCount: 189,
|
|
219
|
-
commentCount: 29,
|
|
220
|
-
publishedAt: hoursAgo(9),
|
|
221
|
-
liked: false,
|
|
222
|
-
saved: true,
|
|
223
|
-
tags: ["ui", "motion"],
|
|
224
|
-
audience: "public",
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
id: "post-3",
|
|
228
|
-
authorId: "user-me",
|
|
229
|
-
body: "Prototype of a warm-tone social feed. I wanted the interface to feel like printed paper meeting live conversation.",
|
|
230
|
-
mediaUrl: "https://images.unsplash.com/photo-1516321497487-e288fb19713f?auto=format&fit=crop&w=1200&q=80",
|
|
231
|
-
mediaType: "image",
|
|
232
|
-
likeCount: 76,
|
|
233
|
-
commentCount: 7,
|
|
234
|
-
publishedAt: daysAgo(1),
|
|
235
|
-
liked: false,
|
|
236
|
-
saved: false,
|
|
237
|
-
tags: ["prototype", "social"],
|
|
238
|
-
audience: "followers",
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
id: "post-4",
|
|
242
|
-
authorId: "user-samira",
|
|
243
|
-
body: "The brand workshop rule today: if the interface can be described as 'clean' and nothing else, it's probably unfinished.",
|
|
244
|
-
mediaUrl: "https://images.unsplash.com/photo-1524758631624-e2822e304c36?auto=format&fit=crop&w=1200&q=80",
|
|
245
|
-
mediaType: "image",
|
|
246
|
-
likeCount: 512,
|
|
247
|
-
commentCount: 61,
|
|
248
|
-
publishedAt: daysAgo(2),
|
|
249
|
-
liked: false,
|
|
250
|
-
saved: true,
|
|
251
|
-
tags: ["branding", "critique"],
|
|
252
|
-
audience: "public",
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
id: "post-5",
|
|
256
|
-
authorId: "user-lina",
|
|
257
|
-
body: "Testing a grid of street signs for an upcoming print set. The typography in the wild is still the best teacher.",
|
|
258
|
-
mediaUrl: "https://images.unsplash.com/photo-1487014679447-9f8336841d58?auto=format&fit=crop&w=1200&q=80",
|
|
259
|
-
mediaType: "image",
|
|
260
|
-
likeCount: 134,
|
|
261
|
-
commentCount: 18,
|
|
262
|
-
publishedAt: daysAgo(3),
|
|
263
|
-
liked: true,
|
|
264
|
-
saved: true,
|
|
265
|
-
tags: ["typography", "street"],
|
|
266
|
-
audience: "public",
|
|
267
|
-
},
|
|
268
|
-
];
|
|
269
|
-
|
|
270
|
-
const seedComments: Comment[] = [
|
|
271
|
-
{ id: "comment-1", postId: "post-1", authorId: "user-yuki", body: "That crooked-chair detail is perfect.", createdAt: hoursAgo(3) },
|
|
272
|
-
{ id: "comment-2", postId: "post-1", authorId: "user-me", body: "You always make spaces feel cinematic.", createdAt: hoursAgo(2) },
|
|
273
|
-
{ id: "comment-3", postId: "post-2", authorId: "user-samira", body: "Exactly. Shape language carries tone before copy does.", createdAt: hoursAgo(5) },
|
|
274
|
-
];
|
|
275
|
-
|
|
276
|
-
const seedStories: Story[] = [
|
|
277
|
-
{ id: "post-1", authorId: "user-lina", previewUrl: seedPosts[0].mediaUrl, active: true },
|
|
278
|
-
{ id: "post-2", authorId: "user-yuki", previewUrl: seedPosts[1].mediaUrl, active: true },
|
|
279
|
-
{ id: "post-4", authorId: "user-samira", previewUrl: seedPosts[3].mediaUrl, active: true },
|
|
280
|
-
{ id: "post-3", authorId: "user-me", previewUrl: seedPosts[2].mediaUrl, active: true },
|
|
281
|
-
];
|
|
282
|
-
|
|
283
|
-
const seedTrends: Trend[] = [
|
|
284
|
-
{ id: "trend-1", label: "Editorial UI", postCount: 8420 },
|
|
285
|
-
{ id: "trend-2", label: "Warm Brutalism", postCount: 4135 },
|
|
286
|
-
{ id: "trend-3", label: "Motion Details", postCount: 2940 },
|
|
287
|
-
{ id: "trend-4", label: "Design Systems", postCount: 8677 },
|
|
288
|
-
];
|
|
289
|
-
|
|
290
|
-
const seedTags: Tag[] = [
|
|
291
|
-
{ id: "tag-1", name: "socialui" },
|
|
292
|
-
{ id: "tag-2", name: "motionlanguage" },
|
|
293
|
-
{ id: "tag-3", name: "warmminimalism" },
|
|
294
|
-
{ id: "tag-4", name: "designcrit" },
|
|
295
|
-
{ id: "tag-5", name: "feedpatterns" },
|
|
296
|
-
];
|
|
297
|
-
|
|
298
|
-
const seedConversations: Conversation[] = [
|
|
299
|
-
{ id: "conversation-1", participantIds: ["user-me", "user-lina"] },
|
|
300
|
-
{ id: "conversation-2", participantIds: ["user-me", "user-yuki"] },
|
|
301
|
-
{ id: "conversation-3", participantIds: ["user-me", "user-samira"] },
|
|
302
|
-
];
|
|
303
|
-
|
|
304
|
-
const seedMessages: Message[] = [
|
|
305
|
-
{ id: "message-1", conversationId: "conversation-1", senderId: "user-lina", body: "Can you send the type ramp screenshot?", createdAt: hoursAgo(6) },
|
|
306
|
-
{ id: "message-2", conversationId: "conversation-1", senderId: "user-me", body: "Uploading it now. The mobile spacing changed a bit too.", createdAt: hoursAgo(5) },
|
|
307
|
-
{ id: "message-3", conversationId: "conversation-2", senderId: "user-yuki", body: "The diagonal buttons are a strong move. Keep them.", createdAt: hoursAgo(12) },
|
|
308
|
-
{ id: "message-4", conversationId: "conversation-3", senderId: "user-samira", body: "Let's review the brand deck tomorrow afternoon.", createdAt: daysAgo(1) },
|
|
309
|
-
];
|
|
310
|
-
|
|
311
|
-
const seedNotifications: NotificationItem[] = [
|
|
312
|
-
{ id: "notification-1", type: "like", actorId: "user-lina", postId: "post-3", message: "liked your post", createdAt: minutesAgo(34), read: false },
|
|
313
|
-
{ id: "notification-2", type: "comment", actorId: "user-yuki", postId: "post-3", message: "commented on your post", createdAt: hoursAgo(7), read: false },
|
|
314
|
-
{ id: "notification-3", type: "follow", actorId: "user-samira", message: "started following you", createdAt: daysAgo(1), read: true },
|
|
315
|
-
];
|
|
316
|
-
|
|
317
|
-
const seedPreferences: Preferences = {
|
|
318
|
-
theme: "system",
|
|
319
|
-
pushNotifications: true,
|
|
320
|
-
messagePreviews: true,
|
|
321
|
-
autoTranslate: false,
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
export const useAppStore = create<AppState>((set, get) => ({
|
|
325
|
-
locale: "en",
|
|
326
|
-
currentUserId: "user-me",
|
|
327
|
-
users: seedUsers,
|
|
328
|
-
posts: seedPosts,
|
|
329
|
-
comments: seedComments,
|
|
330
|
-
stories: seedStories,
|
|
331
|
-
trends: seedTrends,
|
|
332
|
-
tags: seedTags,
|
|
333
|
-
conversations: seedConversations,
|
|
334
|
-
messages: seedMessages,
|
|
335
|
-
notifications: seedNotifications,
|
|
336
|
-
preferences: seedPreferences,
|
|
337
|
-
toast: null,
|
|
338
|
-
dialog: null,
|
|
339
|
-
setLocale: (locale) => set({ locale }),
|
|
340
|
-
setThemePreference: (theme) => set((state) => ({ preferences: { ...state.preferences, theme } })),
|
|
341
|
-
showToast: (message) => set({ toast: { message } }),
|
|
342
|
-
clearToast: () => set({ toast: null }),
|
|
343
|
-
openDialog: (dialog) => set({ dialog }),
|
|
344
|
-
closeDialog: () => set({ dialog: null }),
|
|
345
|
-
toggleLike: (postId) =>
|
|
346
|
-
set((state) => ({
|
|
347
|
-
posts: state.posts.map((post) =>
|
|
348
|
-
post.id === postId
|
|
349
|
-
? {
|
|
350
|
-
...post,
|
|
351
|
-
liked: !post.liked,
|
|
352
|
-
likeCount: post.likeCount + (post.liked ? -1 : 1),
|
|
353
|
-
}
|
|
354
|
-
: post,
|
|
355
|
-
),
|
|
356
|
-
})),
|
|
357
|
-
toggleSave: (postId) =>
|
|
358
|
-
set((state) => ({
|
|
359
|
-
posts: state.posts.map((post) => (post.id === postId ? { ...post, saved: !post.saved } : post)),
|
|
360
|
-
})),
|
|
361
|
-
createPost: ({ body, media, audience }) => {
|
|
362
|
-
const id = makeId("post");
|
|
363
|
-
set((state) => ({
|
|
364
|
-
posts: [
|
|
365
|
-
{
|
|
366
|
-
id,
|
|
367
|
-
authorId: state.currentUserId,
|
|
368
|
-
body,
|
|
369
|
-
mediaUrl: media || undefined,
|
|
370
|
-
mediaType: media ? "image" : undefined,
|
|
371
|
-
likeCount: 0,
|
|
372
|
-
commentCount: 0,
|
|
373
|
-
publishedAt: new Date().toISOString(),
|
|
374
|
-
liked: false,
|
|
375
|
-
saved: false,
|
|
376
|
-
tags: body
|
|
377
|
-
.split(/\s+/)
|
|
378
|
-
.filter((chunk) => chunk.startsWith("#"))
|
|
379
|
-
.map((chunk) => chunk.replace("#", "").toLowerCase()),
|
|
380
|
-
audience,
|
|
381
|
-
},
|
|
382
|
-
...state.posts,
|
|
383
|
-
],
|
|
384
|
-
}));
|
|
385
|
-
return id;
|
|
386
|
-
},
|
|
387
|
-
addComment: (postId, body) =>
|
|
388
|
-
set((state) => ({
|
|
389
|
-
comments: [
|
|
390
|
-
...state.comments,
|
|
391
|
-
{ id: makeId("comment"), postId, authorId: state.currentUserId, body, createdAt: new Date().toISOString() },
|
|
392
|
-
],
|
|
393
|
-
posts: state.posts.map((post) => (post.id === postId ? { ...post, commentCount: post.commentCount + 1 } : post)),
|
|
394
|
-
})),
|
|
395
|
-
updateProfile: ({ displayName, handle, bio, website }) =>
|
|
396
|
-
set((state) => ({
|
|
397
|
-
users: state.users.map((user) =>
|
|
398
|
-
user.id === state.currentUserId ? { ...user, displayName, handle, bio, website } : user,
|
|
399
|
-
),
|
|
400
|
-
})),
|
|
401
|
-
followUser: (userId) =>
|
|
402
|
-
set((state) => ({
|
|
403
|
-
users: state.users.map((user) =>
|
|
404
|
-
user.id === userId
|
|
405
|
-
? {
|
|
406
|
-
...user,
|
|
407
|
-
isFollowed: !user.isFollowed,
|
|
408
|
-
followers: user.followers + (user.isFollowed ? -1 : 1),
|
|
409
|
-
}
|
|
410
|
-
: user,
|
|
411
|
-
),
|
|
412
|
-
})),
|
|
413
|
-
sendMessage: (conversationId, body) =>
|
|
414
|
-
set((state) => ({
|
|
415
|
-
messages: [
|
|
416
|
-
...state.messages,
|
|
417
|
-
{ id: makeId("message"), conversationId, senderId: state.currentUserId, body, createdAt: new Date().toISOString() },
|
|
418
|
-
],
|
|
419
|
-
})),
|
|
420
|
-
markNotificationRead: (notificationId) =>
|
|
421
|
-
set((state) => ({
|
|
422
|
-
notifications: state.notifications.map((item) => (item.id === notificationId ? { ...item, read: true } : item)),
|
|
423
|
-
})),
|
|
424
|
-
updatePreference: (key, value) =>
|
|
425
|
-
set((state) => ({
|
|
426
|
-
preferences: { ...state.preferences, [key]: value },
|
|
427
|
-
})),
|
|
428
|
-
logout: () => {
|
|
429
|
-
get().showToast("Local session cleared.");
|
|
430
|
-
},
|
|
431
|
-
}));
|
|
432
|
-
|
|
433
|
-
export function selectCurrentUser(state: AppState) {
|
|
434
|
-
return state.users.find((user) => user.id === state.currentUserId) ?? state.users[0];
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export function selectUserById(state: AppState, userId: string) {
|
|
438
|
-
return state.users.find((user) => user.id === userId);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
export function selectFeed(state: AppState, filter: "all" | "following" | "popular", search: string) {
|
|
442
|
-
const lowered = search.trim().toLowerCase();
|
|
443
|
-
return state.posts
|
|
444
|
-
.filter((post) => {
|
|
445
|
-
if (filter === "following") {
|
|
446
|
-
const author = selectUserById(state, post.authorId);
|
|
447
|
-
return author?.isFollowed || post.authorId === state.currentUserId;
|
|
448
|
-
}
|
|
449
|
-
if (filter === "popular") {
|
|
450
|
-
return post.likeCount >= 150;
|
|
451
|
-
}
|
|
452
|
-
return true;
|
|
453
|
-
})
|
|
454
|
-
.filter((post) => {
|
|
455
|
-
if (!lowered) {
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
const author = selectUserById(state, post.authorId);
|
|
459
|
-
return (
|
|
460
|
-
post.body.toLowerCase().includes(lowered) ||
|
|
461
|
-
author?.displayName.toLowerCase().includes(lowered) ||
|
|
462
|
-
post.tags.some((tag) => tag.includes(lowered))
|
|
463
|
-
);
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
export function selectStories(state: AppState) {
|
|
468
|
-
return state.stories
|
|
469
|
-
.filter((story) => story.active)
|
|
470
|
-
.map((story) => ({
|
|
471
|
-
...story,
|
|
472
|
-
author: selectUserById(state, story.authorId),
|
|
473
|
-
}))
|
|
474
|
-
.filter((story) => story.author);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
export function selectPostById(state: AppState, postId: string) {
|
|
478
|
-
return state.posts.find((post) => post.id === postId);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
export function selectCommentsByPost(state: AppState, postId: string) {
|
|
482
|
-
return state.comments.filter((comment) => comment.postId === postId);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
export function selectProfilePosts(state: AppState, userId: string) {
|
|
486
|
-
return state.posts.filter((post) => post.authorId === userId);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
export function selectConversationById(state: AppState, conversationId: string) {
|
|
490
|
-
return state.conversations.find((conversation) => conversation.id === conversationId);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
export function selectMessagesByConversation(state: AppState, conversationId: string) {
|
|
494
|
-
return state.messages.filter((message) => message.conversationId === conversationId);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
export function selectConversations(state: AppState, search: string) {
|
|
498
|
-
const lowered = search.trim().toLowerCase();
|
|
499
|
-
return state.conversations
|
|
500
|
-
.map((conversation) => {
|
|
501
|
-
const participant = state.users.find(
|
|
502
|
-
(user) => conversation.participantIds.includes(user.id) && user.id !== state.currentUserId,
|
|
503
|
-
);
|
|
504
|
-
const messages = selectMessagesByConversation(state, conversation.id);
|
|
505
|
-
const lastMessage = messages[messages.length - 1];
|
|
506
|
-
const unreadCount =
|
|
507
|
-
lastMessage && lastMessage.senderId !== state.currentUserId ? Math.min(2, messages.length) : 0;
|
|
508
|
-
return { conversation, participant, lastMessage, unreadCount };
|
|
509
|
-
})
|
|
510
|
-
.filter((item) => item.participant)
|
|
511
|
-
.filter((item) => {
|
|
512
|
-
if (!lowered) {
|
|
513
|
-
return true;
|
|
514
|
-
}
|
|
515
|
-
return (
|
|
516
|
-
item.participant?.displayName.toLowerCase().includes(lowered) ||
|
|
517
|
-
item.lastMessage?.body.toLowerCase().includes(lowered)
|
|
518
|
-
);
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
export function selectNotifications(state: AppState) {
|
|
523
|
-
return state.notifications.map((notification) => ({
|
|
524
|
-
...notification,
|
|
525
|
-
actor: notification.actorId ? selectUserById(state, notification.actorId) : undefined,
|
|
526
|
-
}));
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
export function selectUnreadNotifications(state: AppState) {
|
|
530
|
-
return state.notifications.filter((item) => !item.read).length;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export function selectDiscoverCreators(state: AppState) {
|
|
534
|
-
return state.users.filter((user) => user.id !== state.currentUserId);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
export function selectSearchResults(state: AppState, query: string, tab: "posts" | "people" | "tags") {
|
|
538
|
-
const lowered = query.trim().toLowerCase();
|
|
539
|
-
if (!lowered) {
|
|
540
|
-
return [];
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (tab === "people") {
|
|
544
|
-
return state.users
|
|
545
|
-
.filter(
|
|
546
|
-
(user) =>
|
|
547
|
-
user.displayName.toLowerCase().includes(lowered) || user.handle.toLowerCase().includes(lowered),
|
|
548
|
-
)
|
|
549
|
-
.map((user) => ({
|
|
550
|
-
id: user.id,
|
|
551
|
-
title: user.displayName,
|
|
552
|
-
subtitle: `@${user.handle}`,
|
|
553
|
-
body: user.bio ?? "",
|
|
554
|
-
avatarUrl: user.avatarUrl,
|
|
555
|
-
kind: "people" as const,
|
|
556
|
-
}));
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (tab === "tags") {
|
|
560
|
-
return state.tags
|
|
561
|
-
.filter((tag) => tag.name.toLowerCase().includes(lowered))
|
|
562
|
-
.map((tag) => {
|
|
563
|
-
const relatedPost = state.posts.find((post) => post.tags.includes(tag.name)) ?? state.posts[0];
|
|
564
|
-
return {
|
|
565
|
-
id: relatedPost.id,
|
|
566
|
-
title: `#${tag.name}`,
|
|
567
|
-
subtitle: "Tag",
|
|
568
|
-
body: `Browse posts connected to #${tag.name}.`,
|
|
569
|
-
avatarUrl: undefined,
|
|
570
|
-
kind: "tags" as const,
|
|
571
|
-
};
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
return state.posts
|
|
576
|
-
.filter(
|
|
577
|
-
(post) =>
|
|
578
|
-
post.body.toLowerCase().includes(lowered) ||
|
|
579
|
-
post.tags.some((tag) => tag.toLowerCase().includes(lowered)),
|
|
580
|
-
)
|
|
581
|
-
.map((post) => {
|
|
582
|
-
const author = selectUserById(state, post.authorId);
|
|
583
|
-
return {
|
|
584
|
-
id: post.id,
|
|
585
|
-
title: author?.displayName ?? "Unknown",
|
|
586
|
-
subtitle: author ? `@${author.handle}` : "",
|
|
587
|
-
body: post.body,
|
|
588
|
-
avatarUrl: author?.avatarUrl,
|
|
589
|
-
kind: "posts" as const,
|
|
590
|
-
};
|
|
591
|
-
});
|
|
592
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap");
|
|
2
|
-
@import "tailwindcss";
|
|
3
|
-
|
|
4
|
-
:root {
|
|
5
|
-
--font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
|
|
6
|
-
--color-brand-primary: #1c1b1a;
|
|
7
|
-
--color-brand-primary-on: #ffffff;
|
|
8
|
-
--color-brand-accent: #5b52a3;
|
|
9
|
-
--color-brand-accent-on: #ffffff;
|
|
10
|
-
--color-surface-primary: #faf8f5;
|
|
11
|
-
--color-surface-secondary: #f3f0eb;
|
|
12
|
-
--color-surface-tertiary: #ebe7e0;
|
|
13
|
-
--color-text-primary: #1c1b1a;
|
|
14
|
-
--color-text-secondary: #6b6966;
|
|
15
|
-
--color-text-tertiary: #9e9a95;
|
|
16
|
-
--color-border-default: #e0dcd6;
|
|
17
|
-
--color-border-strong: #c5c0b8;
|
|
18
|
-
--color-semantic-danger: #d43b3b;
|
|
19
|
-
--color-semantic-danger-on: #ffffff;
|
|
20
|
-
color-scheme: light;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:root[data-theme="dark"] {
|
|
24
|
-
--color-surface-primary: #1c1b1a;
|
|
25
|
-
--color-surface-secondary: #262422;
|
|
26
|
-
--color-surface-tertiary: #34312d;
|
|
27
|
-
--color-text-primary: #faf8f5;
|
|
28
|
-
--color-text-secondary: #c1bab0;
|
|
29
|
-
--color-text-tertiary: #8c847b;
|
|
30
|
-
--color-border-default: rgba(224, 220, 214, 0.12);
|
|
31
|
-
--color-border-strong: rgba(224, 220, 214, 0.24);
|
|
32
|
-
color-scheme: dark;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@theme inline {
|
|
36
|
-
--font-family-sans: var(--font-sans);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
html,
|
|
40
|
-
body,
|
|
41
|
-
#root {
|
|
42
|
-
min-height: 100%;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
body {
|
|
46
|
-
margin: 0;
|
|
47
|
-
font-family: var(--font-sans);
|
|
48
|
-
background:
|
|
49
|
-
radial-gradient(circle at top left, rgba(91, 82, 163, 0.08), transparent 28%),
|
|
50
|
-
linear-gradient(180deg, rgba(250, 248, 245, 0.8), rgba(250, 248, 245, 1));
|
|
51
|
-
color: var(--color-text-primary);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
a {
|
|
55
|
-
color: inherit;
|
|
56
|
-
text-decoration: none;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
button,
|
|
60
|
-
input,
|
|
61
|
-
select,
|
|
62
|
-
textarea {
|
|
63
|
-
font: inherit;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.rounded-cap-primary {
|
|
67
|
-
border-radius: 2px 24px 2px 24px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.rounded-cap-alternate {
|
|
71
|
-
border-radius: 24px 2px 24px 2px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.rounded-card {
|
|
75
|
-
border-radius: 3px 20px 3px 20px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.rounded-surface {
|
|
79
|
-
border-radius: 3px 24px 3px 24px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.interactive-press {
|
|
83
|
-
transition:
|
|
84
|
-
transform 200ms ease-out,
|
|
85
|
-
background-color 200ms ease-out,
|
|
86
|
-
border-color 200ms ease-out,
|
|
87
|
-
color 200ms ease-out;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.interactive-press:active {
|
|
91
|
-
transform: scale(0.98);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.skeleton {
|
|
95
|
-
position: relative;
|
|
96
|
-
overflow: hidden;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.skeleton::after {
|
|
100
|
-
position: absolute;
|
|
101
|
-
inset: 0;
|
|
102
|
-
transform: translateX(-100%);
|
|
103
|
-
background: linear-gradient(
|
|
104
|
-
90deg,
|
|
105
|
-
transparent,
|
|
106
|
-
rgba(255, 255, 255, 0.45),
|
|
107
|
-
transparent
|
|
108
|
-
);
|
|
109
|
-
animation: skeleton-shimmer 1.4s ease-out infinite;
|
|
110
|
-
content: "";
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.no-scrollbar {
|
|
114
|
-
scrollbar-width: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.no-scrollbar::-webkit-scrollbar {
|
|
118
|
-
display: none;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@keyframes skeleton-shimmer {
|
|
122
|
-
100% {
|
|
123
|
-
transform: translateX(100%);
|
|
124
|
-
}
|
|
125
|
-
}
|