fix(panel): keep source available after it is collapsed

Render the source disclosure whenever the source-preview setting is enabled, instead of hiding it when its expanded state is false. The collapsed label becomes 'Show source' with a matching tooltip and localized English/German strings, so the source can be reopened.

Verified: make verify green.
This commit is contained in:
schihei committed 2026-11-26 14:47:04 +01:00
1 parent f466e6dd1c
commit f8064ac430
4 files changed
+8 -2

No files matched your search

+3 -2
View File
@@ -14,7 +14,7 @@ struct PanelView: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
header
if showSource, let source = model.source {
if model.configuration.showSourcePreview, let source = model.source {
sourcePreview(source)
}
translationArea
@@ -112,10 +112,11 @@ struct PanelView: View {
}
.frame(maxHeight: 100)
} label: {
Text(String(localized: "Source"))
Text(showSource ? String(localized: "Source") : String(localized: "Show source"))
.font(.caption.weight(.semibold))
.foregroundStyle(.secondary)
}
.help(showSource ? String(localized: "Hide source") : String(localized: "Show source"))
.accessibilityLabel(String(localized: "Source text"))
}
@@ -14,6 +14,8 @@
"Drag to move panel" = "Zum Verschieben ziehen";
"Translation text size" = "Schriftgröße der Übersetzung";
"Source" = "Quelle";
"Show source" = "Quelle anzeigen";
"Hide source" = "Quelle ausblenden";
"Settings" = "Einstellungen";
"Search languages" = "Sprachen suchen";
"Copy" = "Kopieren";
@@ -14,6 +14,8 @@
"Drag to move panel" = "Drag to move panel";
"Translation text size" = "Translation text size";
"Source" = "Source";
"Show source" = "Show source";
"Hide source" = "Hide source";
"Settings" = "Settings";
"Search languages" = "Search languages";
"Copy" = "Copy";