- Refactor authentication flow to require endpoint for login and decouple token saving - Add and integrate search functionality for bookmarks - Simplify and improve server settings setup (remove connection test, direct save & login) - Update sidebar/tab navigation to include search and improve structure - Show placeholder image in BookmarkCardView if no image is available, ensuring consistent layout - Improve BookmarkDetailView header and meta info display - Add utility for domain extraction from URLs - General code cleanup and minor UI/UX improvements
79 lines
2.7 KiB
Swift
79 lines
2.7 KiB
Swift
//
|
|
// PhoneTabView.swift
|
|
// readeck
|
|
//
|
|
// Created by Ilyas Hallak on 01.07.25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PhoneTabView: View {
|
|
private let mainTabs: [SidebarTab] = [.all, .unread, .favorite, .archived]
|
|
private let moreTabs: [SidebarTab] = [.search, .article, .videos, .pictures, .tags, .settings]
|
|
|
|
@State private var selectedMoreTab: SidebarTab? = nil
|
|
@State private var selectedTabIndex: Int = 0
|
|
|
|
var body: some View {
|
|
TabView(selection: $selectedTabIndex) {
|
|
ForEach(Array(mainTabs.enumerated()), id: \.element) { idx, tab in
|
|
NavigationStack {
|
|
tabView(for: tab)
|
|
}
|
|
.tabItem {
|
|
Label(tab.label, systemImage: tab.systemImage)
|
|
}
|
|
.tag(idx)
|
|
}
|
|
|
|
NavigationStack {
|
|
List(moreTabs, id: \.self, selection: $selectedMoreTab) { tab in
|
|
NavigationLink(tag: tab, selection: $selectedMoreTab) {
|
|
tabView(for: tab)
|
|
.navigationTitle(tab.label)
|
|
} label: {
|
|
Label(tab.label, systemImage: tab.systemImage)
|
|
}
|
|
}
|
|
.navigationTitle("Mehr")
|
|
}
|
|
.tabItem {
|
|
Label("Mehr", systemImage: "ellipsis")
|
|
}
|
|
.tag(mainTabs.count)
|
|
.onAppear {
|
|
if selectedTabIndex == mainTabs.count && selectedMoreTab != nil {
|
|
selectedMoreTab = nil
|
|
}
|
|
}
|
|
}
|
|
.accentColor(.accentColor)
|
|
}
|
|
|
|
@ViewBuilder
|
|
private func tabView(for tab: SidebarTab) -> some View {
|
|
switch tab {
|
|
case .all:
|
|
BookmarksView(state: .all, type: [.article, .video, .photo], selectedBookmark: .constant(nil))
|
|
case .unread:
|
|
BookmarksView(state: .unread, type: [.article], selectedBookmark: .constant(nil))
|
|
case .favorite:
|
|
BookmarksView(state: .favorite, type: [.article], selectedBookmark: .constant(nil))
|
|
case .archived:
|
|
BookmarksView(state: .archived, type: [.article], selectedBookmark: .constant(nil))
|
|
case .search:
|
|
SearchBookmarksView(selectedBookmark: .constant(nil))
|
|
case .settings:
|
|
SettingsView()
|
|
case .article:
|
|
BookmarksView(state: .all, type: [.article], selectedBookmark: .constant(nil))
|
|
case .videos:
|
|
BookmarksView(state: .all, type: [.video], selectedBookmark: .constant(nil))
|
|
case .pictures:
|
|
BookmarksView(state: .all, type: [.photo], selectedBookmark: .constant(nil))
|
|
case .tags:
|
|
Text("Tags")
|
|
}
|
|
}
|
|
}
|