Merge pull request #3389 from vitorpamplona/claude/pr-rendering-layout-uafuio

Style Git pull request clone URLs with labelMedium typography
This commit is contained in:
Vitor Pamplona
2026-06-26 17:19:45 -04:00
committed by GitHub
2 changed files with 20 additions and 10 deletions
@@ -20,9 +20,11 @@
*/
package com.vitorpamplona.amethyst.ui.components
import androidx.compose.material3.LocalTextStyle
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import com.vitorpamplona.amethyst.service.uploads.blossom.bud10.openBlossomUriAsIntent
@@ -30,6 +32,7 @@ import com.vitorpamplona.amethyst.service.uploads.blossom.bud10.openBlossomUriAs
fun ClickableUrl(
urlText: String,
url: String,
style: TextStyle = LocalTextStyle.current,
onError: (Int, Int) -> Unit = { _, _ -> },
) {
val uri = LocalUriHandler.current
@@ -37,6 +40,7 @@ fun ClickableUrl(
ClickableTextPrimary(
text = urlText,
style = style,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
onClick = {
@@ -33,6 +33,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -43,6 +44,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
@@ -174,6 +176,7 @@ private fun LinkRow(
symbol: MaterialSymbol,
contentDescription: String?,
url: String,
style: TextStyle = LocalTextStyle.current,
) {
Row(
modifier = Modifier.fillMaxWidth(),
@@ -189,6 +192,7 @@ private fun LinkRow(
ClickableUrl(
url = url,
urlText = url.removePrefix("https://").removePrefix("http://"),
style = style,
)
}
}
@@ -538,6 +542,16 @@ private fun RenderGitPullRequestEvent(
nav: INav,
) {
GitCardContainer {
val repository = remember(noteEvent) { noteEvent.repositoryAddress() }
if (repository != null) {
LoadAddressableNote(repository, accountViewModel) {
if (it != null) {
RenderShortRepositoryHeader(it, accountViewModel, nav)
}
}
Spacer(modifier = StdVertSpacer)
}
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = HeaderSpacing,
@@ -557,16 +571,6 @@ private fun RenderGitPullRequestEvent(
GitSubjectTitle(subject)
}
val repository = remember(noteEvent) { noteEvent.repositoryAddress() }
if (repository != null) {
Spacer(modifier = StdVertSpacer)
LoadAddressableNote(repository, accountViewModel) {
if (it != null) {
RenderShortRepositoryHeader(it, accountViewModel, nav)
}
}
}
val branch = remember(noteEvent) { noteEvent.branchName()?.takeIf { it.isNotBlank() } }
val currentCommit = remember(noteEvent) { noteEvent.currentCommit()?.takeIf { it.isNotBlank() } }
val mergeBase = remember(noteEvent) { noteEvent.mergeBase()?.takeIf { it.isNotBlank() } }
@@ -595,6 +599,7 @@ private fun RenderGitPullRequestEvent(
symbol = MaterialSymbols.CloudDownload,
contentDescription = stringRes(id = R.string.git_clone_address),
url = url,
style = MaterialTheme.typography.labelMedium.copy(fontSize = Font12SP),
)
}
}
@@ -695,6 +700,7 @@ private fun RenderGitPullRequestUpdateEvent(
symbol = MaterialSymbols.CloudDownload,
contentDescription = stringRes(id = R.string.git_clone_address),
url = url,
style = MaterialTheme.typography.labelMedium.copy(fontSize = Font12SP),
)
}
}