implemented the UI to manage authorized spaces

This commit is contained in:
Mauro Romito
2025-11-28 17:45:37 +01:00
committed by Mauro
parent 0dcf1ffda2
commit 0782faeadd
7 changed files with 189 additions and 11 deletions
@@ -0,0 +1,48 @@
//
// Copyright 2025 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Compound
import SwiftUI
struct ToolbarButton: View {
enum Role {
case cancel
case done
var title: String {
switch self {
case .cancel:
L10n.actionCancel
case .done:
L10n.actionDone
}
}
var icon: CompoundIcon {
switch self {
case .cancel:
CompoundIcon(\.close)
case .done:
CompoundIcon(\.check)
}
}
}
let role: Role
let action: () -> Void
var body: some View {
if #available(iOS 26, *) {
Button(action: action) {
role.icon
.accessibilityLabel(role.title)
}
} else {
Button(role.title, action: action)
}
}
}