Skip to content

Commit 7556121

Browse files
bmc08gtclaude
andauthored
refactor(lab): consolidate LabsScreen and move route to Menu (#785)
* refactor(theme): consolidate design system, remove legacy theme * fix(navigation): use qualifiedName strings for FlowHost saved state KClass references aren't serializable and can't survive rememberSaveable across process death. Use qualifiedName strings instead so the seeded-stack comparison works after restoration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(ui): relocate SearchBar to shared SearchInput component Move the currency-selection-local SearchBar into a shared, reusable SearchInput in ui/components. The placeholder is now a parameter, the shape is CircleShape, and the icon tint follows the theme. * refactor(lab): consolidate LabsScreen and move route to Menu Merge LabsScreen and StandaloneLabsScreen into a single composable that detects navigation context at runtime. Remove Sheets.Lab route (Menu.Lab already exists). Remove unused PreloadLabs composable. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7534461 commit 7556121

4 files changed

Lines changed: 21 additions & 41 deletions

File tree

apps/flipcash/app/src/main/kotlin/com/flipcash/app/internal/ui/navigation/AppScreenContent.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import com.flipcash.app.discovery.TokenDiscoveryScreen
3333
import com.flipcash.app.internal.ui.navigation.decorators.rememberNavMessagingEntryDecorator
3434
import com.flipcash.app.lab.LabsScreen
3535
import com.flipcash.app.lab.NavBarSettingsScreen
36-
import com.flipcash.app.lab.StandaloneLabsScreen
3736
import com.flipcash.app.login.OnboardingFlowScreen
3837
import com.flipcash.app.menu.MenuScreen
3938
import com.flipcash.app.myaccount.MyAccountScreen
@@ -88,7 +87,6 @@ fun appEntryProvider(
8887
annotatedEntry<AppRoute.Sheets.Wallet> { BalanceScreen() }
8988
annotatedEntry<AppRoute.Sheets.ShareApp> { ShareAppScreen() }
9089
annotatedEntry<AppRoute.Sheets.Menu> { MenuScreen() }
91-
annotatedEntry<AppRoute.Sheets.Lab> { StandaloneLabsScreen() }
9290

9391

9492
// Tokens

apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/AppRoute.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ sealed interface AppRoute : NavKey, Parcelable {
145145
data object Wallet : Sheets
146146
@Serializable
147147
data object Menu : Sheets
148-
@Serializable
149-
data object Lab : Sheets
150148

151149
@Serializable
152150
data object ShareApp : Sheets

apps/flipcash/features/lab/src/main/kotlin/com/flipcash/app/lab/LabsScreen.kt

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.flipcash.app.lab
33
import androidx.compose.foundation.layout.Column
44
import androidx.compose.foundation.layout.fillMaxSize
55
import androidx.compose.runtime.Composable
6+
import androidx.compose.runtime.remember
67
import androidx.compose.ui.Alignment
78
import androidx.compose.ui.Modifier
89
import androidx.compose.ui.res.stringResource
@@ -17,49 +18,32 @@ import com.getcode.ui.components.AppBarWithTitle
1718
@Composable
1819
fun LabsScreen() {
1920
val navigator = LocalCodeNavigator.current
20-
21-
Column(
22-
modifier = Modifier.fillMaxSize(),
23-
horizontalAlignment = Alignment.CenterHorizontally,
24-
) {
25-
AppBarWithTitle(
26-
title = stringResource(R.string.title_betaFlags),
27-
titleAlignment = Alignment.CenterHorizontally,
28-
backButton = true,
29-
isInModal = true,
30-
onBackIconClicked = navigator::pop
31-
)
32-
33-
val viewModel = getActivityScopedViewModel<LabsScreenViewModel>()
34-
35-
LabsScreenContent(viewModel)
36-
}
37-
}
38-
39-
@Composable
40-
fun StandaloneLabsScreen() {
41-
val navigator = LocalCodeNavigator.current
42-
21+
val isSheetRoot = remember { navigator.backStack.size <= 1 }
4322
Column(
4423
modifier = Modifier.fillMaxSize(),
4524
horizontalAlignment = Alignment.CenterHorizontally,
4625
) {
47-
AppBarWithTitle(
48-
title = stringResource(R.string.title_betaFlags),
49-
titleAlignment = Alignment.CenterHorizontally,
50-
isInModal = true,
51-
endContent = {
52-
AppBarDefaults.Close { navigator.hide() }
53-
}
54-
)
26+
if (isSheetRoot) {
27+
AppBarWithTitle(
28+
title = stringResource(R.string.title_betaFlags),
29+
titleAlignment = Alignment.CenterHorizontally,
30+
isInModal = true,
31+
endContent = {
32+
AppBarDefaults.Close { navigator.hide() }
33+
}
34+
)
35+
} else {
36+
AppBarWithTitle(
37+
title = stringResource(R.string.title_betaFlags),
38+
titleAlignment = Alignment.CenterHorizontally,
39+
backButton = true,
40+
isInModal = true,
41+
onBackIconClicked = navigator::pop
42+
)
43+
}
5544

5645
val viewModel = getActivityScopedViewModel<LabsScreenViewModel>()
5746

5847
LabsScreenContent(viewModel)
5948
}
6049
}
61-
62-
@Composable
63-
fun PreloadLabs() {
64-
val viewModel = getActivityScopedViewModel<LabsScreenViewModel>()
65-
}

apps/flipcash/features/login/src/main/kotlin/com/flipcash/app/login/OnboardingFlowScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ private fun LoginStepContent(seed: String?) {
353353
login = { flowNavigator.navigateTo(OnboardingStep.SeedInput) },
354354
isLabsOpen = state.betaOptionsVisible,
355355
onLogoTapped = { vm.dispatchEvent(LoginViewModel.Event.OnLogoTapped) },
356-
openBetaFlags = { outerNavigator.openAsSheet(AppRoute.Sheets.Lab) },
356+
openBetaFlags = { outerNavigator.openAsSheet(AppRoute.Menu.Lab) },
357357
)
358358
}
359359
}

0 commit comments

Comments
 (0)