add no instances notice
This commit is contained in:
parent
907f2cd629
commit
6dabc59fc5
2 changed files with 32 additions and 16 deletions
|
@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,4 +31,5 @@
|
|||
<string name="termux_open_instructions">Open instructions on github.com</string>
|
||||
<string name="termux_error">An error occurred:</string>
|
||||
<string name="webview_todo">(this will be a webview)</string>
|
||||
<string name="no_instances">You have no instances</string>
|
||||
</resources>
|
Loading…
Reference in a new issue