Skip to content

Commit

Permalink
Rename Phone/Mobile into SmallWindow & Tablet into LargeWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Sep 24, 2024
1 parent 5a86860 commit b8610f3
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import com.infomaniak.swisstransfer.ui.images.illus.LogoInfomaniak
import com.infomaniak.swisstransfer.ui.images.illus.LogoSwissTransfer
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
@OptIn(ExperimentalMaterial3Api::class)
Expand All @@ -58,8 +58,8 @@ fun BrandTobAppBar() {
)
}

@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun BrandTobAppBarPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.infomaniak.swisstransfer.ui.images.icons.Add
import com.infomaniak.swisstransfer.ui.images.icons.ArrowLeft
import com.infomaniak.swisstransfer.ui.images.icons.Cross
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -75,8 +75,8 @@ data class TopAppBarButton(
}
}

@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun SwissTransferTobAppBarPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.infomaniak.swisstransfer.ui.navigation.MainNavigation
import com.infomaniak.swisstransfer.ui.navigation.NavigationDestination.Companion.toDestination
import com.infomaniak.swisstransfer.ui.screen.main.components.MainScaffold
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun MainScreen() {
Expand All @@ -47,13 +47,13 @@ fun MainScreen() {
navController = navController,
currentDestination = currentDestination,
windowAdaptiveInfo = windowAdaptiveInfo,
tabletTopAppBar = { BrandTobAppBar() },
largeWindowTopAppBar = { BrandTobAppBar() },
content = { MainNavHost(navController, currentDestination, windowAdaptiveInfo) },
)
}

