Code cleanup
This commit is contained in:
parent
4e86f2cd44
commit
3554c7ebcf
@ -198,7 +198,8 @@ fun UncommitedChanges(
|
|||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
style = MaterialTheme.typography.body2.copy(color = MaterialTheme.colors.primaryVariant),
|
style = MaterialTheme.typography.body2,
|
||||||
|
color = MaterialTheme.colors.primaryVariant,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
colors = textFieldColors(),
|
colors = textFieldColors(),
|
||||||
|
@ -28,6 +28,7 @@ import com.jetpackduba.gitnuro.LocalTabScope
|
|||||||
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
||||||
import com.jetpackduba.gitnuro.di.AppComponent
|
import com.jetpackduba.gitnuro.di.AppComponent
|
||||||
import com.jetpackduba.gitnuro.di.DaggerTabComponent
|
import com.jetpackduba.gitnuro.di.DaggerTabComponent
|
||||||
|
import com.jetpackduba.gitnuro.di.TabComponent
|
||||||
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
||||||
import com.jetpackduba.gitnuro.extensions.handOnHover
|
import com.jetpackduba.gitnuro.extensions.handOnHover
|
||||||
import com.jetpackduba.gitnuro.preferences.AppSettings
|
import com.jetpackduba.gitnuro.preferences.AppSettings
|
||||||
@ -51,14 +52,13 @@ fun RepositoriesTabPanel(
|
|||||||
|
|
||||||
LaunchedEffect(selectedTabKey) {
|
LaunchedEffect(selectedTabKey) {
|
||||||
val index = tabs.indexOfFirst { it.key == selectedTabKey }
|
val index = tabs.indexOfFirst { it.key == selectedTabKey }
|
||||||
|
// todo sometimes it scrolls to (index - 1) for some weird reason
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
stateHorizontal.scrollToItem(index)
|
stateHorizontal.scrollToItem(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -221,7 +221,7 @@ class TabInformation(
|
|||||||
val path: String?,
|
val path: String?,
|
||||||
appComponent: AppComponent,
|
appComponent: AppComponent,
|
||||||
) {
|
) {
|
||||||
val tabComponent = DaggerTabComponent.builder()
|
private val tabComponent: TabComponent = DaggerTabComponent.builder()
|
||||||
.appComponent(appComponent)
|
.appComponent(appComponent)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@ -237,7 +237,6 @@ class TabInformation(
|
|||||||
init {
|
init {
|
||||||
tabComponent.inject(this)
|
tabComponent.inject(this)
|
||||||
|
|
||||||
//TODO: This shouldn't be here, should be in the parent method
|
|
||||||
tabViewModel.onRepositoryChanged = { path ->
|
tabViewModel.onRepositoryChanged = { path ->
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
appStateManager.repositoryTabRemoved(key)
|
appStateManager.repositoryTabRemoved(key)
|
||||||
|
@ -26,7 +26,7 @@ fun SideMenuEntry(
|
|||||||
icon: Painter? = null,
|
icon: Painter? = null,
|
||||||
itemsCount: Int,
|
itemsCount: Int,
|
||||||
isExpanded: Boolean,
|
isExpanded: Boolean,
|
||||||
hoverIcon: @Composable() (() -> Unit)? = null,
|
hoverIcon: @Composable (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
val hoverInteraction = remember { MutableInteractionSource() }
|
val hoverInteraction = remember { MutableInteractionSource() }
|
||||||
val isHovered by hoverInteraction.collectIsHoveredAsState()
|
val isHovered by hoverInteraction.collectIsHoveredAsState()
|
||||||
@ -35,7 +35,6 @@ fun SideMenuEntry(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(36.dp)
|
.height(36.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
// .background(color = MaterialTheme.colors.headerBackground)
|
|
||||||
.hoverable(hoverInteraction),
|
.hoverable(hoverInteraction),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.jetpackduba.gitnuro.ui.components
|
package com.jetpackduba.gitnuro.ui.components
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.runtime.Composable
|
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.ContextMenu
|
||||||
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenuElement
|
import com.jetpackduba.gitnuro.ui.context_menu.ContextMenuElement
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> SideMenuPanel(
|
fun <T> SideMenuPanel(
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -83,7 +83,7 @@ class LogViewModel @Inject constructor(
|
|||||||
val scrollToUncommitedChanges: Flow<SelectedItem.UncommitedChanges> = tabState.taskEvent
|
val scrollToUncommitedChanges: Flow<SelectedItem.UncommitedChanges> = tabState.taskEvent
|
||||||
.filterIsInstance<TaskEvent.ScrollToGraphItem>()
|
.filterIsInstance<TaskEvent.ScrollToGraphItem>()
|
||||||
.map { it.selectedItem }
|
.map { it.selectedItem }
|
||||||
.filterIsInstance<SelectedItem.UncommitedChanges>()
|
.filterIsInstance()
|
||||||
|
|
||||||
private val _focusCommit = MutableSharedFlow<RevCommit>()
|
private val _focusCommit = MutableSharedFlow<RevCommit>()
|
||||||
val focusCommit: Flow<RevCommit> = merge(_focusCommit, scrollToItem)
|
val focusCommit: Flow<RevCommit> = merge(_focusCommit, scrollToItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user