- Adding MuteDurationMenu & AddMuteItemView
- In a future patch I will update AddMuteItemView to actually update and relay the new mute list
Related: https://github.com/damus-io/damus/issues/1718
Related: https://github.com/damus-io/damus/issues/856
Lighting Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
41 lines
901 B
Swift
41 lines
901 B
Swift
//
|
|
// MuteDurationMenu.swift
|
|
// damus
|
|
//
|
|
// Created by Charlie Fish on 1/14/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MuteDurationMenu<T: View>: View {
|
|
var action: (DamusDuration?) -> Void
|
|
@ViewBuilder var label: () -> T
|
|
|
|
var body: some View {
|
|
Menu {
|
|
Button {
|
|
action(nil)
|
|
} label: {
|
|
Text("Indefinite", comment: "Mute a given item indefinitly (until user unmutes it). As opposed to muting the item for a given period of time.")
|
|
}
|
|
ForEach(DamusDuration.allCases, id: \.self) { duration in
|
|
Button {
|
|
action(duration)
|
|
} label: {
|
|
Text("\(duration.title)")
|
|
}
|
|
}
|
|
} label: {
|
|
self.label()
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
MuteDurationMenu { _ in
|
|
|
|
} label: {
|
|
Text("Mute hashtag")
|
|
}
|
|
}
|