@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun MainScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fun BrandTobAppBarScaffold(
floatingActionButton: @Composable () -> Unit = {},
content: @Composable (PaddingValues) -> Unit,
) {
PhoneTopAppBarScaffold(
phoneTopAppBar = { BrandTobAppBar() },
SmallWindowTopAppBarScaffold(
smallWindowTopAppBar = { BrandTobAppBar() },
floatingActionButton = floatingActionButton,
content = content,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import com.infomaniak.swisstransfer.ui.components.BrandTobAppBar
import com.infomaniak.swisstransfer.ui.navigation.MainNavigation
import com.infomaniak.swisstransfer.ui.navigation.NavigationItem
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

val LocalNavType = staticCompositionLocalOf { NavigationSuiteType.None }

Expand All @@ -41,13 +41,13 @@ fun MainScaffold(
navController: NavHostController,
currentDestination: MainNavigation,
windowAdaptiveInfo: WindowAdaptiveInfo,
tabletTopAppBar: @Composable () -> Unit = {},
largeWindowTopAppBar: @Composable () -> Unit = {},
content: @Composable () -> Unit = {},
) {
val navType by rememberNavType(currentDestination, windowAdaptiveInfo)

CompositionLocalProvider(LocalNavType provides navType) {
MainScaffold(navType, currentDestination, navController::navigateToSelectedItem, tabletTopAppBar, content)
MainScaffold(navType, currentDestination, navController::navigateToSelectedItem, largeWindowTopAppBar, content)
}
}

Expand All @@ -56,11 +56,11 @@ private fun MainScaffold(
navType: NavigationSuiteType,
currentDestination: MainNavigation,
navigateToSelectedItem: (MainNavigation) -> Unit,
tabletTopAppBar: @Composable () -> Unit,
largeWindowTopAppBar: @Composable () -> Unit,
content: @Composable () -> Unit,
) {
Column {
if (navType == NavigationSuiteType.NavigationRail) tabletTopAppBar()
if (navType == NavigationSuiteType.NavigationRail) largeWindowTopAppBar()
AppNavigationSuiteScaffold(navType, NavigationItem.entries, currentDestination, navigateToSelectedItem) {
if (navType == NavigationSuiteType.None) {
content()
Expand Down Expand Up @@ -112,29 +112,29 @@ private fun NavHostController.navigateToSelectedItem(destination: MainNavigation
}
}

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun NavigationMobilePreview() {
private fun NavigationSmallWindowPreview() {
SwissTransferTheme {
MainScaffold(
currentDestination = MainNavigation.SentDestination,
navigateToSelectedItem = {},
navType = NavigationSuiteType.NavigationBar,
tabletTopAppBar = { BrandTobAppBar() },
largeWindowTopAppBar = { BrandTobAppBar() },
content = {},
)
}
}

@PreviewTablet
@PreviewLargeWindow
@Composable
private fun NavigationTabletPreview() {
private fun NavigationLargeWindowPreview() {
SwissTransferTheme {
MainScaffold(
currentDestination = MainNavigation.SentDestination,
navigateToSelectedItem = {},
navType = NavigationSuiteType.NavigationRail,
tabletTopAppBar = { BrandTobAppBar() },
largeWindowTopAppBar = { BrandTobAppBar() },
content = {},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType
import androidx.compose.runtime.Composable

@Composable
fun PhoneTopAppBarScaffold(
phoneTopAppBar: @Composable () -> Unit = {},
fun SmallWindowTopAppBarScaffold(
smallWindowTopAppBar: @Composable () -> Unit = {},
floatingActionButton: @Composable () -> Unit = {},
content: @Composable (PaddingValues) -> Unit,
) {
Scaffold(
topBar = { if (LocalNavType.current == NavigationSuiteType.NavigationBar) phoneTopAppBar() },
topBar = { if (LocalNavType.current == NavigationSuiteType.NavigationBar) smallWindowTopAppBar() },
floatingActionButton = floatingActionButton,
) { contentPadding ->
content(contentPadding)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import com.infomaniak.swisstransfer.ui.screen.main.components.BrandTobAppBarScaf
import com.infomaniak.swisstransfer.ui.screen.main.received.components.ReceivedEmptyFab
import com.infomaniak.swisstransfer.ui.screen.main.sent.SentViewModel
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun ReceivedScreen(
Expand All @@ -62,19 +62,10 @@ private fun ReceivedScreen(areTransfersEmpty: () -> Boolean) {
}
}

@PreviewMobile
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun ReceivedScreenMobilePreview() {
SwissTransferTheme {
Surface {
ReceivedScreen(areTransfersEmpty = { true })
}
}
}

@PreviewTablet
@Composable
private fun ReceivedScreenTabletPreview() {
private fun ReceivedScreenPreview() {
SwissTransferTheme {
Surface {
ReceivedScreen(areTransfersEmpty = { true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import com.infomaniak.swisstransfer.ui.images.illus.ArrowDownRightCurved
import com.infomaniak.swisstransfer.ui.theme.Dimens
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SentEmptyScreen(modifier: Modifier) {
Expand Down Expand Up @@ -85,8 +85,8 @@ fun SentEmptyScreen(modifier: Modifier) {
}
}

@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun SentEmptyScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow
import java.util.UUID

@Composable
Expand All @@ -39,8 +39,8 @@ fun SentListScreen(
}
}
}
@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun SentListScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import com.infomaniak.swisstransfer.ui.components.NewTransferFabType
import com.infomaniak.swisstransfer.ui.screen.main.components.BrandTobAppBarScaffold
import com.infomaniak.swisstransfer.ui.screen.main.components.LocalNavType
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SentScreen(
Expand Down Expand Up @@ -65,23 +65,10 @@ private fun SentScreen(navType: NavigationSuiteType, transfers: List<Any>?) {

}

@PreviewMobile
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun SentScreenMobilePreview() {
val navType = LocalNavType.current
SwissTransferTheme {
Surface {
SentScreen(
navType = navType,
transfers = emptyList(),
)
}
}
}

@PreviewTablet
@Composable
private fun SentScreenTabletPreview() {
private fun SentScreenPreview() {
val navType = LocalNavType.current
SwissTransferTheme {
Surface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.OptionScaffold
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsDownloadsLimitScreen(
Expand Down Expand Up @@ -54,7 +54,7 @@ enum class DownloadLimitOption(
ONE({ "1" }),
}

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun SettingsThemeScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.OptionScaffold
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsEmailLanguageScreen(
Expand Down Expand Up @@ -56,7 +56,7 @@ enum class EmailLanguageOption(
SPANISH({ stringResource(R.string.settingsEmailLanguageValueSpanish) }, imageVectorResId = R.drawable.flag_es),
}

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun SettingsThemeScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingIt
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingTitle
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsScreen(
Expand Down Expand Up @@ -190,7 +190,7 @@ private class DummyAppSettings(
override var validityPeriod: ValidityPeriod = ValidityPeriod.THIRTY,
) : AppSettings

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun SettingsScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ private fun NoSelectionEmptyState() {
}
}

@PreviewMobile
@PreviewTablet
@PreviewSmallWindow
@PreviewLargeWindow
@Composable
private fun SettingsScreenWrapperPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.infomaniak.swisstransfer.ui.images.icons.CircleWhite
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.OptionScaffold
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsThemeScreen(
Expand Down Expand Up @@ -58,7 +58,7 @@ enum class ThemeOption(
DARK({ stringResource(R.string.settingsOptionThemeDark) }, AppIcons.CircleBlack),
}

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun SettingsThemeScreenPreview() {
SwissTransferTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.OptionScaffold
import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsValidityPeriodScreen(
Expand Down Expand Up @@ -55,7 +55,7 @@ enum class ValidityPeriodOption(
ONE({ pluralStringResource(R.plurals.settingsValidityPeriodValue, 1, 1) }),
}

@PreviewMobile
@PreviewSmallWindow
@Composable
private fun SettingsThemeScreenPreview() {
SwissTransferTheme {
Expand Down
Loading

0 comments on commit b8610f3

Please sign in to comment.