Skip to content

Commit 8f7bf56

Browse files
committed
improve updater UI
1 parent d2868f6 commit 8f7bf56

File tree

3 files changed

+206
-198
lines changed

3 files changed

+206
-198
lines changed

src/desktopMain/kotlin/ui/App.kt

Lines changed: 135 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,24 @@ import androidx.compose.desktop.ui.tooling.preview.Preview
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Column
66
import androidx.compose.foundation.layout.ColumnScope
7-
import androidx.compose.foundation.layout.PaddingValues
87
import androidx.compose.foundation.layout.Row
98
import androidx.compose.foundation.layout.Spacer
109
import androidx.compose.foundation.layout.fillMaxWidth
1110
import androidx.compose.foundation.layout.padding
1211
import androidx.compose.foundation.layout.width
13-
import androidx.compose.material.ButtonDefaults
14-
import androidx.compose.material.Icon
1512
import androidx.compose.material.MaterialTheme
16-
import androidx.compose.material.OutlinedButton
1713
import androidx.compose.material.Scaffold
1814
import androidx.compose.material.Tab
1915
import androidx.compose.material.TabRow
2016
import androidx.compose.material.Text
2117
import androidx.compose.material.darkColors
22-
import androidx.compose.material.icons.Icons
23-
import androidx.compose.material.icons.outlined.Search
2418
import androidx.compose.material.lightColors
2519
import androidx.compose.runtime.Composable
2620
import androidx.compose.runtime.collectAsState
2721
import androidx.compose.runtime.getValue
2822
import androidx.compose.ui.Alignment
2923
import androidx.compose.ui.Modifier
3024
import androidx.compose.ui.unit.dp
31-
import configFolder
3225
import decks
3326
import io.github.kdroidfilter.platformtools.darkmodedetector.isSystemInDarkMode
3427
import io.github.kdroidfilter.platformtools.getAppVersion
@@ -68,7 +61,7 @@ fun App() {
6861
Row {
6962
verticalScroll {
7063
Column(
71-
modifier = Modifier.width(320.dp),
64+
modifier = Modifier.width(320.dp).padding(16.dp),
7265
verticalArrangement = Arrangement.SpaceBetween
7366
) {
7467
Column {
@@ -86,135 +79,150 @@ fun App() {
8679

8780
}
8881

89-
Column(horizontalAlignment = Alignment.CenterHorizontally) {
82+
Row(verticalAlignment = Alignment.CenterVertically) {
83+
Column(horizontalAlignment = Alignment.Start) {
9084

91-
UpdateCheckerUI(GitHubReleaseFetcher(owner = "nikkyai", repo = "nest-ctrl"))
92-
93-
androidx.compose.material3.Text(
94-
"O.S. : " + getOperatingSystem().name.lowercase()
95-
.replaceFirstChar { it.uppercase() },
96-
style = MaterialTheme.typography.body1,
97-
color = MaterialTheme.colors.onBackground
98-
)
99-
100-
androidx.compose.material3.Text(
101-
"Version: " + getAppVersion(),
102-
style = MaterialTheme.typography.body2,
103-
color = MaterialTheme.colors.onBackground
104-
)
10585

106-
}
107-
108-
Column(
109-
horizontalAlignment = Alignment.Start,
110-
verticalArrangement = Arrangement.Bottom,
111-
modifier = Modifier
112-
.fillMaxWidth(0.9f),
113-
) {
114-
OutlinedButton(
115-
onClick = {
116-
logger.info { "opening windows terminal to watch logs" }
117-
runCommand(
118-
"wt", "new-tab",
119-
"-p", "Windows Powershell",
120-
"--title", "NEST CTRL LOGS",
121-
"-d", configFolder.path,
122-
"powershell",
123-
"Get-Content",
124-
"-Path", "logs/latest.log",
125-
"-Wait",
126-
workingDir = configFolder
127-
)
128-
},
129-
contentPadding = PaddingValues(8.dp, 0.dp),
130-
) {
131-
Icon(
132-
imageVector = Icons.Outlined.Search,
133-
contentDescription = "Watch Logs (INFO)",
134-
// tint = deck.color,
135-
modifier = Modifier.padding(8.dp)
86+
androidx.compose.material3.Text(
87+
"O.S. : ", // + getOperatingSystem().name.lowercase()
88+
// .replaceFirstChar { it.uppercase() },
89+
style = MaterialTheme.typography.body1,
90+
color = MaterialTheme.colors.onBackground
13691
)
13792

138-
Text("Watch Logs (INFO)")
139-
}
140-
MaterialTheme(
141-
colors = darkColors(
142-
primary = MaterialTheme.colors.error,
143-
onSurface = MaterialTheme.colors.error
93+
androidx.compose.material3.Text(
94+
"Version: ", // + getAppVersion(),
95+
style = MaterialTheme.typography.body2,
96+
color = MaterialTheme.colors.onBackground
14497
)
145-
) {
146-
OutlinedButton(
147-
onClick = {
148-
logger.info { "opening windows terminal to watch logs" }
149-
runCommand(
150-
"wt", "new-tab",
151-
"-p", "Windows Powershell",
152-
"--title", "NEST CTRL LOGS",
153-
"-d", configFolder.path,
154-
"powershell",
155-
"Get-Content",
156-
"-Path", "logs/latest-debug.log",
157-
"-Wait",
158-
workingDir = configFolder
159-
)
160-
},
161-
colors = ButtonDefaults.outlinedButtonColors(),
162-
contentPadding = PaddingValues(8.dp, 0.dp),
163-
// border = BorderStroke(
164-
// OutlinedBorderSize, MaterialTheme.colors.onSecondary.copy(alpha = OutlinedBorderOpacity)
165-
// ),
166-
167-
) {
168-
Icon(
169-
imageVector = Icons.Outlined.Search,
170-
contentDescription = "Watch LOgs (DEBUG)",
171-
// tint = deck.color,
172-
modifier = Modifier.padding(8.dp)
173-
)
174-
175-
Text("Watch Logs (DEBUG)")
176-
}
17798
}
178-
MaterialTheme(
179-
colors = darkColors(
180-
primary = MaterialTheme.colors.error,
181-
onSurface = MaterialTheme.colors.error
99+
Column(horizontalAlignment = Alignment.End) {
100+
androidx.compose.material3.Text(
101+
getOperatingSystem().name.lowercase()
102+
.replaceFirstChar { it.uppercase() },
103+
style = MaterialTheme.typography.body1,
104+
color = MaterialTheme.colors.onBackground
182105
)
183-
) {
184-
OutlinedButton(
185-
onClick = {
186-
logger.info { "opening windows terminal to watch logs" }
187-
runCommand(
188-
"wt", "new-tab",
189-
"-p", "Windows Powershell",
190-
"--title", "NEST CTRL LOGS",
191-
"-d", configFolder.path,
192-
"powershell",
193-
"Get-Content",
194-
"-Path", "logs/latest-trace.log",
195-
"-Wait",
196-
workingDir = configFolder
197-
)
198-
},
199-
colors = ButtonDefaults.outlinedButtonColors(),
200-
// shape = MaterialTheme.shapes.large,
201-
contentPadding = PaddingValues(8.dp, 0.dp)
202-
// border = BorderStroke(
203-
// OutlinedBorderSize, MaterialTheme.colors.onSecondary.copy(alpha = OutlinedBorderOpacity)
204-
// ),
205-
206-
) {
207-
Icon(
208-
imageVector = Icons.Outlined.Search,
209-
contentDescription = "Watch LOgs (TRACE)",
210-
// tint = deck.color,
211-
modifier = Modifier.padding(8.dp)
212-
)
213106

214-
Text("Watch Logs (TRACE)")
215-
}
107+
androidx.compose.material3.Text(
108+
getAppVersion(),
109+
style = MaterialTheme.typography.body2,
110+
color = MaterialTheme.colors.onBackground
111+
)
216112
}
113+
UpdateCheckerUI(GitHubReleaseFetcher(owner = "nikkyai", repo = "nest-ctrl"))
217114
}
115+
116+
// Column(
117+
// horizontalAlignment = Alignment.Start,
118+
// verticalArrangement = Arrangement.Bottom,
119+
// modifier = Modifier
120+
// .fillMaxWidth(0.9f),
121+
// ) {
122+
// OutlinedButton(
123+
// onClick = {
124+
// logger.info { "opening windows terminal to watch logs" }
125+
// runCommand(
126+
// "wt", "new-tab",
127+
// "-p", "Windows Powershell",
128+
// "--title", "NEST CTRL LOGS",
129+
// "-d", configFolder.path,
130+
// "powershell",
131+
// "Get-Content",
132+
// "-Path", "logs/latest.log",
133+
// "-Wait",
134+
// workingDir = configFolder
135+
// )
136+
// },
137+
// contentPadding = PaddingValues(8.dp, 0.dp),
138+
// ) {
139+
// Icon(
140+
// imageVector = Icons.Outlined.Search,
141+
// contentDescription = "Watch Logs (INFO)",
142+
//// tint = deck.color,
143+
// modifier = Modifier.padding(8.dp)
144+
// )
145+
//
146+
// Text("Watch Logs (INFO)")
147+
// }
148+
// MaterialTheme(
149+
// colors = darkColors(
150+
// primary = MaterialTheme.colors.error,
151+
// onSurface = MaterialTheme.colors.error
152+
// )
153+
// ) {
154+
// OutlinedButton(
155+
// onClick = {
156+
// logger.info { "opening windows terminal to watch logs" }
157+
// runCommand(
158+
// "wt", "new-tab",
159+
// "-p", "Windows Powershell",
160+
// "--title", "NEST CTRL LOGS",
161+
// "-d", configFolder.path,
162+
// "powershell",
163+
// "Get-Content",
164+
// "-Path", "logs/latest-debug.log",
165+
// "-Wait",
166+
// workingDir = configFolder
167+
// )
168+
// },
169+
// colors = ButtonDefaults.outlinedButtonColors(),
170+
// contentPadding = PaddingValues(8.dp, 0.dp),
171+
//// border = BorderStroke(
172+
//// OutlinedBorderSize, MaterialTheme.colors.onSecondary.copy(alpha = OutlinedBorderOpacity)
173+
//// ),
174+
//
175+
// ) {
176+
// Icon(
177+
// imageVector = Icons.Outlined.Search,
178+
// contentDescription = "Watch LOgs (DEBUG)",
179+
//// tint = deck.color,
180+
// modifier = Modifier.padding(8.dp)
181+
// )
182+
//
183+
// Text("Watch Logs (DEBUG)")
184+
// }
185+
// }
186+
// MaterialTheme(
187+
// colors = darkColors(
188+
// primary = MaterialTheme.colors.error,
189+
// onSurface = MaterialTheme.colors.error
190+
// )
191+
// ) {
192+
// OutlinedButton(
193+
// onClick = {
194+
// logger.info { "opening windows terminal to watch logs" }
195+
// runCommand(
196+
// "wt", "new-tab",
197+
// "-p", "Windows Powershell",
198+
// "--title", "NEST CTRL LOGS",
199+
// "-d", configFolder.path,
200+
// "powershell",
201+
// "Get-Content",
202+
// "-Path", "logs/latest-trace.log",
203+
// "-Wait",
204+
// workingDir = configFolder
205+
// )
206+
// },
207+
// colors = ButtonDefaults.outlinedButtonColors(),
208+
//// shape = MaterialTheme.shapes.large,
209+
// contentPadding = PaddingValues(8.dp, 0.dp)
210+
//// border = BorderStroke(
211+
//// OutlinedBorderSize, MaterialTheme.colors.onSecondary.copy(alpha = OutlinedBorderOpacity)
212+
//// ),
213+
//
214+
// ) {
215+
// Icon(
216+
// imageVector = Icons.Outlined.Search,
217+
// contentDescription = "Watch LOgs (TRACE)",
218+
//// tint = deck.color,
219+
// modifier = Modifier.padding(8.dp)
220+
// )
221+
//
222+
// Text("Watch Logs (TRACE)")
223+
// }
224+
// }
225+
// }
218226
}
219227
}
220228
// Column {

0 commit comments

Comments
 (0)