style: correct translation header and footer layout
This commit is contained in:
@@ -26,16 +26,6 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
let title = NSTextField(labelWithString: "Conjure Translate · English → Japanese")
|
||||
title.font = .systemFont(ofSize: 13, weight: .semibold)
|
||||
title.textColor = SunsetPalette.text
|
||||
let back = NSButton(title: "", target: self, action: #selector(goBack))
|
||||
back.image = IconStyle.symbol("chevron.left", for: title.font!)
|
||||
back.imageScaling = .scaleProportionallyDown
|
||||
back.isBordered = false
|
||||
back.contentTintColor = SunsetPalette.secondaryText
|
||||
back.setAccessibilityLabel("Back to applications")
|
||||
back.toolTip = "Back to applications (Escape)"
|
||||
let heading = NSStackView(views: [back, title, NSView()])
|
||||
heading.alignment = .centerY
|
||||
heading.spacing = 12
|
||||
provider.addItems(withTitles: ["MyMemory (no key)", "OpenAI · gpt-6-luna"])
|
||||
provider.selectItem(at: UserDefaults.standard.string(forKey: "translationProvider") == "openai" ? 1 : 0)
|
||||
provider.setAccessibilityLabel("Translation provider")
|
||||
@@ -75,8 +65,10 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
returnKey.centerYAnchor.constraint(equalTo: actionPill.centerYAnchor),
|
||||
returnKey.trailingAnchor.constraint(equalTo: actionPill.trailingAnchor, constant: -12),
|
||||
])
|
||||
let footer = NSStackView(views: [NSView(), actionPill])
|
||||
let footer = NSStackView(views: [status, NSView(), actionPill])
|
||||
footer.orientation = .horizontal
|
||||
footer.alignment = .centerY
|
||||
footer.spacing = 12
|
||||
footer.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(footer)
|
||||
output.isEditable = false
|
||||
@@ -98,7 +90,8 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
disclosure.setAccessibilityLabel("Translation provider, privacy, and limits")
|
||||
status.font = .systemFont(ofSize: 12)
|
||||
status.setAccessibilityLabel("Translation status and errors")
|
||||
let stack = NSStackView(views: [heading, provider, disclosure, credentials, scroll, status])
|
||||
status.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
let stack = NSStackView(views: [title, provider, disclosure, credentials, scroll])
|
||||
stack.orientation = .vertical
|
||||
stack.alignment = .leading
|
||||
stack.spacing = 12
|
||||
@@ -106,8 +99,6 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(stack)
|
||||
NSLayoutConstraint.activate([
|
||||
back.widthAnchor.constraint(equalToConstant: 22),
|
||||
back.heightAnchor.constraint(equalToConstant: 22),
|
||||
stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
|
||||
stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16),
|
||||
stack.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
@@ -120,7 +111,6 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
disclosure.widthAnchor.constraint(equalTo: stack.widthAnchor),
|
||||
scroll.widthAnchor.constraint(equalTo: stack.widthAnchor),
|
||||
scroll.heightAnchor.constraint(greaterThanOrEqualToConstant: 100),
|
||||
status.widthAnchor.constraint(equalTo: stack.widthAnchor),
|
||||
])
|
||||
updateProvider()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user