Skip to content

Commit ec1ebe3

Browse files
committed
refactor(desktop): small improvements
1 parent 0778f1f commit ec1ebe3

File tree

10 files changed

+37
-29
lines changed

10 files changed

+37
-29
lines changed

application/src/desktopMain/kotlin/com/neoutils/neoregex/Main.desktop.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ private fun FrameWindowScope.Header(
107107
.aspectRatio(ratio = 1f)
108108
)
109109
}
110-
}
110+
}

application/src/webMain/kotlin/com/neoutils/neoregex/Main.web.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun main() {
4545
sizeManager.changes.first()
4646
}
4747
) {
48-
NeoTheme(ColorTheme) {
48+
NeoTheme {
4949

5050
body.style.backgroundColor =
5151
colorScheme.background.toCss()

core/common/src/androidMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.android.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* NeoRegex.
33
*
4-
* Copyright (C) 2024 <AUTHOR>.
4+
* Copyright (C) 2024 Irineu A. Silva.
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -43,4 +43,4 @@ val Context.colorTheme
4343
else -> {
4444
ColorTheme.LIGHT
4545
}
46-
}
46+
}

core/common/src/desktopMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.desktop.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* NeoRegex.
33
*
4-
* Copyright (C) 2024 <AUTHOR>.
4+
* Copyright (C) 2024 Irineu A. Silva.
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -43,4 +43,4 @@ actual fun rememberColorTheme(): ColorTheme {
4343
}
4444
}
4545
}
46-
}
46+
}

core/common/src/webMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.web.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* NeoRegex.
33
*
4-
* Copyright (C) 2024 <AUTHOR>.
4+
* Copyright (C) 2024 Irineu A. Silva.
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -30,4 +30,4 @@ actual fun rememberColorTheme(): ColorTheme {
3030
SystemTheme.DARK -> ColorTheme.DARK
3131
SystemTheme.UNKNOWN -> ColorTheme.LIGHT
3232
}
33-
}
33+
}

core/resources/src/commonMain/composeResources/values/strings.xml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818

1919
<resources>
2020
<string name="app_name">NeoRegex</string>
21-
<string name="insert_regex_hint">Enter regular expression</string>
22-
<string name="error_title">Oops! Something went wrong.</string>
23-
<string name="error_message">We'd love to fix this! If possible, please share what happened.</string>
24-
<string name="copy_error">Copy error</string>
25-
<string name="copied">Copied!</string>
26-
<string name="report_error">Report error</string>
27-
<string name="stack_trace">Stack trace</string>
21+
22+
<string name="matcher_footer_insert_regex_hint">Enter regular expression</string>
23+
2824
<string name="fatal_error_title">Fatal error: %1$s</string>
29-
</resources>
25+
<string name="fatal_error_subtitle">Oops! Something went wrong.</string>
26+
<string name="fatal_error_message">We'd love to fix this! If possible, please share what happened.</string>
27+
<string name="fatal_error_copy_btn">Copy error</string>
28+
<string name="fatal_error_copied_label">Copied!</string>
29+
<string name="fatal_error_report_tab">Report error</string>
30+
<string name="fatal_error_report_btn">Report error</string>
31+
<string name="fatal_error_stack_trace_tab">Stack trace</string>
32+
</resources>

core/shared-ui/src/desktopMain/kotlin/com/neoutils/neoregex/core/sharedui/component/FatalErrorWindow.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ package com.neoutils.neoregex.core.sharedui.component
2020

2121
import androidx.compose.foundation.layout.Column
2222
import androidx.compose.foundation.layout.fillMaxSize
23+
import androidx.compose.material.icons.Icons
24+
import androidx.compose.material.icons.twotone.Error
2325
import androidx.compose.material3.Tab
2426
import androidx.compose.material3.TabRow
2527
import androidx.compose.material3.Text
2628
import androidx.compose.runtime.*
2729
import androidx.compose.ui.Alignment
2830
import androidx.compose.ui.Modifier
31+
import androidx.compose.ui.graphics.vector.rememberVectorPainter
2932
import androidx.compose.ui.unit.DpSize
3033
import androidx.compose.ui.unit.dp
3134
import androidx.compose.ui.window.*
3235
import com.neoutils.neoregex.core.resources.Res
36+
import com.neoutils.neoregex.core.resources.fatal_error_report_tab
37+
import com.neoutils.neoregex.core.resources.fatal_error_stack_trace_tab
3338
import com.neoutils.neoregex.core.resources.fatal_error_title
34-
import com.neoutils.neoregex.core.resources.report_error
35-
import com.neoutils.neoregex.core.resources.stack_trace
3639
import org.jetbrains.compose.resources.StringResource
3740
import org.jetbrains.compose.resources.stringResource
3841

