Added icon instead of used image on stash
This commit is contained in:
parent
e98dd4b63a
commit
21ce125931
@ -16,6 +16,7 @@ open class GraphNode(id: AnyObjectId?) : RevCommit(id), IGraphNode {
|
|||||||
var lane: GraphLane = NO_LANE
|
var lane: GraphLane = NO_LANE
|
||||||
var children: Array<GraphNode> = NO_CHILDREN
|
var children: Array<GraphNode> = NO_CHILDREN
|
||||||
var refs: List<Ref> = NO_REFS
|
var refs: List<Ref> = NO_REFS
|
||||||
|
var isStash: Boolean = false
|
||||||
|
|
||||||
fun addForkingOffLane(graphLane: GraphLane) {
|
fun addForkingOffLane(graphLane: GraphLane) {
|
||||||
forkingOffLanes = addLane(graphLane, forkingOffLanes)
|
forkingOffLanes = addLane(graphLane, forkingOffLanes)
|
||||||
|
@ -48,8 +48,12 @@ class GraphWalk(private var repository: Repository?) : RevWalk(repository) {
|
|||||||
override fun next(): RevCommit? {
|
override fun next(): RevCommit? {
|
||||||
val graphNode = super.next() as GraphNode?
|
val graphNode = super.next() as GraphNode?
|
||||||
|
|
||||||
if (graphNode != null)
|
if (graphNode != null) {
|
||||||
graphNode.refs = getRefs(graphNode)
|
val refs = getRefs(graphNode)
|
||||||
|
|
||||||
|
graphNode.isStash = refs.count() == 1 && refs.firstOrNull()?.name == "refs/stash"
|
||||||
|
graphNode.refs = refs
|
||||||
|
}
|
||||||
|
|
||||||
return graphNode
|
return graphNode
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import androidx.compose.ui.focus.FocusRequester
|
|||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.graphics.drawscope.clipRect
|
import androidx.compose.ui.graphics.drawscope.clipRect
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||||
@ -808,7 +809,6 @@ fun CommitLine(
|
|||||||
) {
|
) {
|
||||||
CommitMessage(
|
CommitMessage(
|
||||||
commit = graphNode,
|
commit = graphNode,
|
||||||
refs = graphNode.refs,
|
|
||||||
nodeColor = nodeColor,
|
nodeColor = nodeColor,
|
||||||
matchesSearchFilter = matchesSearchFilter,
|
matchesSearchFilter = matchesSearchFilter,
|
||||||
currentBranch = currentBranch,
|
currentBranch = currentBranch,
|
||||||
@ -830,8 +830,7 @@ fun CommitLine(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CommitMessage(
|
fun CommitMessage(
|
||||||
commit: RevCommit,
|
commit: GraphNode,
|
||||||
refs: List<Ref>,
|
|
||||||
currentBranch: Ref?,
|
currentBranch: Ref?,
|
||||||
nodeColor: Color,
|
nodeColor: Color,
|
||||||
matchesSearchFilter: Boolean?,
|
matchesSearchFilter: Boolean?,
|
||||||
@ -852,35 +851,37 @@ fun CommitMessage(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(start = 16.dp)
|
modifier = Modifier.padding(start = 16.dp)
|
||||||
) {
|
) {
|
||||||
refs.sortedWith { ref1, ref2 ->
|
if (!commit.isStash) {
|
||||||
if (ref1.isSameBranch(currentBranch)) {
|
commit.refs.sortedWith { ref1, ref2 ->
|
||||||
-1
|
if (ref1.isSameBranch(currentBranch)) {
|
||||||
} else {
|
-1
|
||||||
ref1.name.compareTo(ref2.name)
|
} else {
|
||||||
}
|
ref1.name.compareTo(ref2.name)
|
||||||
}.forEach { ref ->
|
}
|
||||||
if (ref.isTag) {
|
}.forEach { ref ->
|
||||||
TagChip(
|
if (ref.isTag) {
|
||||||
ref = ref,
|
TagChip(
|
||||||
color = nodeColor,
|
ref = ref,
|
||||||
onCheckoutTag = { onCheckoutRef(ref) },
|
color = nodeColor,
|
||||||
onDeleteTag = { onDeleteTag(ref) },
|
onCheckoutTag = { onCheckoutRef(ref) },
|
||||||
)
|
onDeleteTag = { onDeleteTag(ref) },
|
||||||
} else if (ref.isBranch) {
|
)
|
||||||
BranchChip(
|
} else if (ref.isBranch) {
|
||||||
ref = ref,
|
BranchChip(
|
||||||
color = nodeColor,
|
ref = ref,
|
||||||
currentBranch = currentBranch,
|
color = nodeColor,
|
||||||
isCurrentBranch = ref.isSameBranch(currentBranch),
|
currentBranch = currentBranch,
|
||||||
onCheckoutBranch = { onCheckoutRef(ref) },
|
isCurrentBranch = ref.isSameBranch(currentBranch),
|
||||||
onMergeBranch = { onMergeBranch(ref) },
|
onCheckoutBranch = { onCheckoutRef(ref) },
|
||||||
onDeleteBranch = { onDeleteBranch(ref) },
|
onMergeBranch = { onMergeBranch(ref) },
|
||||||
onDeleteRemoteBranch = { onDeleteRemoteBranch(ref) },
|
onDeleteBranch = { onDeleteBranch(ref) },
|
||||||
onRebaseBranch = { onRebaseBranch(ref) },
|
onDeleteRemoteBranch = { onDeleteRemoteBranch(ref) },
|
||||||
onPullRemoteBranch = { onPullRemoteBranch(ref) },
|
onRebaseBranch = { onRebaseBranch(ref) },
|
||||||
onPushRemoteBranch = { onPushRemoteBranch(ref) },
|
onPullRemoteBranch = { onPullRemoteBranch(ref) },
|
||||||
onChangeDefaultUpstreamBranch = { onChangeDefaultUpstreamBranch(ref) },
|
onPushRemoteBranch = { onPushRemoteBranch(ref) },
|
||||||
)
|
onChangeDefaultUpstreamBranch = { onChangeDefaultUpstreamBranch(ref) },
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1028,19 +1029,37 @@ fun CommitNode(
|
|||||||
color: Color,
|
color: Color,
|
||||||
) {
|
) {
|
||||||
val author = plotCommit.authorIdent
|
val author = plotCommit.authorIdent
|
||||||
Tooltip("${author.name} <${author.emailAddress}>") {
|
if (plotCommit.isStash) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.size(30.dp)
|
.size(30.dp)
|
||||||
.border(2.dp, color, shape = CircleShape)
|
.border(2.dp, color, shape = CircleShape)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
|
.background(MaterialTheme.colors.background),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
AvatarImage(
|
Image(
|
||||||
modifier = Modifier.fillMaxSize(),
|
painterResource(AppIcons.STASH),
|
||||||
personIdent = plotCommit.authorIdent,
|
modifier = Modifier.size(20.dp),
|
||||||
color = color,
|
contentDescription = null,
|
||||||
|
colorFilter = ColorFilter.tint(color),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Tooltip("${author.name} <${author.emailAddress}>") {
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.size(30.dp)
|
||||||
|
.border(2.dp, color, shape = CircleShape)
|
||||||
|
.clip(CircleShape)
|
||||||
|
) {
|
||||||
|
AvatarImage(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
personIdent = plotCommit.authorIdent,
|
||||||
|
color = color,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user