Skip to content

Commit

Permalink
Improve overall visual
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-jeon committed Jun 4, 2023
1 parent 12579a7 commit e88c260
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
17 changes: 6 additions & 11 deletions src/main/kotlin/com/jerryjeon/logjerry/ui/JsonDetectionView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ package com.jerryjeon.logjerry.ui

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.jerryjeon.logjerry.detector.DetectionStatus
Expand All @@ -31,14 +26,14 @@ fun JsonDetectionView(
) {
Row(
modifier
.width(220.dp)
.fillMaxHeight()
.border(1.dp, Color.LightGray, RoundedCornerShape(4.dp))
.padding(8.dp),
.wrapContentWidth()
.border(ButtonDefaults.outlinedBorder, MaterialTheme.shapes.small)
.padding(start = 12.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text("Json")
Spacer(modifier = Modifier.width(8.dp))
JsonDetectionSelectionExist(detectionStatus, moveToPreviousOccurrence, moveToNextOccurrence)
}
}
Expand All @@ -54,7 +49,7 @@ fun JsonDetectionSelectionExist(
Row(modifier = Modifier) {
if (selection.selected == null) {
Text(
"${selection.allDetections.size} results",
" ${selection.allDetections.size}",
modifier = Modifier.align(Alignment.CenterVertically)
)
} else {
Expand Down
28 changes: 20 additions & 8 deletions src/main/kotlin/com/jerryjeon/logjerry/ui/ParseCompletedView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,22 @@ fun ParseCompletedView(
modifier = Modifier
) {
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
FilterPopup(filterManager)
val statusByKey by refineResult.statusByKey.collectAsState()
statusByKey[DetectorKey.Json]?.let {
JsonDetectionView(
detectionStatus = it,
moveToPreviousOccurrence = refineResult::selectPreviousDetection,
moveToNextOccurrence = refineResult::selectNextDetection,
)
Row(
modifier = Modifier
.padding(12.dp)
.height(IntrinsicSize.Min)
) {
FilterView(filterManager)
Spacer(Modifier.width(8.dp))
statusByKey[DetectorKey.Json]?.let {
JsonDetectionView(
modifier = Modifier.fillMaxHeight(),
detectionStatus = it,
moveToPreviousOccurrence = refineResult::selectPreviousDetection,
moveToNextOccurrence = refineResult::selectNextDetection,
)
}
}

Spacer(modifier = Modifier.weight(1f))
Expand Down Expand Up @@ -87,7 +95,7 @@ fun ParseCompletedView(
}

@Composable
private fun FilterPopup(filterManager: FilterManager) {
private fun FilterView(filterManager: FilterManager) {
var showTextFilterPopup by remember { mutableStateOf(false) }
var textFilterAnchor by remember { mutableStateOf(Offset.Zero) }
var showLogLevelPopup by remember { mutableStateOf(false) }
Expand All @@ -99,18 +107,22 @@ private fun FilterPopup(filterManager: FilterManager) {
showTextFilterPopup = true
},
modifier = Modifier
.height(48.dp)
.onGloballyPositioned { coordinates ->
textFilterAnchor = coordinates.positionInRoot()
},
) {
Text("Add Filter")
}

Spacer(Modifier.width(8.dp))

OutlinedButton(
onClick = {
showLogLevelPopup = true
},
modifier = Modifier
.height(48.dp)
.onGloballyPositioned { coordinates ->
logLevelAnchor = coordinates.positionInRoot()
},
Expand Down

0 comments on commit e88c260

Please sign in to comment.