Implemented the stack navigation of the folder items in the BrowseView view for the Browse module.
This commit is contained in:
parent
0f0773992f
commit
58a73fa637
@ -19,6 +19,7 @@ public struct BrowseView: View {
|
|||||||
// MARK: States
|
// MARK: States
|
||||||
|
|
||||||
@State private var items: [any FileSystemItemIdentifiable] = []
|
@State private var items: [any FileSystemItemIdentifiable] = []
|
||||||
|
@State private var stack: Stack?
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
@ -49,17 +50,13 @@ public struct BrowseView: View {
|
|||||||
List(items, id: \.id) { item in
|
List(items, id: \.id) { item in
|
||||||
switch item {
|
switch item {
|
||||||
case is Folder:
|
case is Folder:
|
||||||
FolderItem(item: item) { id in
|
makeFolderItem(for: item)
|
||||||
// TODO: browse to the item id in another view.
|
|
||||||
} delete: { id in
|
|
||||||
// TODO: delete the item id from the backend.
|
|
||||||
}
|
|
||||||
case is Document:
|
case is Document:
|
||||||
DocumentItem(item: item) { id in
|
DocumentItem(item: item) {
|
||||||
// TODO: show the item id in a viewer...
|
// TODO: show the item id in a viewer...
|
||||||
} download: { id in
|
} download: {
|
||||||
// TODO: download the item id from the backend.
|
// TODO: download the item id from the backend.
|
||||||
} delete: { id in
|
} delete: {
|
||||||
// TODO: delete the item id from the backend.
|
// TODO: delete the item id from the backend.
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -80,6 +77,35 @@ public struct BrowseView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - UI
|
||||||
|
|
||||||
|
private extension BrowseView {
|
||||||
|
@ViewBuilder func makeFolderItem(
|
||||||
|
for item: any FileSystemItemIdentifiable
|
||||||
|
) -> some View {
|
||||||
|
let folder = Folder(
|
||||||
|
id: item.id,
|
||||||
|
name: item.name
|
||||||
|
)
|
||||||
|
|
||||||
|
FolderItem(item: item) {
|
||||||
|
stack = .browse(folder)
|
||||||
|
} delete: {
|
||||||
|
// TODO: delete the item id from the backend.
|
||||||
|
}
|
||||||
|
.navigate(
|
||||||
|
to: BrowseView(
|
||||||
|
folder: folder,
|
||||||
|
createFolder: createFolder,
|
||||||
|
uploadFile: uploadFile,
|
||||||
|
showProfile: showProfile
|
||||||
|
),
|
||||||
|
tagged: .browse(folder),
|
||||||
|
in: $stack
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user