|
|
|
@ -1,11 +1,15 @@
|
|
|
|
|
package org.calculate.taigamobile.ui.screens.projectselector
|
|
|
|
|
|
|
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
|
|
import androidx.compose.foundation.Image
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.layout.*
|
|
|
|
|
import androidx.compose.foundation.lazy.LazyItemScope
|
|
|
|
|
import androidx.compose.material3.*
|
|
|
|
|
import androidx.compose.runtime.*
|
|
|
|
|
import androidx.compose.ui.Alignment
|
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
|
import androidx.compose.ui.graphics.ColorFilter
|
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
@ -23,6 +27,7 @@ import org.calculate.taigamobile.ui.components.containers.ContainerBox
|
|
|
|
|
import org.calculate.taigamobile.ui.utils.subscribeOnError
|
|
|
|
|
import kotlinx.coroutines.delay
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import retrofit2.http.Header
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun ProjectSelectorScreen(
|
|
|
|
@ -64,6 +69,7 @@ fun ProjectSelectorScreen(
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
|
|
@Composable
|
|
|
|
|
fun ProjectSelectorScreenContent(
|
|
|
|
|
projects: LazyPagingItems<Project>? = null,
|
|
|
|
@ -95,6 +101,7 @@ fun ProjectSelectorScreenContent(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
|
|
@Composable
|
|
|
|
|
private fun ItemProject(
|
|
|
|
|
project: Project,
|
|
|
|
@ -110,29 +117,31 @@ private fun ItemProject(
|
|
|
|
|
verticalAlignment = Alignment.CenterVertically
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
Column(Modifier.weight(0.8f)) {
|
|
|
|
|
project.takeIf { it.isMember || it.isAdmin || it.isOwner }?.let {
|
|
|
|
|
|
|
|
|
|
Column(Modifier.weight(0.8f)) {
|
|
|
|
|
project.takeIf { it.isMember || it.isAdmin || it.isOwner }?.let {
|
|
|
|
|
Text(
|
|
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
|
|
text = stringResource(
|
|
|
|
|
when {
|
|
|
|
|
project.isOwner -> R.string.project_owner
|
|
|
|
|
project.isAdmin -> R.string.project_admin
|
|
|
|
|
project.isMember -> R.string.project_member
|
|
|
|
|
else -> 0
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
|
|
text = stringResource(
|
|
|
|
|
when {
|
|
|
|
|
project.isOwner -> R.string.project_owner
|
|
|
|
|
project.isAdmin -> R.string.project_admin
|
|
|
|
|
project.isMember -> R.string.project_member
|
|
|
|
|
else -> 0
|
|
|
|
|
}
|
|
|
|
|
text = stringResource(R.string.project_name_template).format(
|
|
|
|
|
project.name,
|
|
|
|
|
project.slug
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
text = stringResource(R.string.project_name_template).format(
|
|
|
|
|
project.name,
|
|
|
|
|
project.slug
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (project.id == currentProjectId) {
|
|
|
|
|
Image(
|
|
|
|
|