The `Indefinite` was added to DamusDuration in "Fixing issue with not being able to change mute duration” so this needs to be removed so that there isn’t a repeative item in the menu. Lighting-Address: fishcharlie@strike.me Signed-off-by: Charlie Fish <contact@charlie.fish> Reviewed-by: William Casarin <jb55@jb55.com> Link: 20240210163650.42884-6-contact@charlie.fish Signed-off-by: William Casarin <jb55@jb55.com>
36 lines
655 B
Swift
36 lines
655 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 {
|
|
ForEach(DamusDuration.allCases, id: \.self) { duration in
|
|
Button {
|
|
action(duration)
|
|
} label: {
|
|
Text("\(duration.title)")
|
|
}
|
|
}
|
|
} label: {
|
|
self.label()
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
MuteDurationMenu { _ in
|
|
|
|
} label: {
|
|
Text("Mute hashtag")
|
|
}
|
|
}
|