mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
feat(git): make recent-activity rows and the last-commit line clickable
- Recent-activity rows navigate to the issue/PR they represent (routeFor). - The last-commit strip is now tappable: on the home it opens the Code screen; on the feed repo card it opens the repository. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpNmN8CvP6HnEsdTGAjVUr
This commit is contained in:
@@ -846,7 +846,7 @@ private fun RenderGitRepositoryEvent(
|
||||
)
|
||||
}
|
||||
|
||||
RepoSnapshotDashboard(noteEvent, note, accountViewModel)
|
||||
RepoSnapshotDashboard(noteEvent, note, accountViewModel, nav)
|
||||
|
||||
if (topics.isNotEmpty()) {
|
||||
Spacer(modifier = HalfDoubleVertSpacer)
|
||||
@@ -876,6 +876,7 @@ private fun RepoSnapshotDashboard(
|
||||
noteEvent: GitRepositoryEvent,
|
||||
note: Note,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
val browser: GitRepositoryBrowserViewModel =
|
||||
viewModel(
|
||||
@@ -900,8 +901,8 @@ private fun RepoSnapshotDashboard(
|
||||
Spacer(modifier = HalfDoubleVertSpacer)
|
||||
RepoLanguageBar(slices)
|
||||
}
|
||||
snapshot.tipCommit?.let {
|
||||
snapshot.tipCommit?.let { commit ->
|
||||
Spacer(modifier = HalfDoubleVertSpacer)
|
||||
RepoLastCommit(it)
|
||||
RepoLastCommit(commit) { nav.nav(Route.GitRepository(noteEvent.kind, noteEvent.pubKey, noteEvent.dTag())) }
|
||||
}
|
||||
}
|
||||
|
||||
+12
-2
@@ -21,6 +21,7 @@
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.gitRepo
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -53,6 +54,7 @@ import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.routeFor
|
||||
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
||||
import com.vitorpamplona.amethyst.ui.note.ReactionsRow
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.TimeAgo
|
||||
@@ -382,13 +384,17 @@ fun computeLanguageBreakdown(files: List<String>): List<LanguageSlice> {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@Composable
|
||||
fun RepoLastCommit(commit: GitCommit) {
|
||||
fun RepoLastCommit(
|
||||
commit: GitCommit,
|
||||
onClick: (() -> Unit)? = null,
|
||||
) {
|
||||
Row(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(CardShape)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.let { if (onClick != null) it.clickable(onClick = onClick) else it }
|
||||
.padding(horizontal = 14.dp, vertical = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
@@ -457,7 +463,11 @@ private fun ActivityRow(
|
||||
) {
|
||||
val event = note.event ?: return
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp),
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { nav.nav { routeFor(note, accountViewModel.account) } }
|
||||
.padding(horizontal = 14.dp, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
|
||||
+3
-1
@@ -340,7 +340,9 @@ private fun GitRepositoryHome(
|
||||
if (languageSlices.isNotEmpty()) {
|
||||
RepoLanguageBar(languageSlices)
|
||||
}
|
||||
snapshot.tipCommit?.let { RepoLastCommit(it) }
|
||||
snapshot.tipCommit?.let { commit ->
|
||||
RepoLastCommit(commit) { nav.nav(Route.GitRepositoryCode(note.address)) }
|
||||
}
|
||||
}
|
||||
|
||||
RepoNavCards(note, openIssueCount, openPullCount, nav)
|
||||
|
||||
Reference in New Issue
Block a user