feat(About): add repositories list to contributors
This commit is contained in:
parent
2570bc58b1
commit
eed2f456e6
2 changed files with 26 additions and 9 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
package com.aliucord.manager.network.models
|
package com.aliucord.manager.network.models
|
||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
|
import com.aliucord.manager.util.ImmutableListSerializer
|
||||||
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
|
|
@ -8,5 +10,14 @@ import kotlinx.serialization.Serializable
|
||||||
data class Contributor(
|
data class Contributor(
|
||||||
val username: String,
|
val username: String,
|
||||||
val avatarUrl: String,
|
val avatarUrl: String,
|
||||||
val contributions: Int,
|
val commits: Int,
|
||||||
)
|
@Serializable(with = ImmutableListSerializer::class)
|
||||||
|
val repositories: ImmutableList<Repository>,
|
||||||
|
) {
|
||||||
|
@Immutable
|
||||||
|
@Serializable
|
||||||
|
data class Repository(
|
||||||
|
val name: String,
|
||||||
|
val commits: Int,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import coil3.compose.AsyncImage
|
import coil3.compose.AsyncImage
|
||||||
import com.aliucord.manager.R
|
import com.aliucord.manager.R
|
||||||
|
|
@ -29,19 +29,17 @@ fun ContributorCommitsItem(
|
||||||
val uriHandler = LocalUriHandler.current
|
val uriHandler = LocalUriHandler.current
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clickable {
|
.clickable { uriHandler.openUri("https://github.com/${user.username}") }
|
||||||
uriHandler.openUri("https://github.com/${user.username}")
|
|
||||||
}
|
|
||||||
.padding(horizontal = 16.dp, vertical = 10.dp)
|
.padding(horizontal = 16.dp, vertical = 10.dp)
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = user.avatarUrl,
|
model = user.avatarUrl,
|
||||||
contentDescription = user.username,
|
contentDescription = user.username,
|
||||||
Modifier
|
Modifier
|
||||||
|
.padding(top = 6.dp)
|
||||||
.size(45.dp)
|
.size(45.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
)
|
)
|
||||||
|
|
@ -52,11 +50,19 @@ fun ContributorCommitsItem(
|
||||||
style = MaterialTheme.typography.bodyLarge
|
style = MaterialTheme.typography.bodyLarge
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.contributors_contributions, user.contributions),
|
text = stringResource(R.string.contributors_contributions, user.commits),
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(
|
style = MaterialTheme.typography.bodyMedium.copy(
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = user.repositories.joinToString { it.name },
|
||||||
|
fontStyle = FontStyle.Italic,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
.copy(color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)),
|
||||||
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue