2022-12-03 08:46:22 +01:00
|
|
|
//
|
|
|
|
// BrowseToolbar.swift
|
2022-12-12 01:13:50 +01:00
|
|
|
// Browse
|
2022-12-03 08:46:22 +01:00
|
|
|
//
|
|
|
|
// Created by Javier Cicchelli on 03/12/2022.
|
|
|
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2022-12-12 01:13:50 +01:00
|
|
|
import DataModels
|
2022-12-03 08:46:22 +01:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct BrowseToolbar: ToolbarContent {
|
2022-12-12 01:13:50 +01:00
|
|
|
|
|
|
|
// MARK: Properties
|
|
|
|
|
|
|
|
let createFolder: ActionClosure
|
|
|
|
let uploadFile: ActionClosure
|
|
|
|
let showProfile: ActionClosure
|
|
|
|
|
|
|
|
// MARK: Body
|
|
|
|
|
2022-12-03 08:46:22 +01:00
|
|
|
var body: some ToolbarContent {
|
|
|
|
ToolbarItem(placement: .primaryAction) {
|
|
|
|
Menu {
|
|
|
|
Button {
|
2022-12-12 01:13:50 +01:00
|
|
|
createFolder()
|
2022-12-03 08:46:22 +01:00
|
|
|
} label: {
|
|
|
|
Label {
|
2022-12-03 09:15:23 +01:00
|
|
|
Text(
|
|
|
|
"browse.toolbar_item.button.add_folder.text",
|
2022-12-18 01:07:04 +01:00
|
|
|
bundle: .module
|
2022-12-03 09:15:23 +01:00
|
|
|
)
|
2022-12-03 08:46:22 +01:00
|
|
|
} icon: {
|
|
|
|
Image.newFolder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2022-12-12 01:13:50 +01:00
|
|
|
uploadFile()
|
2022-12-03 08:46:22 +01:00
|
|
|
} label: {
|
|
|
|
Label {
|
2022-12-03 09:15:23 +01:00
|
|
|
Text(
|
|
|
|
"browse.toolbar_item.button.add_file.text",
|
2022-12-18 01:07:04 +01:00
|
|
|
bundle: .module
|
2022-12-03 09:15:23 +01:00
|
|
|
)
|
2022-12-03 08:46:22 +01:00
|
|
|
} icon: {
|
|
|
|
Image.newFile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} label: {
|
|
|
|
Label {
|
2022-12-03 09:15:23 +01:00
|
|
|
Text(
|
|
|
|
"browse.toolbar_item.menu.add_actions.text",
|
2022-12-18 01:07:04 +01:00
|
|
|
bundle: .module
|
2022-12-03 09:15:23 +01:00
|
|
|
)
|
2022-12-03 08:46:22 +01:00
|
|
|
} icon: {
|
|
|
|
Image.add
|
2022-12-15 22:54:23 +01:00
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 24, height: 24)
|
2022-12-03 08:46:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolbarItem(placement: .navigationBarTrailing) {
|
|
|
|
Button {
|
2022-12-12 01:13:50 +01:00
|
|
|
showProfile()
|
2022-12-03 08:46:22 +01:00
|
|
|
} label: {
|
2022-12-03 09:15:23 +01:00
|
|
|
Label {
|
|
|
|
Text(
|
|
|
|
"browse.toolbar_item.button.show_profile.text",
|
2022-12-18 01:07:04 +01:00
|
|
|
bundle: .module
|
2022-12-03 09:15:23 +01:00
|
|
|
)
|
|
|
|
} icon: {
|
|
|
|
Image.profile
|
2022-12-15 22:54:23 +01:00
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 24, height: 24)
|
2022-12-03 09:15:23 +01:00
|
|
|
}
|
2022-12-03 08:46:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-12 01:13:50 +01:00
|
|
|
|
2022-12-03 08:46:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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")
|
|
|
|
}
|