Added "Moved To" button to account details for accounts that have moved

This commit is contained in:
Max von Webel 2024-03-09 20:35:39 +01:00
parent 8778fa9309
commit fb1516a409
2 changed files with 30 additions and 1 deletions

View file

@ -17067,6 +17067,23 @@
}
}
},
"account.movedto.redirect-%@" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Umgezogen nach %@"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Moved To %@"
}
}
}
},
"account.post.pinned" : {
"extractionState" : "manual",
"localizations" : {
@ -79155,4 +79172,4 @@
}
},
"version" : "1.0"
}
}

View file

@ -207,6 +207,7 @@ struct AccountDetailHeaderView: View {
.foregroundStyle(.secondary)
.textSelection(.enabled)
.accessibilityRespondsToUserInteraction(false)
movedToView
joinedAtView
}
.accessibilityElement(children: .contain)
@ -311,6 +312,17 @@ struct AccountDetailHeaderView: View {
}
}
@ViewBuilder
private var movedToView: some View {
if let movedTo = viewModel.account?.moved {
Button("account.movedto.redirect-\("@\(movedTo.acct)")") {
routerPath.navigate(to: .accountDetailWithAccount(account: movedTo))
}
.font(.scaledCallout)
.foregroundColor(.accentColor)
}
}
@ViewBuilder
private func makeNoteView(_ note: String) -> some View {
VStack(alignment: .leading, spacing: 4) {