#43 Open user profile from timelines
This commit is contained in:
parent
209fa0969d
commit
341aae5496
|
@ -47,7 +47,11 @@ struct ImageRowItem: View {
|
|||
} blurred: {
|
||||
ZStack {
|
||||
BlurredImage(blurhash: attachmentData.blurhash)
|
||||
ImageAvatar(displayName: self.status.accountDisplayName, avatarUrl: self.status.accountAvatar)
|
||||
ImageAvatar(displayName: self.status.accountDisplayName, avatarUrl: self.status.accountAvatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
self.navigateToStatus()
|
||||
|
@ -102,7 +106,12 @@ struct ImageRowItem: View {
|
|||
ZStack {
|
||||
self.imageView(uiImage: uiImage)
|
||||
|
||||
ImageAvatar(displayName: self.status.accountDisplayName, avatarUrl: self.status.accountAvatar)
|
||||
ImageAvatar(displayName: self.status.accountDisplayName, avatarUrl: self.status.accountAvatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
}
|
||||
|
||||
ImageFavourite(isFavourited: $isFavourited)
|
||||
ImageAlternativeText(text: self.attachmentData.text) { text in
|
||||
self.routerPath.presentedAlert = .alternativeText(text: text)
|
||||
|
|
|
@ -50,7 +50,11 @@ struct ImageRowItemAsync: View {
|
|||
ZStack {
|
||||
BlurredImage(blurhash: attachment.blurhash)
|
||||
ImageAvatar(displayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
avatarUrl: self.statusViewModel.account.avatar)
|
||||
avatarUrl: self.statusViewModel.account.avatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
self.navigateToStatus()
|
||||
|
@ -115,7 +119,11 @@ struct ImageRowItemAsync: View {
|
|||
|
||||
if self.showAvatar {
|
||||
ImageAvatar(displayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
avatarUrl: self.statusViewModel.account.avatar)
|
||||
avatarUrl: self.statusViewModel.account.avatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
}
|
||||
}
|
||||
|
||||
ImageAlternativeText(text: self.attachment.description) { text in
|
||||
|
|
|
@ -14,15 +14,18 @@ public struct ImageAvatar: View {
|
|||
|
||||
private let displayName: String?
|
||||
private let avatarUrl: URL?
|
||||
private let onTap: () -> Void
|
||||
|
||||
public init(displayName: String?, avatarUrl: URL?) {
|
||||
public init(displayName: String?, avatarUrl: URL?, onTap: @escaping () -> Void) {
|
||||
self.displayName = displayName
|
||||
self.avatarUrl = avatarUrl
|
||||
self.onTap = onTap
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
if self.applicationState.showAvatarsOnTimeline {
|
||||
VStack(alignment: .leading) {
|
||||
HStack(alignment: .center) {
|
||||
HStack(alignment: .center) {
|
||||
LazyImage(url: avatarUrl) { state in
|
||||
if let image = state.image {
|
||||
|
@ -39,13 +42,17 @@ public struct ImageAvatar: View {
|
|||
.foregroundColor(.white.opacity(0.8))
|
||||
.fontWeight(.semibold)
|
||||
.shadow(color: .black, radius: 2)
|
||||
}
|
||||
.padding(8)
|
||||
.onTapGesture {
|
||||
self.onTap()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, 8)
|
||||
.padding(.top, 8)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue