Move Help & Feedback button inline

This commit is contained in:
Beingpax 2025-12-19 09:48:05 +05:45
parent aa10377a55
commit 6ea41020a0
2 changed files with 12 additions and 43 deletions

View File

@ -25,6 +25,14 @@ struct HelpAndResourcesSection: View {
title: "Documentation", title: "Documentation",
url: "https://tryvoiceink.com/docs" url: "https://tryvoiceink.com/docs"
) )
resourceLink(
icon: "exclamationmark.bubble.fill",
title: "Feedback or Issues?",
action: {
EmailSupport.openSupportEmail()
}
)
} }
} }
.padding(18) .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: { 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) NSWorkspace.shared.open(url)
} }
}) { }) {

View File

@ -141,7 +141,6 @@ struct MetricsContent: View {
HStack(spacing: 12) { HStack(spacing: 12) {
KeyboardShortcutsButton(showKeyboardShortcuts: $showKeyboardShortcuts) KeyboardShortcutsButton(showKeyboardShortcuts: $showKeyboardShortcuts)
CopySystemInfoButton() 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 { private struct KeyboardShortcutsButton: View {
@Binding var showKeyboardShortcuts: Bool @Binding var showKeyboardShortcuts: Bool