Fixed context menu not showing up in branches/tags
This commit is contained in:
parent
d4d057c291
commit
a7d89aabaf
@ -466,6 +466,48 @@ fun UncommitedChangesGraphLine(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun BranchChip(modifier: Modifier = Modifier, ref: Ref, onCheckoutBranch: () -> Unit) {
|
||||
val contextMenuItemsList = {
|
||||
listOf(
|
||||
ContextMenuItem(
|
||||
label = "Checkout branch",
|
||||
onClick = onCheckoutBranch
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
RefChip(
|
||||
modifier,
|
||||
ref,
|
||||
"branch.svg",
|
||||
onCheckoutRef = onCheckoutBranch,
|
||||
contextMenuItemsList = contextMenuItemsList
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun TagChip(modifier: Modifier = Modifier, ref: Ref, onCheckoutTag: () -> Unit) {
|
||||
val contextMenuItemsList = {
|
||||
listOf(
|
||||
ContextMenuItem(
|
||||
label = "Checkout tag",
|
||||
onClick = onCheckoutTag
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
RefChip(
|
||||
modifier,
|
||||
ref,
|
||||
"tag.svg",
|
||||
onCheckoutRef = onCheckoutTag,
|
||||
contextMenuItemsList = contextMenuItemsList,
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun RefChip(
|
||||
@ -473,16 +515,23 @@ fun RefChip(
|
||||
ref: Ref,
|
||||
icon: String,
|
||||
onCheckoutRef: () -> Unit,
|
||||
contextMenuItemsList: () -> List<ContextMenuItem>,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.combinedClickable(
|
||||
onDoubleClick = onCheckoutRef,
|
||||
onClick = {}
|
||||
)
|
||||
) {
|
||||
ContextMenuArea(
|
||||
items = contextMenuItemsList
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.padding(horizontal = 4.dp)
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(MaterialTheme.colors.primary)
|
||||
.combinedClickable(
|
||||
onDoubleClick = onCheckoutRef,
|
||||
onClick = {}
|
||||
),
|
||||
.background(MaterialTheme.colors.primary),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Icon(
|
||||
@ -501,48 +550,7 @@ fun RefChip(
|
||||
.padding(end = 6.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun BranchChip(modifier: Modifier = Modifier, ref: Ref, onCheckoutBranch: () -> Unit) {
|
||||
ContextMenuArea(
|
||||
items = {
|
||||
listOf(
|
||||
ContextMenuItem(
|
||||
label = "Checkout branch",
|
||||
onClick = onCheckoutBranch
|
||||
)
|
||||
)
|
||||
}
|
||||
) {
|
||||
RefChip(
|
||||
modifier,
|
||||
ref,
|
||||
"branch.svg",
|
||||
onCheckoutRef = onCheckoutBranch
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun TagChip(modifier: Modifier = Modifier, ref: Ref, onCheckoutTag: () -> Unit) {
|
||||
ContextMenuArea(
|
||||
items = {
|
||||
listOf(
|
||||
ContextMenuItem(
|
||||
label = "Checkout tag",
|
||||
onClick = onCheckoutTag
|
||||
)
|
||||
)
|
||||
}
|
||||
) {
|
||||
RefChip(
|
||||
modifier,
|
||||
ref,
|
||||
"tag.svg",
|
||||
onCheckoutRef = onCheckoutTag
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user