mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-03-28 04:25:28 +00:00
Tweaks
This commit is contained in:
parent
24491decec
commit
ce150ea629
1 changed files with 17 additions and 21 deletions
|
@ -7,8 +7,6 @@ import AppAccount
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
struct TipSheetView: View {
|
struct TipSheetView: View {
|
||||||
private let tips = [200, 500, 1000]
|
|
||||||
|
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
@Environment(Theme.self) private var theme: Theme
|
@Environment(Theme.self) private var theme: Theme
|
||||||
@Environment(TipedUsers.self) private var tipedUSers: TipedUsers
|
@Environment(TipedUsers.self) private var tipedUSers: TipedUsers
|
||||||
|
@ -18,7 +16,7 @@ struct TipSheetView: View {
|
||||||
@State private var selectedTip: Int?
|
@State private var selectedTip: Int?
|
||||||
|
|
||||||
private enum TipState: Int, Equatable {
|
private enum TipState: Int, Equatable {
|
||||||
case selection, sending, sent
|
case selection, preparing, webview
|
||||||
}
|
}
|
||||||
|
|
||||||
@State private var state: TipState = .selection
|
@State private var state: TipState = .selection
|
||||||
|
@ -31,11 +29,11 @@ struct TipSheetView: View {
|
||||||
switch state {
|
switch state {
|
||||||
case .selection:
|
case .selection:
|
||||||
tipView
|
tipView
|
||||||
case .sending:
|
case .preparing:
|
||||||
sendingView
|
preparingView
|
||||||
.transition(.blurReplace)
|
.transition(.blurReplace)
|
||||||
case .sent:
|
case .webview:
|
||||||
sentView
|
webView
|
||||||
.transition(.blurReplace)
|
.transition(.blurReplace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,17 +59,15 @@ struct TipSheetView: View {
|
||||||
Text("Subscribe")
|
Text("Subscribe")
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
Text("Subscribe to @\(account.username) to get access to exclusive content!")
|
Text("Subscribe to @\(account.username) to get access to exclusive content!")
|
||||||
WrappingHStack(tips, id: \.self, spacing: .constant(12)) { tip in
|
Button {
|
||||||
Button {
|
withAnimation(.easeInOut(duration: 0.5)) {
|
||||||
withAnimation(.easeInOut(duration: 0.5)) {
|
selectedTip = 500
|
||||||
selectedTip = tip
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Text((Double(tip) / 100.0).formatted(.currency(code: "USD").presentation(.narrow)))
|
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
} label: {
|
||||||
.padding(.vertical, 8)
|
Text("$5 / month")
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.borderedProminent)
|
||||||
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.padding(12)
|
.padding(12)
|
||||||
|
@ -94,15 +90,15 @@ struct TipSheetView: View {
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
tipedUSers.usersIds.append(account.id)
|
tipedUSers.usersIds.append(account.id)
|
||||||
withAnimation {
|
withAnimation {
|
||||||
state = .sending
|
state = .preparing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var sendingView: some View {
|
private var preparingView: some View {
|
||||||
Label("Sending...", systemImage: "wifi")
|
Label("Preparing...", systemImage: "wifi")
|
||||||
.symbolEffect(.variableColor.iterative, options: .repeating, value: animationsending)
|
.symbolEffect(.variableColor.iterative, options: .repeating, value: animationsending)
|
||||||
.font(.title)
|
.font(.title)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
|
@ -113,13 +109,13 @@ struct TipSheetView: View {
|
||||||
}
|
}
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
state = .sent
|
state = .webview
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var sentView: some View {
|
private var webView: some View {
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
Text("Almost there...")
|
Text("Almost there...")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue