Code cleanup

This commit is contained in:
Abdelilah El Aissaoui 2022-10-22 01:12:48 +02:00
parent 4e86f2cd44
commit 3554c7ebcf
5 changed files with 7 additions and 10 deletions

View File

@ -198,7 +198,8 @@ fun UncommitedChanges(
Text(
text = text,
style = MaterialTheme.typography.body2.copy(color = MaterialTheme.colors.primaryVariant),
style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.primaryVariant,
)
},
colors = textFieldColors(),

View File

@ -28,6 +28,7 @@ import com.jetpackduba.gitnuro.LocalTabScope
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
import com.jetpackduba.gitnuro.di.AppComponent
import com.jetpackduba.gitnuro.di.DaggerTabComponent
import com.jetpackduba.gitnuro.di.TabComponent
import com.jetpackduba.gitnuro.extensions.handMouseClickable
import com.jetpackduba.gitnuro.extensions.handOnHover
import com.jetpackduba.gitnuro.preferences.AppSettings
@ -51,14 +52,13 @@ fun RepositoriesTabPanel(
LaunchedEffect(selectedTabKey) {
val index = tabs.indexOfFirst { it.key == selectedTabKey }
// todo sometimes it scrolls to (index - 1) for some weird reason
if (index > -1) {
stateHorizontal.scrollToItem(index)
}
}
Row {
Box(
modifier = Modifier
@ -221,7 +221,7 @@ class TabInformation(
val path: String?,
appComponent: AppComponent,
) {
val tabComponent = DaggerTabComponent.builder()
private val tabComponent: TabComponent = DaggerTabComponent.builder()
.appComponent(appComponent)
.build()
@ -237,7 +237,6 @@ class TabInformation(
init {
tabComponent.inject(this)
//TODO: This shouldn't be here, should be in the parent method
tabViewModel.onRepositoryChanged = { path ->
if (path == null) {
appStateManager.repositoryTabRemoved(key)

View File

@ -26,7 +26,7 @@ fun SideMenuEntry(
icon: Painter? = null,
itemsCount: Int,
isExpanded: Boolean,
hoverIcon: @Composable() (() -> Unit)? = null,
hoverIcon: @Composable (() -> Unit)? = null,
) {
val hoverInteraction = remember { MutableInteractionSource() }
val isHovered by hoverInteraction.collectIsHoveredAsState()
@ -35,7 +35,6 @@ fun SideMenuEntry(
modifier = Modifier
.height(36.dp)
.fillMaxWidth()
// .background(color = MaterialTheme.colors.headerBackground)
.hoverable(hoverInteraction),
verticalAlignment = Alignment.CenterVertically,
) {

View File

@ -1,6 +1,5 @@
package com.jetpackduba.gitnuro.ui.components
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
@ -9,7 +8,6 @@ import androidx.compose.ui.graphics.painter.Painter
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenu
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenuElement
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun <T> SideMenuPanel(
title: String,

View File

@ -83,7 +83,7 @@ class LogViewModel @Inject constructor(
val scrollToUncommitedChanges: Flow<SelectedItem.UncommitedChanges> = tabState.taskEvent
.filterIsInstance<TaskEvent.ScrollToGraphItem>()
.map { it.selectedItem }
.filterIsInstance<SelectedItem.UncommitedChanges>()
.filterIsInstance()
private val _focusCommit = MutableSharedFlow<RevCommit>()
val focusCommit: Flow<RevCommit> = merge(_focusCommit, scrollToItem)