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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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