refactor(#78): extract shared components and common strings to resources

This commit is contained in:
Hy4ri committed 2026-06-21 11:00:20 +03:00
1 parent 19d44c077b
commit 8efbe02c27
4 files changed
+26 -5

No files matched your search

@@ -21,6 +21,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import com.m57.hermescontrol.R
/** /**
* Shared Scaffold wrapper that standardizes the TopAppBar. * Shared Scaffold wrapper that standardizes the TopAppBar.
@@ -69,7 +71,7 @@ fun HermesScaffold(
IconButton(onClick = onBack) { IconButton(onClick = onBack) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = stringResource(R.string.content_desc_back),
modifier = Modifier.testTag("back_button"), modifier = Modifier.testTag("back_button"),
) )
} }
@@ -79,7 +81,7 @@ fun HermesScaffold(
IconButton(onClick = onOpenDrawer) { IconButton(onClick = onOpenDrawer) {
Icon( Icon(
imageVector = Icons.Filled.Menu, imageVector = Icons.Filled.Menu,
contentDescription = "Open navigation drawer", contentDescription = stringResource(R.string.content_desc_open_drawer),
modifier = Modifier.testTag("menu_button"), modifier = Modifier.testTag("menu_button"),
) )
} }
@@ -91,7 +93,7 @@ fun HermesScaffold(
IconButton(onClick = onRefresh) { IconButton(onClick = onRefresh) {
Icon( Icon(
imageVector = Icons.Filled.Refresh, imageVector = Icons.Filled.Refresh,
contentDescription = "Refresh", contentDescription = stringResource(R.string.content_desc_refresh),
modifier = Modifier.testTag("refresh_button"), modifier = Modifier.testTag("refresh_button"),
) )
} }
@@ -31,8 +31,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.m57.hermescontrol.R
import com.m57.hermescontrol.theme.LocalHermesStatusColors import com.m57.hermescontrol.theme.LocalHermesStatusColors
import com.m57.hermescontrol.theme.LocalSpacing import com.m57.hermescontrol.theme.LocalSpacing
@@ -215,7 +217,7 @@ fun SearchBar(
IconButton(onClick = { onQueryChange("") }) { IconButton(onClick = { onQueryChange("") }) {
Icon( Icon(
imageVector = Icons.Filled.Close, imageVector = Icons.Filled.Close,
contentDescription = "Clear search", contentDescription = stringResource(R.string.content_desc_clear_search),
) )
} }
} }
@@ -23,8 +23,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.m57.hermescontrol.R
import com.m57.hermescontrol.theme.LocalSpacing import com.m57.hermescontrol.theme.LocalSpacing
// Unified loading / error / empty / skeleton placeholders so every screen // Unified loading / error / empty / skeleton placeholders so every screen
@@ -94,7 +96,7 @@ fun ErrorState(
modifier = Modifier.size(18.dp), modifier = Modifier.size(18.dp),
) )
Spacer(modifier = Modifier.size(spacing.sm)) Spacer(modifier = Modifier.size(spacing.sm))
Text("Retry") Text(stringResource(R.string.action_retry))
} }
} }
} }
+15
View File
@@ -13,4 +13,19 @@
<string name="chat_prev_match_desc">Previous match</string> <string name="chat_prev_match_desc">Previous match</string>
<string name="chat_next_match_desc">Next match</string> <string name="chat_next_match_desc">Next match</string>
<string name="chat_close_search_desc">Close search</string> <string name="chat_close_search_desc">Close search</string>
<!-- Actions -->
<string name="action_retry">Retry</string>
<string name="action_cancel">Cancel</string>
<string name="action_ok">OK</string>
<string name="action_delete">Delete</string>
<!-- Content Descriptions -->
<string name="content_desc_back">Back</string>
<string name="content_desc_open_drawer">Open navigation drawer</string>
<string name="content_desc_refresh">Refresh</string>
<string name="content_desc_clear_search">Clear search</string>
<!-- General Errors -->
<string name="error_unknown">Unknown error</string>
</resources> </resources>