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,16 +34,11 @@ 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 badge > 0 {
makeBadgeView(count: badge)
}
}
if userPreferences.isSidebarExpanded { if userPreferences.isSidebarExpanded {
Text(tab.title) Text(tab.title)
.font(.headline) .font(.headline)
@ -52,8 +47,19 @@ struct SideBarView<Content: View>: View {
} }
} }
.frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50) .frame(width: (userPreferences.isSidebarExpanded ? .sidebarWidthExpanded : .sidebarWidth) - 24, height: 50)
.background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear, .background(tab == selectedTab ? theme.primaryBackgroundColor : .clear,
in: RoundedRectangle(cornerRadius: 8)) in: RoundedRectangle(cornerRadius: 8))
.cornerRadius(8)
.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)
}
}
} }
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