Simplified author component
This commit is contained in:
parent
f3ec209e41
commit
49d4dba1df
1 changed files with 19 additions and 12 deletions
|
@ -23,6 +23,8 @@ import app.ui.context_menu.commitedChangesEntriesContextMenuItems
|
||||||
import app.viewmodels.CommitChangesStatus
|
import app.viewmodels.CommitChangesStatus
|
||||||
import app.viewmodels.CommitChangesViewModel
|
import app.viewmodels.CommitChangesViewModel
|
||||||
import org.eclipse.jgit.diff.DiffEntry
|
import org.eclipse.jgit.diff.DiffEntry
|
||||||
|
import org.eclipse.jgit.lib.ObjectId
|
||||||
|
import org.eclipse.jgit.lib.PersonIdent
|
||||||
import org.eclipse.jgit.revwalk.RevCommit
|
import org.eclipse.jgit.revwalk.RevCommit
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -93,7 +95,7 @@ fun CommitChangesView(
|
||||||
|
|
||||||
Divider(modifier = Modifier.fillMaxWidth())
|
Divider(modifier = Modifier.fillMaxWidth())
|
||||||
|
|
||||||
Author(commit)
|
Author(commit.id, commit.authorIdent)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -129,9 +131,10 @@ fun CommitChangesView(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Author(commit: RevCommit) {
|
fun Author(
|
||||||
val authorIdent = commit.authorIdent
|
id: ObjectId,
|
||||||
|
author: PersonIdent,
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
@ -143,7 +146,7 @@ fun Author(commit: RevCommit) {
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
.size(40.dp),
|
.size(40.dp),
|
||||||
personIdent = commit.authorIdent,
|
personIdent = author,
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -152,16 +155,16 @@ fun Author(commit: RevCommit) {
|
||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
TooltipText(
|
TooltipText(
|
||||||
text = authorIdent.name,
|
text = author.name,
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
color = MaterialTheme.colors.primaryTextColor,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
tooltipTitle = authorIdent.emailAddress,
|
tooltipTitle = author.emailAddress,
|
||||||
)
|
)
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
Text(
|
Text(
|
||||||
text = commit.id.abbreviate(7).name(),
|
text = id.abbreviate(7).name(),
|
||||||
color = MaterialTheme.colors.secondaryTextColor,
|
color = MaterialTheme.colors.secondaryTextColor,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
|
@ -170,17 +173,21 @@ fun Author(commit: RevCommit) {
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f, fill = true))
|
Spacer(modifier = Modifier.weight(1f, fill = true))
|
||||||
|
|
||||||
val date = remember(authorIdent) {
|
val smartDate = remember(author) {
|
||||||
authorIdent.`when`.toSmartSystemString()
|
author.`when`.toSmartSystemString()
|
||||||
|
}
|
||||||
|
|
||||||
|
val systemDate = remember(author) {
|
||||||
|
author.`when`.toSystemDateTimeString()
|
||||||
}
|
}
|
||||||
|
|
||||||
TooltipText(
|
TooltipText(
|
||||||
text = date,
|
text = smartDate,
|
||||||
color = MaterialTheme.colors.secondaryTextColor,
|
color = MaterialTheme.colors.secondaryTextColor,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
tooltipTitle = authorIdent.`when`.toSystemDateTimeString()
|
tooltipTitle = systemDate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue