Composer: Sort suggested tags by usage + display it

This commit is contained in:
Thomas Ricouard 2023-03-04 09:50:13 +01:00
parent 700ace10d9
commit 761c8ed3be
20 changed files with 44 additions and 4 deletions

View file

@ -516,3 +516,5 @@
"report.action.send" = "Адправіць";
"status.action.report" = "Паскардзіцца";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -509,3 +509,5 @@
"report.title" = "Report Post";
"report.action.send" = "Send";
"status.action.report" = "Report Post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -505,3 +505,5 @@
"report.title" = "Beitrag melden";
"report.action.send" = "Absenden";
"status.action.report" = "Beitrag melden";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -512,3 +512,5 @@
"report.title" = "Report Post";
"report.action.send" = "Send";
"status.action.report" = "Report Post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -512,3 +512,4 @@
"report.action.send" = "Send";
"status.action.report" = "Report Post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -511,3 +511,5 @@
"report.title" = "Denunciar publicación";
"report.action.send" = "Enviar";
"status.action.report" = "Denunciar publicación";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -500,3 +500,5 @@
"report.title" = "Salaketa";
"report.action.send" = "Bidali";
"status.action.report" = "Salatu edukia";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -506,3 +506,5 @@
"report.title" = "Signaler la publication";
"report.action.send" = "Envoyer";
"status.action.report" = "Signaler la publication";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -511,3 +511,5 @@
"report.title" = "Segnala il messaggio";
"report.action.send" = "Invia";
"status.action.report" = "Segnala il messaggio";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -510,3 +510,5 @@
"report.title" = "投稿を報告";
"report.action.send" = "送信";
"status.action.report" = "投稿を報告";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -512,3 +512,5 @@
"report.title" = "신고";
"report.action.send" = "제출";
"status.action.report" = "글 신고";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -510,3 +510,5 @@
"report.title" = "Report Post";
"report.action.send" = "Send";
"status.action.report" = "Report Post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -507,3 +507,5 @@
"report.title" = "Meld post";
"report.action.send" = "Verstuur";
"status.action.report" = "Meld post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -502,3 +502,5 @@
"report.title" = "Zgłoszenie postu";
"report.action.send" = "Wyślij";
"status.action.report" = "Zgłoś post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -510,3 +510,5 @@
"report.title" = "Reportar Postagem";
"report.action.send" = "Enviar";
"status.action.report" = "Repostar Postagem";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -510,3 +510,5 @@
"report.title" = "Report Post";
"report.action.send" = "Send";
"status.action.report" = "Report Post";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -512,3 +512,5 @@
"report.action.send" = "Надіслати";
"status.action.report" = "Поскаржитися на допис";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -512,3 +512,5 @@
"report.title" = "举报嘟文";
"report.action.send" = "发送";
"status.action.report" = "举报嘟文";
"tag.suggested.mentions-%@" = "%@ mentions";

View file

@ -51,9 +51,14 @@ struct StatusEditorAutoCompleteView: View {
Button {
viewModel.selectHashtagSuggestion(tag: tag)
} label: {
Text("#\(tag.name)")
.font(.scaledCaption)
.foregroundColor(theme.tintColor)
VStack(alignment: .leading) {
Text("#\(tag.name)")
.font(.scaledFootnote)
.foregroundColor(theme.tintColor)
Text("tag.suggested.mentions-\(String(tag.totalUses))")
.font(.scaledCaption)
.foregroundColor(.gray)
}
}
}
}

View file

@ -445,7 +445,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
following: nil),
forceVersion: .v2)
withAnimation {
tagsSuggestions = results?.hashtags ?? []
tagsSuggestions = results?.hashtags.sorted(by: { $0.totalUses > $1.totalUses }) ?? []
}
case "@":
query.removeFirst()