File name is always shown in the changes log to cut the dir path
This commit is contained in:
parent
250ca295b9
commit
970132f1d7
@ -13,12 +13,44 @@ import app.theme.addFile
|
|||||||
import app.theme.modifyFile
|
import app.theme.modifyFile
|
||||||
import org.eclipse.jgit.diff.DiffEntry
|
import org.eclipse.jgit.diff.DiffEntry
|
||||||
|
|
||||||
val DiffEntry.filePath: String
|
val DiffEntry.parentDirectoryPath: String
|
||||||
get() {
|
get() {
|
||||||
return if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||||
this.oldPath
|
this.oldPath
|
||||||
} else
|
} else
|
||||||
this.newPath
|
this.newPath
|
||||||
|
|
||||||
|
val pathSplit = path.split(systemSeparator).toMutableList()
|
||||||
|
pathSplit.removeLast()
|
||||||
|
|
||||||
|
val directoryPath = pathSplit.joinToString(systemSeparator)
|
||||||
|
|
||||||
|
return if (directoryPath.isEmpty())
|
||||||
|
""
|
||||||
|
else
|
||||||
|
"${directoryPath}/"
|
||||||
|
}
|
||||||
|
|
||||||
|
val DiffEntry.fileName: String
|
||||||
|
get() {
|
||||||
|
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||||
|
this.oldPath
|
||||||
|
} else
|
||||||
|
this.newPath
|
||||||
|
|
||||||
|
val pathSplit = path.split(systemSeparator)
|
||||||
|
|
||||||
|
return pathSplit.lastOrNull() ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
val DiffEntry.filePath: String
|
||||||
|
get() {
|
||||||
|
val path = if (this.changeType == DiffEntry.ChangeType.DELETE) {
|
||||||
|
this.oldPath
|
||||||
|
} else
|
||||||
|
this.newPath
|
||||||
|
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
val DiffEntry.icon: ImageVector
|
val DiffEntry.icon: ImageVector
|
||||||
|
@ -46,6 +46,10 @@ fun AppTheme(theme: Themes = Themes.LIGHT, content: @Composable() () -> Unit) {
|
|||||||
val Colors.primaryTextColor: Color
|
val Colors.primaryTextColor: Color
|
||||||
get() = if (isLight) mainText else mainTextDark
|
get() = if (isLight) mainText else mainTextDark
|
||||||
|
|
||||||
|
@get:Composable
|
||||||
|
val Colors.halfPrimary: Color
|
||||||
|
get() = primary.copy(alpha = 0.8f)
|
||||||
|
|
||||||
@get:Composable
|
@get:Composable
|
||||||
val Colors.inversePrimaryTextColor: Color
|
val Colors.inversePrimaryTextColor: Color
|
||||||
get() = if (isLight) mainTextDark else mainText
|
get() = if (isLight) mainTextDark else mainText
|
||||||
|
@ -11,15 +11,14 @@ import androidx.compose.material.*
|
|||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import app.extensions.*
|
import app.extensions.*
|
||||||
import app.theme.headerBackground
|
import app.theme.*
|
||||||
import app.theme.headerText
|
|
||||||
import app.theme.primaryTextColor
|
|
||||||
import app.theme.secondaryTextColor
|
|
||||||
import app.ui.components.AvatarImage
|
import app.ui.components.AvatarImage
|
||||||
import app.ui.components.ScrollableLazyColumn
|
import app.ui.components.ScrollableLazyColumn
|
||||||
import app.ui.components.TooltipText
|
import app.ui.components.TooltipText
|
||||||
@ -184,10 +183,16 @@ fun CommitLogChanges(diffEntries: List<DiffEntry>, onDiffSelected: (DiffEntry) -
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
itemsIndexed(items = diffEntries) { index, diffEntry ->
|
itemsIndexed(items = diffEntries) { index, diffEntry ->
|
||||||
val textColor = if (selectedIndex.value == index) {
|
val textColor: Color
|
||||||
MaterialTheme.colors.primary
|
val secondaryTextColor: Color
|
||||||
} else
|
|
||||||
MaterialTheme.colors.primaryTextColor
|
if (selectedIndex.value == index) {
|
||||||
|
textColor = MaterialTheme.colors.primary
|
||||||
|
secondaryTextColor = MaterialTheme.colors.halfPrimary
|
||||||
|
} else {
|
||||||
|
textColor = MaterialTheme.colors.primaryTextColor
|
||||||
|
secondaryTextColor = MaterialTheme.colors.secondaryTextColor
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -213,12 +218,21 @@ fun CommitLogChanges(diffEntries: List<DiffEntry>, onDiffSelected: (DiffEntry) -
|
|||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = diffEntry.filePath,
|
text = diffEntry.parentDirectoryPath,
|
||||||
modifier = Modifier.padding(horizontal = 8.dp),
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
color = textColor,
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontSize = 13.sp,
|
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
color = secondaryTextColor,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = diffEntry.fileName,
|
||||||
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
|
maxLines = 1,
|
||||||
|
softWrap = false,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = textColor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,12 @@ import androidx.compose.ui.input.pointer.pointerMoveFilter
|
|||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import app.extensions.fileName
|
||||||
import app.extensions.filePath
|
import app.extensions.filePath
|
||||||
|
import app.extensions.parentDirectoryPath
|
||||||
import app.extensions.isMerging
|
import app.extensions.isMerging
|
||||||
import app.git.DiffEntryType
|
import app.git.DiffEntryType
|
||||||
import app.git.StatusEntry
|
import app.git.StatusEntry
|
||||||
@ -558,8 +561,17 @@ private fun FileEntry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = diffEntry.filePath,
|
text = diffEntry.parentDirectoryPath,
|
||||||
modifier = Modifier.weight(1f, fill = true),
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
|
maxLines = 1,
|
||||||
|
softWrap = false,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
color = MaterialTheme.colors.secondaryTextColor,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = diffEntry.fileName,
|
||||||
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
|
Loading…
Reference in New Issue
Block a user