UI Fixes
This commit is contained in:
parent
06fea1da02
commit
c6e42f2a6f
|
@ -102,7 +102,7 @@ struct AboutView: View {
|
||||||
|
|
||||||
Text("about.app.details")
|
Text("about.app.details")
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.frame(width: appDelegate.windowWidth - 50)
|
.frame(width: appDelegate.windowWidth - 50, alignment: .topLeading)
|
||||||
.padding()
|
.padding()
|
||||||
.background(Material.bar)
|
.background(Material.bar)
|
||||||
.clipShape(.rect(cornerRadius: 7.5))
|
.clipShape(.rect(cornerRadius: 7.5))
|
||||||
|
@ -112,7 +112,7 @@ struct AboutView: View {
|
||||||
|
|
||||||
Text("about.app.third-party")
|
Text("about.app.third-party")
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.frame(width: appDelegate.windowWidth - 50)
|
.frame(width: appDelegate.windowWidth - 50, alignment: .topLeading)
|
||||||
.padding()
|
.padding()
|
||||||
.background(Material.bar)
|
.background(Material.bar)
|
||||||
.clipShape(.rect(cornerRadius: 7.5))
|
.clipShape(.rect(cornerRadius: 7.5))
|
||||||
|
|
|
@ -10,7 +10,8 @@ struct DiscoveryView: View {
|
||||||
@State private var searchQuery: String = ""
|
@State private var searchQuery: String = ""
|
||||||
@State private var results: [String : SearchResults] = [:]
|
@State private var results: [String : SearchResults] = [:]
|
||||||
@State private var querying: Bool = false
|
@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")]
|
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]()
|
@State private var currentTokens = [Token]()
|
||||||
|
|
||||||
|
@ -100,43 +101,80 @@ struct DiscoveryView: View {
|
||||||
var accountsView: some View {
|
var accountsView: some View {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
LazyHStack(spacing: 7.5) {
|
LazyHStack(spacing: 7.5) {
|
||||||
ForEach(suggestedAccounts) { account in
|
if !lookingTrends {
|
||||||
VStack {
|
ForEach(suggestedAccounts) { account in
|
||||||
ProfilePicture(url: account.avatar, size: 64)
|
VStack {
|
||||||
|
ProfilePicture(url: account.avatar, size: 64)
|
||||||
Text(account.displayName?.replacing(/:.+:/, with: "") ?? account.username)
|
|
||||||
.font(.subheadline.bold())
|
Text(account.displayName?.replacing(/:.+:/, with: "") ?? account.username)
|
||||||
.foregroundStyle(Color(uiColor: UIColor.label))
|
.font(.subheadline.bold())
|
||||||
.lineLimit(1)
|
.foregroundStyle(Color(uiColor: UIColor.label))
|
||||||
|
.lineLimit(1)
|
||||||
Text("@\(account.username)")
|
|
||||||
.font(.caption)
|
Text("@\(account.username)")
|
||||||
.foregroundStyle(Color.gray)
|
.font(.caption)
|
||||||
|
.foregroundStyle(Color.gray)
|
||||||
Spacer()
|
|
||||||
|
Spacer()
|
||||||
Button {
|
|
||||||
guard let client = accountManager.getClient() else { return }
|
Button {
|
||||||
|
guard let client = accountManager.getClient() else { return }
|
||||||
Task {
|
|
||||||
do {
|
Task {
|
||||||
let better: Account = try await client.get(endpoint: Accounts.accounts(id: account.id))
|
do {
|
||||||
navigator.navigate(to: .account(acc: better))
|
let better: Account = try await client.get(endpoint: Accounts.accounts(id: account.id))
|
||||||
} catch {
|
navigator.navigate(to: .account(acc: better))
|
||||||
print(error)
|
} catch {
|
||||||
|
print(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} label: {
|
||||||
|
Text("account.view")
|
||||||
}
|
}
|
||||||
} label: {
|
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
||||||
Text("account.view")
|
|
||||||
}
|
}
|
||||||
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
.padding(.vertical)
|
||||||
|
.frame(width: 200)
|
||||||
|
.background(Color.gray.opacity(0.2))
|
||||||
|
.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(.vertical)
|
|
||||||
.frame(width: 200)
|
|
||||||
.background(Color.gray.opacity(0.2))
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 15.0))
|
|
||||||
}
|
}
|
||||||
.scrollTargetLayout()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
|
@ -146,29 +184,59 @@ struct DiscoveryView: View {
|
||||||
|
|
||||||
var tagsView: some View {
|
var tagsView: some View {
|
||||||
VStack(spacing: 7.5) {
|
VStack(spacing: 7.5) {
|
||||||
ForEach(trendingTags) { tag in
|
if !lookingTrends {
|
||||||
HStack {
|
ForEach(trendingTags) { tag in
|
||||||
VStack(alignment: .leading) {
|
HStack {
|
||||||
Text("#\(tag.name)")
|
VStack(alignment: .leading) {
|
||||||
.multilineTextAlignment(.leading)
|
Text("#\(tag.name)")
|
||||||
.lineLimit(1)
|
.multilineTextAlignment(.leading)
|
||||||
.bold()
|
.lineLimit(1)
|
||||||
Text("tag.posts-\(tag.totalUses)")
|
.bold()
|
||||||
.multilineTextAlignment(.leading)
|
Text("tag.posts-\(tag.totalUses)")
|
||||||
.lineLimit(1)
|
.multilineTextAlignment(.leading)
|
||||||
.foregroundStyle(Color.gray)
|
.lineLimit(1)
|
||||||
|
.foregroundStyle(Color.gray)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Button {
|
||||||
|
navigator.navigate(to: .timeline(timeline: .hashtag(tag: tag.name, accountId: nil)))
|
||||||
|
} label: {
|
||||||
|
Text("tag.read")
|
||||||
|
}
|
||||||
|
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
Spacer()
|
}
|
||||||
|
} else {
|
||||||
Button {
|
ForEach(0...9, id: \.self) { _ in
|
||||||
navigator.navigate(to: .timeline(timeline: .hashtag(tag: tag.name, accountId: nil)))
|
HStack {
|
||||||
} label: {
|
VStack(alignment: .leading) {
|
||||||
Text("tag.read")
|
Text(String("#BubbleApp"))
|
||||||
}
|
.multilineTextAlignment(.leading)
|
||||||
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
.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()
|
||||||
}
|
}
|
||||||
.padding()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,6 +283,9 @@ struct DiscoveryView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func fetchTrending() async {
|
private func fetchTrending() async {
|
||||||
|
defer { self.lookingTrends = false }
|
||||||
|
self.lookingTrends = true
|
||||||
|
|
||||||
guard let client = accountManager.getClient() else { return }
|
guard let client = accountManager.getClient() else { return }
|
||||||
do {
|
do {
|
||||||
let data = try await fetchTrendingsData(client: client)
|
let data = try await fetchTrendingsData(client: client)
|
||||||
|
|
Loading…
Reference in New Issue