forked from shadowfacts/Tusker
Move Drafts button to nav bar when current composed post doesn't have any content
This commit is contained in:
parent
6a3dcca9ee
commit
b506704716
|
@ -78,12 +78,6 @@ struct ComposeToolbar: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button(action: self.draftsButtonPressed) {
|
|
||||||
Text("Drafts")
|
|
||||||
}
|
|
||||||
.padding(5)
|
|
||||||
.hoverEffect()
|
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
.frame(minWidth: minWidth)
|
.frame(minWidth: minWidth)
|
||||||
|
@ -119,10 +113,6 @@ struct ComposeToolbar: View {
|
||||||
uiState.currentInput?.beginAutocompletingEmoji()
|
uiState.currentInput?.beginAutocompletingEmoji()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func draftsButtonPressed() {
|
|
||||||
uiState.isShowingDraftsList = true
|
|
||||||
}
|
|
||||||
|
|
||||||
private func formatAction(_ format: StatusFormat) -> () -> Void {
|
private func formatAction(_ format: StatusFormat) -> () -> Void {
|
||||||
{
|
{
|
||||||
uiState.currentInput?.applyFormat(format)
|
uiState.currentInput?.applyFormat(format)
|
||||||
|
|
|
@ -239,16 +239,25 @@ struct ComposeView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
private var postButton: some View {
|
private var postButton: some View {
|
||||||
Button {
|
if draft.hasContent {
|
||||||
Task {
|
Button {
|
||||||
await self.postStatus()
|
Task {
|
||||||
|
await self.postStatus()
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Text("Post")
|
||||||
|
}
|
||||||
|
.keyboardShortcut(.return, modifiers: .command)
|
||||||
|
.disabled(!postButtonEnabled)
|
||||||
|
} else {
|
||||||
|
Button {
|
||||||
|
uiState.isShowingDraftsList = true
|
||||||
|
} label: {
|
||||||
|
Text("Drafts")
|
||||||
}
|
}
|
||||||
} label: {
|
|
||||||
Text("Post")
|
|
||||||
}
|
}
|
||||||
.keyboardShortcut(.return, modifiers: .command)
|
|
||||||
.disabled(!postButtonEnabled)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func cancel() {
|
private func cancel() {
|
||||||
|
|
Loading…
Reference in New Issue