Move Help & Feedback button inline
This commit is contained in:
parent
aa10377a55
commit
6ea41020a0
@ -25,6 +25,14 @@ struct HelpAndResourcesSection: View {
|
||||
title: "Documentation",
|
||||
url: "https://tryvoiceink.com/docs"
|
||||
)
|
||||
|
||||
resourceLink(
|
||||
icon: "exclamationmark.bubble.fill",
|
||||
title: "Feedback or Issues?",
|
||||
action: {
|
||||
EmailSupport.openSupportEmail()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
.padding(18)
|
||||
@ -38,9 +46,11 @@ struct HelpAndResourcesSection: View {
|
||||
)
|
||||
}
|
||||
|
||||
private func resourceLink(icon: String, title: String, url: String) -> some View {
|
||||
private func resourceLink(icon: String, title: String, url: String? = nil, action: (() -> Void)? = nil) -> some View {
|
||||
Button(action: {
|
||||
if let url = URL(string: url) {
|
||||
if let action = action {
|
||||
action()
|
||||
} else if let urlString = url, let url = URL(string: urlString) {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}) {
|
||||
|
||||
@ -141,7 +141,6 @@ struct MetricsContent: View {
|
||||
HStack(spacing: 12) {
|
||||
KeyboardShortcutsButton(showKeyboardShortcuts: $showKeyboardShortcuts)
|
||||
CopySystemInfoButton()
|
||||
FeedbackButton()
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,46 +241,6 @@ private enum Formatters {
|
||||
}
|
||||
}
|
||||
|
||||
private struct FeedbackButton: View {
|
||||
@State private var isClicked: Bool = false
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
openFeedback()
|
||||
}) {
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: isClicked ? "checkmark.circle.fill" : "exclamationmark.bubble.fill")
|
||||
.rotationEffect(.degrees(isClicked ? 360 : 0))
|
||||
.animation(.spring(response: 0.3, dampingFraction: 0.7), value: isClicked)
|
||||
|
||||
Text(isClicked ? "Sending" : "Feedback or Issues?")
|
||||
.animation(.spring(response: 0.3, dampingFraction: 0.7), value: isClicked)
|
||||
}
|
||||
.font(.system(size: 13, weight: .medium))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
.background(Capsule().fill(.thinMaterial))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.scaleEffect(isClicked ? 1.1 : 1.0)
|
||||
.animation(.spring(response: 0.3, dampingFraction: 0.7), value: isClicked)
|
||||
}
|
||||
|
||||
private func openFeedback() {
|
||||
EmailSupport.openSupportEmail()
|
||||
|
||||
withAnimation(.spring(response: 0.3, dampingFraction: 0.7)) {
|
||||
isClicked = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
withAnimation(.spring(response: 0.3, dampingFraction: 0.7)) {
|
||||
isClicked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct KeyboardShortcutsButton: View {
|
||||
@Binding var showKeyboardShortcuts: Bool
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user