@@ -47,11 +50,12 @@ fun ApplicationScope.FatalErrorWindow(
4750

4851
DialogWindow(
4952
onCloseRequest = ::exitApplication,
53+
state = state,
5054
title = stringResource(
5155
Res.string.fatal_error_title,
5256
throwable::class.java.name
5357
),
54-
state = state,
58+
icon = rememberVectorPainter(Icons.TwoTone.Error)
5559
) {
5660
Column(Modifier.fillMaxSize()) {
5761

@@ -93,6 +97,6 @@ fun ApplicationScope.FatalErrorWindow(
9397
}
9498

9599
enum class Tab(val title: StringResource) {
96-
REPORT_ERROR(title = Res.string.report_error),
97-
STACK_TRACE(title = Res.string.stack_trace);
100+
REPORT_ERROR(title = Res.string.fatal_error_report_tab),
101+
STACK_TRACE(title = Res.string.fatal_error_stack_trace_tab);
98102
}

core/shared-ui/src/desktopMain/kotlin/com/neoutils/neoregex/core/sharedui/component/ReportScreen.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ fun ReportScreen(
7373
)
7474

7575
Text(
76-
text = stringResource(Res.string.error_title),
76+
text = stringResource(Res.string.fatal_error_subtitle),
7777
textAlign = TextAlign.Center,
7878
style = MaterialTheme.typography.titleMedium
7979
)
8080

8181
Text(
82-
text = stringResource(Res.string.error_message),
82+
text = stringResource(Res.string.fatal_error_message),
8383
textAlign = TextAlign.Center,
8484
)
8585
}
@@ -115,6 +115,7 @@ private fun BottomButtons(
115115
)
116116
copied = true
117117
},
118+
enabled = !copied,
118119
modifier = Modifier.width(120.dp)
119120
) {
120121
AnimatedContent(
@@ -124,9 +125,9 @@ private fun BottomButtons(
124125
}
125126
) { copied ->
126127
if (copied) {
127-
Text(stringResource(Res.string.copied))
128+
Text(stringResource(Res.string.fatal_error_copied_label))
128129
} else {
129-
Text(stringResource(Res.string.copy_error))
130+
Text(stringResource(Res.string.fatal_error_copy_btn))
130131
}
131132
}
132133
}
@@ -138,6 +139,6 @@ private fun BottomButtons(
138139
)
139140
},
140141
) {
141-
Text(stringResource(Res.string.report_error))
142+
Text(stringResource(Res.string.fatal_error_report_btn))
142143
}
143144
}

core/shared-ui/src/desktopMain/kotlin/com/neoutils/neoregex/core/sharedui/util/Padding.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ data class Padding(
3434
end = end,
3535
bottom = bottom,
3636
)
37-
}
37+
}

feature/matcher/src/commonMain/kotlin/com/neoutils/neoregex/feature/matcher/MatcherScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import com.neoutils.neoregex.feature.matcher.state.matches
6060
import com.neoutils.neoregex.core.resources.Res
6161
import com.neoutils.neoregex.core.resources.ic_redo_24
6262
import com.neoutils.neoregex.core.resources.ic_undo_24
63-
import com.neoutils.neoregex.core.resources.insert_regex_hint
63+
import com.neoutils.neoregex.core.resources.matcher_footer_insert_regex_hint
6464
import org.jetbrains.compose.resources.painterResource
6565
import org.jetbrains.compose.resources.stringResource
6666

@@ -178,7 +178,7 @@ class MatcherScreen : Screen {
178178
else -> false
179179
}
180180
},
181-
hint = stringResource(Res.string.insert_regex_hint),
181+
hint = stringResource(Res.string.matcher_footer_insert_regex_hint),
182182
error = uiState.matchResult.error
183183
)
184184

0 commit comments

Comments
 (0)