Drop "Name" field from modules (#909)

Will rather add a "Notes" field to profiles. Module names feel
overwhelming.
This commit is contained in:
Davide 2024-11-22 10:05:08 +01:00 committed by GitHub
parent 72f6a1b1a1
commit 366dc62231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 11 deletions

View File

@ -80,7 +80,7 @@ struct OpenVPNView: View, ModuleDraftEditing {
var body: some View { var body: some View {
contentView contentView
.moduleView(editor: editor, draft: draft.wrappedValue, withName: !isServerPushed) .moduleView(editor: editor, draft: draft.wrappedValue)
.fileImporter( .fileImporter(
isPresented: $isImporting, isPresented: $isImporting,
allowedContentTypes: [.item], allowedContentTypes: [.item],

View File

@ -33,16 +33,8 @@ struct ModuleViewModifier<T>: ViewModifier where T: ModuleBuilder & Equatable {
let draft: T let draft: T
let withName: Bool
func body(content: Content) -> some View { func body(content: Content) -> some View {
Form { Form {
if withName {
NameSection(
name: editor.binding(forNameOf: draft.id),
placeholder: draft.moduleType.localizedDescription
)
}
content content
} }
.themeForm() .themeForm()
@ -52,7 +44,7 @@ struct ModuleViewModifier<T>: ViewModifier where T: ModuleBuilder & Equatable {
} }
extension View { extension View {
func moduleView<T>(editor: ProfileEditor, draft: T, withName: Bool = true) -> some View where T: ModuleBuilder & Equatable { func moduleView<T>(editor: ProfileEditor, draft: T) -> some View where T: ModuleBuilder & Equatable {
modifier(ModuleViewModifier(editor: editor, draft: draft, withName: withName)) modifier(ModuleViewModifier(editor: editor, draft: draft))
} }
} }