mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 02:29:55 +02:00
refactor(apple): redesign the composer source buttons
Replace the bare text links under Start sharing with an even row of bordered, icon-led buttons (Change files, Choose folder, plus Clear on wider layouts). Single-line labels keep them equal height, and a neutral tint keeps them quiet so the purple Start sharing reads as the primary action.
This commit is contained in:
@@ -75,29 +75,41 @@ struct TransferComposer: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
private var actions: some View {
|
private var actions: some View {
|
||||||
let shareTitle = state.isSharing
|
let shareTitle = state.isSharing
|
||||||
? String(localized: L10n.Button.sharingFile) : String(localized: L10n.Button.shareFile)
|
? String(localized: L10n.Button.sharingFile) : String(localized: L10n.Button.shareFile)
|
||||||
let shareButton = PrimaryButton(
|
return VStack(spacing: 10) {
|
||||||
title: shareTitle, action: model.createShare,
|
PrimaryButton(
|
||||||
enabled: state.canCreateShare(coreInitialized: model.coreState.isInitialized)
|
title: shareTitle, action: model.createShare,
|
||||||
)
|
enabled: state.canCreateShare(coreInitialized: model.coreState.isInitialized)
|
||||||
if windowClass == .phone {
|
)
|
||||||
VStack(spacing: 8) {
|
// Secondary source actions as an even row of bordered buttons rather than
|
||||||
shareButton
|
// bare text links, so they read as controls and align with the primary.
|
||||||
QuietButton(title: String(localized: L10n.Button.changeFiles), action: model.selectFile, enabled: !state.isSharing)
|
HStack(spacing: 10) {
|
||||||
QuietButton(title: String(localized: L10n.Button.chooseFolder), action: model.selectFolder, enabled: !state.isSharing)
|
sourceButton(title: L10n.Button.changeFiles, symbol: .docBadgeArrowUp, action: model.selectFile)
|
||||||
}
|
sourceButton(title: L10n.Button.chooseFolder, symbol: .folder, action: model.selectFolder)
|
||||||
} else {
|
if windowClass != .phone {
|
||||||
HStack(spacing: 8) {
|
sourceButton(title: L10n.Button.clear, symbol: .xmark, action: model.clearSelectedSource)
|
||||||
shareButton.fixedSize()
|
}
|
||||||
QuietButton(title: String(localized: L10n.Button.changeFiles), action: model.selectFile, enabled: !state.isSharing)
|
|
||||||
QuietButton(title: String(localized: L10n.Button.chooseFolder), action: model.selectFolder, enabled: !state.isSharing)
|
|
||||||
QuietButton(title: String(localized: L10n.Button.clear), action: model.clearSelectedSource, enabled: !state.isSharing)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func sourceButton(
|
||||||
|
title: String.LocalizationValue, symbol: SFSymbol, action: @escaping () -> Void
|
||||||
|
) -> some View {
|
||||||
|
Button(action: action) {
|
||||||
|
Label(String(localized: title), systemSymbol: symbol)
|
||||||
|
.lineLimit(1)
|
||||||
|
.minimumScaleFactor(0.85)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.frame(minHeight: 20)
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.controlSize(.large)
|
||||||
|
.tint(.secondary)
|
||||||
|
.disabled(state.isSharing)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct SelectedFileCard: View {
|
private struct SelectedFileCard: View {
|
||||||
|
|||||||
Reference in New Issue
Block a user