This commit is contained in:
lumaa-dev 2024-11-11 15:28:33 +01:00
parent 06fea1da02
commit c6e42f2a6f
2 changed files with 127 additions and 56 deletions

View File

@ -102,7 +102,7 @@ struct AboutView: View {
Text("about.app.details")
.multilineTextAlignment(.leading)
.frame(width: appDelegate.windowWidth - 50)
.frame(width: appDelegate.windowWidth - 50, alignment: .topLeading)
.padding()
.background(Material.bar)
.clipShape(.rect(cornerRadius: 7.5))
@ -112,7 +112,7 @@ struct AboutView: View {
Text("about.app.third-party")
.multilineTextAlignment(.leading)
.frame(width: appDelegate.windowWidth - 50)
.frame(width: appDelegate.windowWidth - 50, alignment: .topLeading)
.padding()
.background(Material.bar)
.clipShape(.rect(cornerRadius: 7.5))

View File

@ -10,6 +10,7 @@ struct DiscoveryView: View {
@State private var searchQuery: String = ""
@State private var results: [String : SearchResults] = [:]
@State private var querying: Bool = false
@State private var lookingTrends: Bool = false
let allTokens = [Token(id: "accounts", name: String(localized: "discovery.search.users"), image: "person.3.fill"), Token(id: "statuses", name: String(localized: "discovery.search.posts"), image: "note.text"), Token(id: "hashtags", name: String(localized: "discovery.search.tags"), image: "tag.fill")]
@State private var currentTokens = [Token]()
@ -100,6 +101,7 @@ struct DiscoveryView: View {
var accountsView: some View {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 7.5) {
if !lookingTrends {
ForEach(suggestedAccounts) { account in
VStack {
ProfilePicture(url: account.avatar, size: 64)
@ -137,6 +139,42 @@ struct DiscoveryView: View {
.clipShape(RoundedRectangle(cornerRadius: 15.0))
}
.scrollTargetLayout()
} else {
ForEach(0...9, id: \.self) { _ in
VStack {
Image(systemName: "person.crop.circle")
.resizable()
.scaledToFit()
.frame(width: 54, height: 54)
.bold()
Text(String("Bubble"))
.font(.subheadline.bold())
.foregroundStyle(Color(uiColor: UIColor.label))
.lineLimit(1)
.redacted(reason: .placeholder)
Text(String("@Bubble@mastodon.online"))
.font(.caption)
.foregroundStyle(Color.gray)
.redacted(reason: .placeholder)
Spacer()
Button {
print("loading")
} label: {
Text("account.view")
.redacted(reason: .placeholder)
}
.buttonStyle(LargeButton(filled: true, height: 7.5))
}
.padding(.vertical)
.frame(width: 200)
.background(Color.gray.opacity(0.2))
.clipShape(RoundedRectangle(cornerRadius: 15.0))
}
}
}
}
.padding(.horizontal)
@ -146,6 +184,7 @@ struct DiscoveryView: View {
var tagsView: some View {
VStack(spacing: 7.5) {
if !lookingTrends {
ForEach(trendingTags) { tag in
HStack {
VStack(alignment: .leading) {
@ -170,6 +209,35 @@ struct DiscoveryView: View {
}
.padding()
}
} else {
ForEach(0...9, id: \.self) { _ in
HStack {
VStack(alignment: .leading) {
Text(String("#BubbleApp"))
.multilineTextAlignment(.leading)
.lineLimit(1)
.bold()
.redacted(reason: .placeholder)
Text("tag.posts-\(2_314)")
.multilineTextAlignment(.leading)
.lineLimit(1)
.foregroundStyle(Color.gray)
.redacted(reason: .placeholder)
}
Spacer()
Button {
print("troll")
} label: {
Text("tag.read")
.redacted(reason: .placeholder)
}
.buttonStyle(LargeButton(filled: true, height: 7.5))
}
.padding()
}
}
}
}
@ -215,6 +283,9 @@ struct DiscoveryView: View {
}
private func fetchTrending() async {
defer { self.lookingTrends = false }
self.lookingTrends = true
guard let client = accountManager.getClient() else { return }
do {
let data = try await fetchTrendingsData(client: client)