Skip to content

Commit 7e5c61e

Browse files
[PM-22177] Move add/edit send text/file into send details section and move delete button (#1626)
1 parent b164fef commit 7e5c61e

19 files changed

+23
-16
lines changed

BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemView.swift

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
1616

1717
var body: some View {
1818
ZStack {
19-
VStack(alignment: .leading, spacing: 8) {
19+
VStack(alignment: .leading, spacing: 16) {
2020
if store.state.isSendDisabled {
2121
InfoContainer(Localizations.sendDisabledWarning)
2222
.accessibilityIdentifier("DisabledSendPolicyLabel")
@@ -25,16 +25,13 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
2525
.accessibilityIdentifier("HideEmailAddressPolicyLabel")
2626
}
2727

28-
switch store.state.type {
29-
case .text:
30-
textSendAttributes
31-
case .file:
32-
fileSendAttributes
33-
}
34-
3528
sendDetails
3629

3730
additionalOptions
31+
32+
if store.state.mode == .edit {
33+
deleteSendButton
34+
}
3835
}
3936
.scrollView(padding: 12)
4037
.disabled(store.state.isSendDisabled)
@@ -95,10 +92,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
9592
}
9693
}
9794
}
98-
99-
AsyncButton(Localizations.delete, role: .destructive) {
100-
await store.perform(.deletePressed)
101-
}
10295
}
10396
}
10497
}
@@ -164,7 +157,16 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
164157
)
165158
)
166159
}
167-
.padding(.top, 8)
160+
}
161+
162+
/// The button to delete the send.
163+
private var deleteSendButton: some View {
164+
AsyncButton {
165+
await store.perform(.deletePressed)
166+
} label: {
167+
Label(Localizations.deleteSend, image: Asset.Images.trash16.swiftUIImage, scaleImageDimension: 16)
168+
}
169+
.buttonStyle(.secondary(isDestructive: true, size: .medium))
168170
}
169171

170172
/// The deletion date field.
@@ -190,7 +192,7 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
190192

191193
/// The attributes for a file type send.
192194
@ViewBuilder private var fileSendAttributes: some View {
193-
SectionView(Localizations.file, contentSpacing: 8) {
195+
VStack(alignment: .leading, spacing: 8) {
194196
switch store.state.mode {
195197
case .add, .shareExtension:
196198
if let fileName = store.state.fileName {
@@ -209,7 +211,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
209211
}
210212
.buttonStyle(.secondary())
211213
.accessibilityIdentifier("SendChooseFileButton")
212-
.padding(.top, 4)
213214
}
214215

215216
Text(Localizations.maxFileSize)
@@ -239,7 +240,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
239240
}
240241
}
241242
}
242-
.padding(.top, 8)
243243
}
244244

245245
/// The name field.
@@ -280,6 +280,13 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length
280280
SectionView(Localizations.sendDetails, contentSpacing: 8) {
281281
nameField
282282

283+
switch store.state.type {
284+
case .text:
285+
textSendAttributes
286+
case .file:
287+
fileSendAttributes
288+
}
289+
283290
if store.state.type == .text {
284291
ContentBlock {
285292
BitwardenToggle(Localizations.hideTextByDefault, isOn: store.binding(

0 commit comments

Comments
 (0)