Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 70 additions & 66 deletions Maskbook.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Maskbook/Extension/SwiftUI/SwiftUI+Placeholder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import SwiftUI

extension View {
func placeholder<Content: View>(
when shouldShow: Bool,
alignment: Alignment = .leading,
@ViewBuilder placeholder: () -> Content) -> some View {

ZStack(alignment: alignment) {
placeholder().opacity(shouldShow ? 1 : 0)
self
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
{
"filename" : "drop.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "Frame 2291.pdf",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
{
"filename" : "Lock.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "Lock-1.pdf",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
{
"filename" : "share.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "share-1.pdf",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Binary file not shown.
37 changes: 31 additions & 6 deletions Maskbook/Scene/App/RedPacket/View/LuckyDropTokens.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct LuckyDropTokens: View {
if let url = viewModel.tokenURL {
KFImage(url)
.cancelOnDisappear(true)
.loadImmediately()
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24)
Expand All @@ -87,7 +86,14 @@ struct LuckyDropTokens: View {
}
.disabled(!viewModel.maxButtonEnable)
Spacer()
TextField(viewModel.amountPlaceholder, text: $viewModel.amountStr)
TextField("", text: $viewModel.amountStr)
.placeholder(when: viewModel.amountStr.isEmpty, alignment: .trailing, placeholder: {
Text(viewModel.amountPlaceholder)
.font(FontStyles.mh5.font)
.foregroundColor(Asset.Colors.Text.light.asColor())
})
.font(FontStyles.bh5.font)
.foregroundColor(Asset.Colors.Text.dark.asColor())
.keyboardType(.decimalPad)
.multilineTextAlignment(.trailing)
.frame(maxHeight: .infinity)
Expand All @@ -107,10 +113,18 @@ struct LuckyDropTokens: View {
.aspectRatio(contentMode: .fit)
.frame(width: 24)
Spacer().frame(width: 8)
Text(L10n.Plugins.Luckydrop.quantity).foregroundColor(Asset.Colors.Text.dark.asColor())
Text(L10n.Plugins.Luckydrop.quantity)
.foregroundColor(Asset.Colors.Text.dark.asColor())
.font(FontStyles.bh5.font)
Spacer()
TextField(L10n.Plugins.Luckydrop.enterQuantity, text: $viewModel.quantityStr)
TextField("", text: $viewModel.quantityStr)
.placeholder(when: viewModel.quantityStr.isEmpty, alignment: .trailing, placeholder: {
Text(L10n.Plugins.Luckydrop.enterQuantity)
.font(FontStyles.mh5.font)
.foregroundColor(Asset.Colors.Text.light.asColor())
})
.font(FontStyles.bh5.font)
.foregroundColor(Asset.Colors.Text.dark.asColor())
.keyboardType(.numberPad)
.multilineTextAlignment(.trailing)
.frame(maxHeight: .infinity)
Expand All @@ -131,7 +145,14 @@ struct LuckyDropTokens: View {
@ViewBuilder
var messageRow: some View {
HStack(spacing: 0) {
TextField(L10n.Plugins.Luckydrop.enterMessage, text: $viewModel.message)
TextField("", text: $viewModel.message)
.placeholder(when: viewModel.message.isEmpty, alignment: .trailing, placeholder: {
Text(L10n.Plugins.Luckydrop.enterMessage)
.font(FontStyles.mh5.font)
.foregroundColor(Asset.Colors.Text.light.asColor())
})
.font(FontStyles.bh5.font)
.foregroundColor(Asset.Colors.Text.dark.asColor())
.limitText($viewModel.message, maxLength: 30)
.frame(maxHeight: .infinity)
.responderTag(TextFieldTag.message)
Expand Down Expand Up @@ -202,7 +223,11 @@ struct LuckyDropTokens: View {
}
Text(mode.title)
.font(FontStyles.bh5.font)
.foregroundColor(Asset.Colors.Text.dark.asColor())
.foregroundColor(
viewModel.mode == mode
? Asset.Colors.Text.dark.asColor()
: Asset.Colors.Text.normal.asColor()
)
Spacer()
}
}
Expand Down