Trending posts
This commit is contained in:
parent
79bf9a0486
commit
afc2069c2c
|
@ -539,6 +539,12 @@
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Found posts"
|
"value" : "Found posts"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Publications trouvées"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -549,6 +555,12 @@
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Found tags"
|
"value" : "Found tags"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Tags trouvés"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -559,6 +571,12 @@
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Found users"
|
"value" : "Found users"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Utilisateurs trouvés"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -601,6 +619,12 @@
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Tags"
|
"value" : "Tags"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Tags"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -636,6 +660,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"discovery.trending.posts" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Trending Posts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Publications en vedette"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"discovery.trending.tags" : {
|
"discovery.trending.tags" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"en" : {
|
"en" : {
|
||||||
|
|
|
@ -51,6 +51,13 @@ struct DiscoveryView: View {
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
|
|
||||||
tagsView
|
tagsView
|
||||||
|
|
||||||
|
Text("discovery.trending.posts")
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
.font(.title.bold())
|
||||||
|
.padding(.horizontal)
|
||||||
|
|
||||||
|
statusView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.submitLabel(.search)
|
.submitLabel(.search)
|
||||||
|
@ -129,7 +136,6 @@ struct DiscoveryView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagsView: some View {
|
var tagsView: some View {
|
||||||
ScrollView {
|
|
||||||
VStack(spacing: 7.5) {
|
VStack(spacing: 7.5) {
|
||||||
ForEach(trendingTags) { tag in
|
ForEach(trendingTags) { tag in
|
||||||
HStack {
|
HStack {
|
||||||
|
@ -147,23 +153,33 @@ struct DiscoveryView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
// do stuff
|
navigator.navigate(to: .timeline(timeline: .hashtag(tag: tag.name, accountId: nil)))
|
||||||
} label: {
|
} label: {
|
||||||
Text("tag.read")
|
Text("tag.read")
|
||||||
}
|
}
|
||||||
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
.buttonStyle(LargeButton(filled: true, height: 7.5, disabled: true))
|
||||||
|
.disabled(true)
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var statusView: some View {
|
||||||
|
VStack(spacing: 7.5) {
|
||||||
|
ForEach(trendingStatuses) { status in
|
||||||
|
CompactPostView(status: status)
|
||||||
|
.padding(.vertical)
|
||||||
|
.environmentObject(navigator)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func search() async {
|
private func search() async {
|
||||||
guard let client = accountManager.getClient(), !searchQuery.isEmpty else { return }
|
guard let client = accountManager.getClient(), !searchQuery.isEmpty else { return }
|
||||||
do {
|
do {
|
||||||
try await Task.sleep(for: .milliseconds(250))
|
try await Task.sleep(for: .milliseconds(250))
|
||||||
var results: SearchResults = try await client.get(endpoint: Search.search(query: searchQuery, type: currentTokens.first?.id, offset: nil, following: nil), forceVersion: .v2)
|
let results: SearchResults = try await client.get(endpoint: Search.search(query: searchQuery, type: currentTokens.first?.id, offset: nil, following: nil), forceVersion: .v2)
|
||||||
// let relationships: [Relationship] = try await client.get(endpoint: Accounts.relationships(ids: results.accounts.map(\.id)))
|
// let relationships: [Relationship] = try await client.get(endpoint: Accounts.relationships(ids: results.accounts.map(\.id)))
|
||||||
// results.relationships = relationships
|
// results.relationships = relationships
|
||||||
withAnimation {
|
withAnimation {
|
||||||
|
@ -183,6 +199,8 @@ struct DiscoveryView: View {
|
||||||
trendingStatuses = data.trendingStatuses
|
trendingStatuses = data.trendingStatuses
|
||||||
trendingLinks = data.trendingLinks
|
trendingLinks = data.trendingLinks
|
||||||
|
|
||||||
|
trendingTags = trendingTags.sorted(by: { $0.totalUses > $1.totalUses })
|
||||||
|
|
||||||
suggestedAccountsRelationShips = try await client.get(endpoint: Accounts.relationships(ids: suggestedAccounts.map(\.id)))
|
suggestedAccountsRelationShips = try await client.get(endpoint: Accounts.relationships(ids: suggestedAccounts.map(\.id)))
|
||||||
} catch {
|
} catch {
|
||||||
print(error)
|
print(error)
|
||||||
|
|
Loading…
Reference in New Issue