Fix tags/accounts.

This commit is contained in:
Marcin Czachursk 2023-03-04 21:18:53 +01:00
parent 0a0619f8da
commit 3be21f83b1
4 changed files with 14 additions and 5 deletions

View File

@ -13,6 +13,7 @@ struct AccountImagesGridView: View {
@EnvironmentObject var routerPath: RouterPath
private let account: Account
private let maxImages = 3
@State private var photoUrls: [PhotoUrl] = [
PhotoUrl(id: UUID().uuidString),
@ -25,7 +26,7 @@ struct AccountImagesGridView: View {
}
var body: some View {
LazyVGrid(columns: [GridItem(.adaptive(minimum:140))]) {
LazyVGrid(columns: [GridItem(.adaptive(minimum: 140))]) {
ForEach(self.photoUrls) { photoUrl in
ImageGrid(photoUrl: photoUrl)
}
@ -59,7 +60,7 @@ struct AccountImagesGridView: View {
index = index + 1
}
if index == 3 {
if index == self.maxImages {
break;
}
}

View File

@ -47,6 +47,7 @@ struct TrendingAccountsView: View {
accountUsername: account.acct)
Spacer()
}
.textCase(.none)
.listRowInsets(EdgeInsets())
.padding(.vertical, 12)
}

View File

@ -13,6 +13,7 @@ struct TagImagesGridView: View {
@EnvironmentObject var routerPath: RouterPath
private let hashtag: String
private let maxImages = 5
@State private var photoUrls: [PhotoUrl] = [
PhotoUrl(id: UUID().uuidString),
@ -27,7 +28,7 @@ struct TagImagesGridView: View {
}
var body: some View {
LazyVGrid(columns: [GridItem(.adaptive(minimum:80))]) {
LazyVGrid(columns: [GridItem(.adaptive(minimum: 80))]) {
ForEach(self.photoUrls) { photoUrl in
ImageGrid(photoUrl: photoUrl)
}
@ -73,7 +74,7 @@ struct TagImagesGridView: View {
index = index + 1
}
if index == 5 {
if index == self.maxImages {
break;
}
}

View File

@ -35,9 +35,15 @@ struct TrendingTagsView: View {
} else {
List {
ForEach(self.tags, id: \.id) { tag in
Section(header: Text(tag.name).font(.headline)) {
Section {
TagImagesGridView(hashtag: tag.hashtag)
// .id(UUID().uuidString)
} header: {
HStack {
Text(tag.name).font(.headline)
Spacer()
Text("\(tag.total) posts").font(.caption)
}
}
}
}