diff --git a/BeReal.xcodeproj/project.pbxproj b/BeReal.xcodeproj/project.pbxproj index e142b2f..34c0285 100644 --- a/BeReal.xcodeproj/project.pbxproj +++ b/BeReal.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 02CE5557293B134200730DC9 /* Image+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5556293B134200730DC9 /* Image+Helpers.swift */; }; 02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5558293B1AB600730DC9 /* Text+Helpers.swift */; }; 02CE555B293B1D8400730DC9 /* BrowseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE555A293B1D8400730DC9 /* BrowseView.swift */; }; + 02CE555E293B34E900730DC9 /* BrowseToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE555D293B34E900730DC9 /* BrowseToolbar.swift */; }; 02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FFFD7A29395DD200306533 /* String+Constants.swift */; }; 4694AAA0293A7C8800D54903 /* Modules in Frameworks */ = {isa = PBXBuildFile; productRef = 4694AA9F293A7C8800D54903 /* Modules */; }; /* End PBXBuildFile section */ @@ -57,6 +58,7 @@ 02CE5556293B134200730DC9 /* Image+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Image+Helpers.swift"; sourceTree = ""; }; 02CE5558293B1AB600730DC9 /* Text+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+Helpers.swift"; sourceTree = ""; }; 02CE555A293B1D8400730DC9 /* BrowseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseView.swift; sourceTree = ""; }; + 02CE555D293B34E900730DC9 /* BrowseToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseToolbar.swift; sourceTree = ""; }; 02FFFD7A29395DD200306533 /* String+Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Constants.swift"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -151,6 +153,7 @@ children = ( 02CE5555293B131D00730DC9 /* Extensions */, 02B334E6293A93CE00C45E31 /* Components */, + 02CE555C293B34CF00730DC9 /* Toolbars */, 02B334E5293A93C400C45E31 /* Views */, ); path = Browse; @@ -182,6 +185,14 @@ path = Extensions; sourceTree = ""; }; + 02CE555C293B34CF00730DC9 /* Toolbars */ = { + isa = PBXGroup; + children = ( + 02CE555D293B34E900730DC9 /* BrowseToolbar.swift */, + ); + path = Toolbars; + sourceTree = ""; + }; 02FFFD7929395DBF00306533 /* Extensions */ = { isa = PBXGroup; children = ( @@ -339,6 +350,7 @@ 02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */, 02AE64EF29363DBF005A4AF3 /* BeRealApp.swift in Sources */, 02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */, + 02CE555E293B34E900730DC9 /* BrowseToolbar.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/BeReal/Browse/Toolbars/BrowseToolbar.swift b/BeReal/Browse/Toolbars/BrowseToolbar.swift new file mode 100644 index 0000000..5508bf8 --- /dev/null +++ b/BeReal/Browse/Toolbars/BrowseToolbar.swift @@ -0,0 +1,62 @@ +// +// BrowseToolbar.swift +// BeReal +// +// Created by Javier Cicchelli on 03/12/2022. +// Copyright © 2022 Röck+Cöde. All rights reserved. +// + +import SwiftUI + +struct BrowseToolbar: ToolbarContent { + var body: some ToolbarContent { + ToolbarItem(placement: .primaryAction) { + Menu { + Button { + // TODO: Implement the creation of a new folder. + } label: { + Label { + Text("Create a new folder") + } icon: { + Image.newFolder + } + } + + Button { + // TODO: Implement the upload of a file from the device to the API. + } label: { + Label { + Text("Upload a file") + } icon: { + Image.newFile + } + } + } label: { + Label { + Text("Add file and/or folder") + } icon: { + Image.add + .foregroundColor(.red) + } + } + } + + ToolbarItem(placement: .navigationBarTrailing) { + Button { + // TODO: Implement the show of the user profile. + } label: { + Image.profile + .foregroundColor(.red) + } + } + } +} + +// MARK: - Image+Constants + +private extension Image { + static let profile = Image(systemName: "person.crop.circle.fill") + static let add = Image(systemName: "plus.circle.fill") + static let newFolder = Image(systemName: "folder.badge.plus") + static let newFile = Image(systemName: "doc.badge.plus") +} diff --git a/BeReal/Browse/Views/BrowseView.swift b/BeReal/Browse/Views/BrowseView.swift index 6c9e074..5fc1369 100644 --- a/BeReal/Browse/Views/BrowseView.swift +++ b/BeReal/Browse/Views/BrowseView.swift @@ -64,7 +64,7 @@ struct BrowseView: View { allowsFullSwipe: true ) { Button { - // ... + // TODO: Implement the removal of the item from the API. } label: { Label { Text("Delete item") @@ -76,7 +76,7 @@ struct BrowseView: View { // TODO: allow download only if item is a file. Button { - // ... + // TODO: Implement the downloading of the data of the item from the API into the device. } label: { Label { Text("Download item") @@ -91,45 +91,7 @@ struct BrowseView: View { .background(Color.red) .navigationTitle("Folder name") .toolbar { - ToolbarItem(placement: .primaryAction) { - Menu { - Button { - // TODO: Implement the creation of a new folder. - } label: { - Label { - Text("Create a new folder") - } icon: { - Image.newFolder - } - } - - Button { - // TODO: Implement the upload of a file from the device to the API. - } label: { - Label { - Text("Upload a file") - } icon: { - Image.newFile - } - } - } label: { - Label { - Text("Add file and/or folder") - } icon: { - Image.add - .foregroundColor(.red) - } - } - } - - ToolbarItem(placement: .navigationBarTrailing) { - Button { - // TODO: Implement the show of the user profile. - } label: { - Image.profile - .foregroundColor(.red) - } - } + BrowseToolbar() } } } @@ -137,10 +99,6 @@ struct BrowseView: View { // MARK: - Image+Constants private extension Image { - static let profile = Image(systemName: "person.crop.circle.fill") - static let add = Image(systemName: "plus.circle.fill") - static let newFolder = Image(systemName: "folder.badge.plus") - static let newFile = Image(systemName: "doc.badge.plus") static let trash = Image(systemName: "trash") static let download = Image(systemName: "arrow.down.doc") }