Removed whitespace replace when in a new tab

This commit is contained in:
Abdelilah El Aissaoui 2023-04-15 16:04:02 +02:00
parent d5aaa1dd30
commit 0512510be6
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -100,6 +100,7 @@ fun RepositoriesTabPanel(
Tab(
title = tab.tabName,
isSelected = currentTab == tab,
isNewTab = tab.path == null,
onClick = {
onTabSelected(tab)
},
@ -143,7 +144,12 @@ fun RepositoriesTabPanel(
}
@Composable
fun Tab(title: MutableState<String>, isSelected: Boolean, onClick: () -> Unit, onCloseTab: () -> Unit) {
fun Tab(
title: MutableState<String>,
isSelected: Boolean,
isNewTab: Boolean,
onClick: () -> Unit, onCloseTab: () -> Unit
) {
val backgroundColor = if (isSelected)
MaterialTheme.colors.surface
else
@ -151,6 +157,13 @@ fun Tab(title: MutableState<String>, isSelected: Boolean, onClick: () -> Unit, o
val hoverInteraction = remember { MutableInteractionSource() }
val isHovered by hoverInteraction.collectIsHoveredAsState()
val tabTitle = if (isNewTab)
title.value
else
title.value.replace(
" ",
"-"
) // TODO This replace is a workaround for https://issuetracker.google.com/issues/278044455
Box(
modifier = Modifier
@ -168,7 +181,7 @@ fun Tab(title: MutableState<String>, isSelected: Boolean, onClick: () -> Unit, o
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = title.value.replace(" ", "-"), // TODO This replace is a workaround for https://issuetracker.google.com/issues/278044455
text = tabTitle,
modifier = Modifier
.padding(start = 16.dp)
.weight(1f)