A bit more consistent style

This commit is contained in:
Thomas Ricouard 2022-12-24 15:09:17 +01:00
parent 5e24c1ee58
commit 44d36c4cf0
8 changed files with 33 additions and 11 deletions

View file

@ -4,6 +4,7 @@ import DesignSystem
import Env
struct AccountDetailHeaderView: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var quickLook: QuickLook
@EnvironmentObject private var routeurPath: RouterPath
@Environment(\.redactionReasons) private var reasons
@ -121,7 +122,7 @@ struct AccountDetailHeaderView: View {
VStack {
Text("\(count)")
.font(.headline)
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
Text(title)
.font(.footnote)
.foregroundColor(.gray)

View file

@ -8,6 +8,7 @@ import Env
public struct AccountDetailView: View {
@Environment(\.redactionReasons) private var reasons
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var routeurPath: RouterPath
@ -178,7 +179,7 @@ public struct AccountDetailView: View {
.foregroundColor(Color.green.opacity(0.80))
}
Text(field.value.asSafeAttributedString)
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
}
.font(.body)
}

View file

@ -164,7 +164,8 @@ class AccountDetailViewModel: ObservableObject, StatusesFetcher {
case .statuses:
tabState = .statuses(statusesState: .display(statuses: statuses, nextPageState: .hasNextPage))
case .favourites:
tabState = .statuses(statusesState: .display(statuses: favourites, nextPageState: .hasNextPage))
tabState = .statuses(statusesState: .display(statuses: favourites,
nextPageState: favouritesNextPage != nil ? .hasNextPage : .none))
case .followedTags:
tabState = .followedTags(tags: followedTags)
}

View file

@ -72,7 +72,7 @@ class AccountsListViewModel: ObservableObject {
Accounts.relationships(ids: accounts.map{ $0.id }))
state = .display(accounts: accounts,
relationships: relationships,
nextPageState: .hasNextPage)
nextPageState: link?.maxId != nil ? .hasNextPage : .none)
} catch { }
}
@ -104,7 +104,7 @@ class AccountsListViewModel: ObservableObject {
self.nextPageId = link?.maxId
state = .display(accounts: accounts,
relationships: relationships,
nextPageState: .hasNextPage)
nextPageState: link?.maxId != nil ? .hasNextPage : .none)
} catch {
print(error)
}

View file

@ -8,6 +8,7 @@ import Shimmer
import Account
public struct ExploreView: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var routeurPath: RouterPath
@ -68,7 +69,7 @@ public struct ExploreView: View {
.navigationBarTitleDisplayMode(.inline)
} label: {
Text("See more")
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
}
}
}
@ -92,7 +93,7 @@ public struct ExploreView: View {
.navigationBarTitleDisplayMode(.inline)
} label: {
Text("See more")
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
}
}
}
@ -117,7 +118,7 @@ public struct ExploreView: View {
.navigationBarTitleDisplayMode(.inline)
} label: {
Text("See more")
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
}
}
}
@ -141,7 +142,7 @@ public struct ExploreView: View {
.navigationBarTitleDisplayMode(.inline)
} label: {
Text("See more")
.foregroundColor(.brand)
.foregroundColor(theme.tintColor)
}
}
}

View file

@ -5,6 +5,7 @@ import Status
import Env
struct NotificationRowView: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var routeurPath: RouterPath
@Environment(\.redactionReasons) private var reasons
@ -33,7 +34,7 @@ struct NotificationRowView: View {
ZStack(alignment: .center) {
Circle()
.strokeBorder(Color.white, lineWidth: 1)
.background(Circle().foregroundColor(Color.brand))
.background(Circle().foregroundColor(theme.tintColor))
.frame(width: 24, height: 24)
Image(systemName: type.iconName())

View file

@ -2,11 +2,14 @@ import SwiftUI
import Models
import Env
import Network
import DesignSystem
struct StatusActionsView: View {
@EnvironmentObject private var routeurPath: RouterPath
@ObservedObject var viewModel: StatusRowViewModel
let generator = UINotificationFeedbackGenerator()
@MainActor
enum Actions: CaseIterable {
case respond, boost, favourite, share
@ -36,6 +39,17 @@ struct StatusActionsView: View {
return nil
}
}
func tintColor(viewModel: StatusRowViewModel) -> Color? {
switch self {
case .respond, .share:
return nil
case .favourite:
return viewModel.isFavourited ? .yellow : nil
case .boost:
return viewModel.isReblogged ? .brand : nil
}
}
}
var body: some View {
@ -54,6 +68,7 @@ struct StatusActionsView: View {
} label: {
HStack(spacing: 2) {
Image(systemName: action.iconName(viewModel: viewModel))
.foregroundColor(action.tintColor(viewModel: viewModel))
if let count = action.count(viewModel: viewModel) {
Text("\(count)")
.font(.footnote)
@ -110,6 +125,7 @@ struct StatusActionsView: View {
private func handleAction(action: Actions) {
Task {
generator.notificationOccurred(.success)
switch action {
case .respond:
routeurPath.navigate(to: .statusDetail(id: viewModel.status.reblog?.id ?? viewModel.status.id))

View file

@ -6,6 +6,7 @@ import Network
public struct StatusRowView: View {
@Environment(\.redactionReasons) private var reasons
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var routeurPath: RouterPath
@StateObject var viewModel: StatusRowViewModel
@ -24,7 +25,7 @@ public struct StatusRowView: View {
if !viewModel.isEmbed {
StatusActionsView(viewModel: viewModel)
.padding(.vertical, 8)
.tint(viewModel.isFocused ? .brand : .gray)
.tint(viewModel.isFocused ? theme.tintColor : .gray)
}
}
.onAppear {