From 2fd841775d38f9147fe66d200537e61269000f1b Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 26 Jul 2023 19:36:49 +0800 Subject: [PATCH] Add link button on iPad --- .../App/Views/Home/HomeFeedViewIOS.swift | 2 +- .../App/Views/Home/LibraryAddLinkView.swift | 1 + .../App/Views/PrimaryContentView.swift | 38 ++++++++++++------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 6be5a4831..d7534c69b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -150,7 +150,7 @@ struct AnimatingCellHeight: AnimatableModifier { Label(LocalText.genericProfile, systemImage: "person.circle") }) Button(action: { addLinkPresented = true }, label: { - Label("Add Link", systemImage: "plus.square") + Label("Add Link", systemImage: "plus.circle") }) }, label: { Image.utilityMenu diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryAddLinkView.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryAddLinkView.swift index f136c020c..1755f0c6d 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryAddLinkView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryAddLinkView.swift @@ -61,6 +61,7 @@ Form { TextField("Add Link", text: $newLinkURL) .keyboardType(.URL) + .autocorrectionDisabled(true) .textFieldStyle(StandardTextFieldStyle()) .focused($focusedField, equals: .addLinkEditor) diff --git a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift index cc47355d0..c00315237 100644 --- a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift @@ -56,27 +56,39 @@ import Views } @MainActor struct PrimaryContentSidebar: View { + @State private var addLinkPresented = false @State private var selectedCategory: PrimaryContentCategory? let categories: [PrimaryContentCategory] var innerBody: some View { - List(categories) { category in - NavigationLink( - destination: category.destinationView, - tag: category, - selection: $selectedCategory, - label: { category.listLabel } - ) - #if os(iOS) - .listRowBackground( - category == selectedCategory - ? Color.appGraySolid.opacity(0.4).cornerRadius(8) - : Color.clear.cornerRadius(8) + List { + ForEach(categories, id: \.self) { category in + NavigationLink( + destination: category.destinationView, + tag: category, + selection: $selectedCategory, + label: { category.listLabel } ) - #endif + #if os(iOS) + .listRowBackground( + category == selectedCategory + ? Color.appGraySolid.opacity(0.4).cornerRadius(8) + : Color.clear.cornerRadius(8) + ) + #endif + } + + Button(action: { addLinkPresented = true }, label: { + Label("Add Link", systemImage: "plus.circle") + }) } .dynamicTypeSize(.small ... .large) .listStyle(.sidebar) + .sheet(isPresented: $addLinkPresented) { + NavigationView { + LibraryAddLinkView() + } + } } var body: some View {