UI tweaks

This commit is contained in:
Thomas Ricouard 2024-09-06 11:32:49 +02:00
parent 904cd3dbd7
commit 435f28dda9
2 changed files with 20 additions and 13 deletions

View file

@ -34,26 +34,32 @@ struct SideBarView<Content: View>: View {
return 0 return 0
} }
private func makeIconForTab(tab: Tab) -> some View { private func makeIconForTab(tab: AppTab) -> some View {
HStack { HStack {
ZStack(alignment: .topTrailing) { ZStack(alignment: .topTrailing) {
SideBarIcon(systemIconName: tab.iconName, SideBarIcon(systemIconName: tab.iconName,
isSelected: tab == selectedTab) isSelected: tab == selectedTab)
let badge = badgeFor(tab: tab) if userPreferences.isSidebarExpanded {
if badge > 0 { Text(tab.title)
makeBadgeView(count: badge) .font(.headline)
.foregroundColor(tab == selectedTab ? theme.tintColor : theme.labelColor)
.frame(maxWidth: .infinity, alignment: .leading)
} }
} }
if userPreferences.isSidebarExpanded { .frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50)
Text(tab.title) .background(tab == selectedTab ? theme.primaryBackgroundColor : .clear,
.font(.headline) in: RoundedRectangle(cornerRadius: 8))
.foregroundColor(tab == selectedTab ? theme.tintColor : theme.labelColor) .cornerRadius(8)
.frame(maxWidth: .infinity, alignment: .leading) .shadow(color: tab == selectedTab ? .black.opacity(0.2) : .clear, radius: 5)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(tab == selectedTab ? theme.labelColor.opacity(0.1) : .clear, lineWidth: 1)
)
let badge = badgeFor(tab: tab)
if badge > 0 {
makeBadgeView(count: 10)
} }
} }
.frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50)
.background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear,
in: RoundedRectangle(cornerRadius: 8))
} }
private func makeBadgeView(count: Int) -> some View { private func makeBadgeView(count: Int) -> some View {
@ -65,7 +71,7 @@ struct SideBarView<Content: View>: View {
.font(.caption2) .font(.caption2)
} }
.frame(width: 24, height: 24) .frame(width: 24, height: 24)
.offset(x: 14, y: -14) .offset(x: 10, y: -10)
} }
private var postButton: some View { private var postButton: some View {

View file

@ -25,6 +25,7 @@ struct TimelineQuickAccessPills: View {
} }
.scrollClipDisabled() .scrollClipDisabled()
.scrollIndicators(.never) .scrollIndicators(.never)
.scrollBounceBehavior(.basedOnSize, axes: [.horizontal, .vertical])
.onChange(of: currentAccount.lists) { _, lists in .onChange(of: currentAccount.lists) { _, lists in
guard client.isAuth else { return } guard client.isAuth else { return }
var filters = pinnedFilters var filters = pinnedFilters