diff --git a/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Instances.kt b/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Instances.kt index 3f7882d..f3c71c0 100644 --- a/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Instances.kt +++ b/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Instances.kt @@ -2,6 +2,7 @@ package eu.m724.vastapp.activity.dashboard.screen import androidx.activity.ComponentActivity import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ContextualFlowRow import androidx.compose.foundation.layout.ExperimentalLayoutApi @@ -30,6 +31,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import eu.m724.vastapp.R @@ -47,23 +49,36 @@ fun InstancesScreen(dashboardViewModel: DashboardViewModel) { // TODO actually get instances - ContextualFlowRow( - modifier = Modifier - .fillMaxWidth() - .verticalScroll(rememberScrollState()), - itemCount = rentedInstances.size, - horizontalArrangement = Arrangement.Center - ) { i -> - RentedInstanceCard( + if (rentedInstances.size > 0) { + ContextualFlowRow( modifier = Modifier - .width(340.dp) - .padding(8.dp), - rentedInstance = rentedInstances[i], - termuxAvailable = termuxAvailable, - sshButtonClick = { - dashboardViewModel.sshButtonClick(activity, it) - }, - ) + .fillMaxWidth() + .verticalScroll(rememberScrollState()), + itemCount = rentedInstances.size, + horizontalArrangement = Arrangement.Center + ) { i -> + RentedInstanceCard( + modifier = Modifier + .width(340.dp) + .padding(8.dp), + rentedInstance = rentedInstances[i], + termuxAvailable = termuxAvailable, + sshButtonClick = { + dashboardViewModel.sshButtonClick(activity, it) + }, + ) + } + } else { + Box( + modifier = Modifier + .fillMaxWidth() + .height(100.dp), + contentAlignment = Alignment.Center + ) { + Text( + text = stringResource(id = R.string.no_instances) + ) + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c12a4d..ccd4622 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,4 +31,5 @@ Open instructions on github.com An error occurred: (this will be a webview) + You have no instances \ No newline at end of file