Present modules tip as popover on macOS (#672)
This commit is contained in:
parent
429e79cd3a
commit
8ad144239e
|
@ -59,6 +59,7 @@ struct ModuleListView: View, Routable {
|
|||
} header: {
|
||||
if !profileEditor.modules.isEmpty {
|
||||
Text(Strings.Global.modules)
|
||||
.themeTip(Strings.Views.Profile.ModuleList.Section.footer, edge: .bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ struct ProfileGeneralView: View {
|
|||
name: $profileEditor.name,
|
||||
placeholder: Strings.Placeholders.Profile.name
|
||||
)
|
||||
EmptyView()
|
||||
.themeSection(footer: Strings.Views.Profile.ModuleList.Section.footer)
|
||||
StorageSection(
|
||||
uuid: profileEditor.id
|
||||
)
|
||||
|
|
|
@ -50,6 +50,7 @@ extension Theme {
|
|||
case share
|
||||
case show
|
||||
case sleeping
|
||||
case tip
|
||||
case tunnelDisable
|
||||
case tunnelEnable
|
||||
case tunnelRestart
|
||||
|
|
|
@ -273,6 +273,37 @@ struct ThemeLockScreenModifier: ViewModifier {
|
|||
}
|
||||
}
|
||||
|
||||
struct ThemeTipModifier: ViewModifier {
|
||||
let text: String
|
||||
|
||||
let edge: Edge
|
||||
|
||||
@State
|
||||
private var isPresenting = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
HStack {
|
||||
content
|
||||
Button {
|
||||
isPresenting = true
|
||||
} label: {
|
||||
ThemeImage(.tip)
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
}
|
||||
.popover(isPresented: $isPresenting, arrowEdge: edge) {
|
||||
VStack {
|
||||
Text(text)
|
||||
.foregroundStyle(.primary)
|
||||
.lineLimit(nil)
|
||||
.multilineTextAlignment(.leading)
|
||||
.frame(width: 150.0)
|
||||
}
|
||||
.padding(12)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Views
|
||||
|
||||
public enum ThemeAnimationCategory: CaseIterable {
|
||||
|
|
|
@ -101,6 +101,7 @@ public final class Theme: ObservableObject {
|
|||
case .share: return "square.and.arrow.up"
|
||||
case .show: return "eye"
|
||||
case .sleeping: return "powersleep"
|
||||
case .tip: return "questionmark.circle"
|
||||
case .tunnelDisable: return "arrow.down"
|
||||
case .tunnelEnable: return "arrow.up"
|
||||
case .tunnelRestart: return "arrow.clockwise"
|
||||
|
@ -208,6 +209,10 @@ extension View {
|
|||
public func themeLockScreen() -> some View {
|
||||
modifier(ThemeLockScreenModifier())
|
||||
}
|
||||
|
||||
public func themeTip(_ text: String, edge: Edge) -> some View {
|
||||
modifier(ThemeTipModifier(text: text, edge: edge))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Views
|
||||
|
|
Loading…
Reference in New Issue