improve main content ui

This commit is contained in:
leminlimez committed 2025-06-03 15:07:44 -04:00
1 parent dcd368817d
commit 23966fcf80
1 file changed
+47 -47
+47 -47
View File
@@ -30,13 +30,11 @@ struct ContentView: View {
var body: some View { var body: some View {
NavigationStack { NavigationStack {
ScrollView { List {
HStack { Section {} header: {
Label("Version \(Bundle.main.releaseVersionNumber ?? "UNKNOWN") (\(Int(buildNumber) != 0 ? "Beta \(buildNumber)" : NSLocalizedString("Release", comment:"")))", systemImage: "info.circle.fill") Label("Version \(Bundle.main.releaseVersionNumber ?? "UNKNOWN") (\(Int(buildNumber) != 0 ? "Beta \(buildNumber)" : NSLocalizedString("Release", comment:"")))", systemImage: "info.circle.fill")
Spacer() .font(.caption)
} }
.font(.caption)
.padding(.bottom, 10)
Section { Section {
Button(action: { Button(action: {
@@ -46,21 +44,18 @@ struct ContentView: View {
Text("Select Tendies") Text("Select Tendies")
} }
.buttonStyle(TintedButton(color: .green, fullwidth: true)) .buttonStyle(TintedButton(color: .green, fullwidth: true))
.padding(.vertical, 10) }
.listRowInsets(EdgeInsets())
.padding(7)
if !selectedTendies.wrappedValue.isEmpty { if !selectedTendies.wrappedValue.isEmpty {
HStack { Section {
Text("Selected Tendies") ForEach(selectedTendies.wrappedValue, id: \.self) { tendie in
.font(.headline) Text(tendie.deletingPathExtension().lastPathComponent)
Spacer()
} }
List { .onDelete(perform: delete)
ForEach(selectedTendies.wrappedValue, id: \.self) { tendie in } header: {
Text(tendie.deletingPathExtension().lastPathComponent) Label("Selected Tendies", systemImage: "document")
}
.onDelete(perform: delete)
}
.frame(height: CGFloat((selectedTendies.wrappedValue.count * 65) + (selectedTendies.wrappedValue.count < 3 ? 100 : 0)), alignment: .top)
} }
} }
@@ -68,42 +63,47 @@ struct ContentView: View {
if pbHash == "" { if pbHash == "" {
Text("Enter your PosterBoard app hash in Settings.") Text("Enter your PosterBoard app hash in Settings.")
} else { } else {
if !selectedTendies.wrappedValue.isEmpty { VStack {
Button(action: { if !selectedTendies.wrappedValue.isEmpty {
UIImpactFeedbackGenerator(style: .soft).impactOccurred() Button(action: {
// UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false) UIImpactFeedbackGenerator(style: .soft).impactOccurred()
// UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { // DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
do { do {
try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash) try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash)
selectedTendies.wrappedValue.removeAll() selectedTendies.wrappedValue.removeAll()
try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL()) try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL())
Haptic.shared.notify(.success) Haptic.shared.notify(.success)
// UIApplication.shared.dismissAlert(animated: true) // UIApplication.shared.dismissAlert(animated: true)
lastError = "The PosterBoard app will now open. Please close it from the app switcher." lastError = "The PosterBoard app will now open. Please close it from the app switcher."
showSuccessAlert.toggle() showSuccessAlert.toggle()
} catch { } catch {
Haptic.shared.notify(.error) Haptic.shared.notify(.error)
// UIApplication.shared.dismissAlert(animated: true) // UIApplication.shared.dismissAlert(animated: true)
lastError = error.localizedDescription lastError = error.localizedDescription
showErrorAlert.toggle() showErrorAlert.toggle()
}
// }
}) {
Text("Apply")
} }
// } .buttonStyle(TintedButton(color: .blue, fullwidth: true))
}) {
Text("Apply")
} }
.buttonStyle(TintedButton(color: .blue, fullwidth: true)) Button(action: {
hideResetHelp = false
}) {
Text("Reset Collections")
}
.buttonStyle(TintedButton(color: .red, fullwidth: true))
} }
Button(action: { .listRowInsets(EdgeInsets())
hideResetHelp = false .padding(7)
}) {
Text("Reset Collections")
}
.buttonStyle(TintedButton(color: .red, fullwidth: true))
} }
} header: {
Label("Actions", systemImage: "hammer")
} }
} }
.padding()
.navigationTitle("Pocket Poster") .navigationTitle("Pocket Poster")
.toolbar { .toolbar {
ToolbarItem(placement: .topBarLeading) { ToolbarItem(placement: .topBarLeading) {