Implemented the DocumentToolbar toolbar content for the Browse module.

This commit is contained in:
Javier Cicchelli 2022-12-18 01:07:04 +01:00
parent e78a326595
commit d242171c6e
3 changed files with 51 additions and 9 deletions

View File

@ -46,12 +46,16 @@
"delete_item.system_alert.message" = "An unexpected error occurred while trying to delete the indicated folder from the current folder.\n\nPlease check your Internet connection and try this operation at a later time."; "delete_item.system_alert.message" = "An unexpected error occurred while trying to delete the indicated folder from the current folder.\n\nPlease check your Internet connection and try this operation at a later time.";
"delete_item.system_alert.button.cancel" = "Understood"; "delete_item.system_alert.button.cancel" = "Understood";
// BrowseView // BrowseToolbar
"browse.toolbar_item.menu.add_actions.text" = "Add file and/or folder"; "browse.toolbar_item.menu.add_actions.text" = "Add file and/or folder";
"browse.toolbar_item.button.add_folder.text" = "Create a new folder"; "browse.toolbar_item.button.add_folder.text" = "Create a new folder";
"browse.toolbar_item.button.add_file.text" = "Upload a file"; "browse.toolbar_item.button.add_file.text" = "Upload a file";
"browse.toolbar_item.button.show_profile.text" = "Show profile"; "browse.toolbar_item.button.show_profile.text" = "Show profile";
// DocumentToolbar
"document.toolbar_item.button.download_file.text" = "Download this file";
"browse.swipe_action.delete_item.text" = "Delete item"; "browse.swipe_action.delete_item.text" = "Delete item";
"browse.swipe_action.download_item.text" = "Download item"; "browse.swipe_action.download_item.text" = "Download item";

View File

@ -28,8 +28,7 @@ struct BrowseToolbar: ToolbarContent {
Label { Label {
Text( Text(
"browse.toolbar_item.button.add_folder.text", "browse.toolbar_item.button.add_folder.text",
bundle: .module, bundle: .module
comment: "Add folder button text."
) )
} icon: { } icon: {
Image.newFolder Image.newFolder
@ -42,8 +41,7 @@ struct BrowseToolbar: ToolbarContent {
Label { Label {
Text( Text(
"browse.toolbar_item.button.add_file.text", "browse.toolbar_item.button.add_file.text",
bundle: .module, bundle: .module
comment: "Add file button text."
) )
} icon: { } icon: {
Image.newFile Image.newFile
@ -53,8 +51,7 @@ struct BrowseToolbar: ToolbarContent {
Label { Label {
Text( Text(
"browse.toolbar_item.menu.add_actions.text", "browse.toolbar_item.menu.add_actions.text",
bundle: .module, bundle: .module
comment: "Add actions menu text."
) )
} icon: { } icon: {
Image.add Image.add
@ -72,8 +69,7 @@ struct BrowseToolbar: ToolbarContent {
Label { Label {
Text( Text(
"browse.toolbar_item.button.show_profile.text", "browse.toolbar_item.button.show_profile.text",
bundle: .module, bundle: .module
comment: "Show profile button text."
) )
} icon: { } icon: {
Image.profile Image.profile

View File

@ -0,0 +1,42 @@
//
// DocumentToolbar.swift
// Browse
//
// Created by Javier Cicchelli on 18/12/2022.
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
import DataModels
import SwiftUI
struct DocumentToolbar: ToolbarContent {
// MARK: Properties
let disabled: Bool
let downloadFile: ActionClosure
// MARK: Body
var body: some ToolbarContent {
ToolbarItem(placement: .primaryAction) {
Button {
downloadFile()
} label: {
Label {
Text(
"document.toolbar_item.button.download_file.text",
bundle: .module
)
} icon: {
Image.download
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
}
}
.disabled(disabled)
}
}
}