- Add BookmarkLabel model and DTO - Create LabelsRepository and PLabelsRepository protocol - Add GetLabelsUseCase for fetching labels - Update BookmarkMapper to handle labels - Add LabelsView and LabelsViewModel for UI - Update BookmarksView and BookmarkLabelsView to display labels - Add green2 color asset for labels - Update API and repository layers to support labels
41 lines
1.4 KiB
Swift
41 lines
1.4 KiB
Swift
import SwiftUI
|
|
|
|
struct LabelsView: View {
|
|
@State var viewModel = LabelsViewModel()
|
|
@State private var selectedTag: String? = nil
|
|
@State private var selectedBookmark: Bookmark? = nil
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
if viewModel.isLoading {
|
|
ProgressView()
|
|
} else if let errorMessage = viewModel.errorMessage {
|
|
Text("Fehler: \(errorMessage)")
|
|
.foregroundColor(.red)
|
|
} else {
|
|
List {
|
|
ForEach(viewModel.labels, id: \.href) { label in
|
|
|
|
NavigationLink {
|
|
BookmarksView(state: .all, type: [], selectedBookmark: .constant(nil), tag: label.name)
|
|
.navigationTitle("\(label.name) (\(label.count))")
|
|
} label: {
|
|
HStack {
|
|
Text(label.name)
|
|
Spacer()
|
|
Text("\(label.count)")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.onAppear {
|
|
Task {
|
|
await viewModel.loadLabels()
|
|
}
|
|
}
|
|
}
|
|
}
|