fixed search result grid

This commit is contained in:
Francesco 2025-05-31 17:42:27 +02:00
parent 9feabeaa41
commit bd37eb9db4
5 changed files with 32 additions and 35 deletions

View file

@ -12,6 +12,7 @@ struct SearchResultsGrid: View {
let items: [SearchItem]
let columns: [GridItem]
let selectedModule: ScrapingModule
let cellWidth: CGFloat
var body: some View {
LazyVGrid(columns: columns, spacing: 16) {
@ -21,7 +22,7 @@ struct SearchResultsGrid: View {
KFImage(URL(string: item.imageUrl))
.resizable()
.aspectRatio(0.72, contentMode: .fill)
.frame(width: 162, height: 243)
.frame(width: cellWidth, height: cellWidth * 1.5)
.cornerRadius(12)
.clipped()
@ -47,7 +48,7 @@ struct SearchResultsGrid: View {
.shadow(color: .black, radius: 4, x: 0, y: 2)
)
}
.frame(width: 162)
.frame(width: cellWidth)
}
.clipShape(RoundedRectangle(cornerRadius: 12))
.padding(4)

View file

@ -39,10 +39,6 @@ struct SearchView: View {
@State private var saveDebounceTimer: Timer?
@State private var searchDebounceTimer: Timer?
private var columns: [GridItem] {
Array(repeating: GridItem(.flexible(), spacing: 16), count: columnsCount)
}
init(searchQuery: Binding<String>) {
self._searchQuery = searchQuery
}
@ -52,6 +48,10 @@ struct SearchView: View {
return moduleManager.modules.first { $0.id.uuidString == id }
}
private let columns = [
GridItem(.adaptive(minimum: 150), spacing: 12)
]
private var columnsCount: Int {
if UIDevice.current.userInterfaceIdiom == .pad {
let isLandscape = UIScreen.main.bounds.width > UIScreen.main.bounds.height

View file

@ -174,7 +174,8 @@ struct SearchContent: View {
SearchResultsGrid(
items: searchItems,
columns: columns,
selectedModule: module
selectedModule: module,
cellWidth: cellWidth
)
} else {
SearchStateView(

View file

@ -203,11 +203,6 @@ struct SettingsViewData: View {
}
VStack {
Spacer()
Spacer()
Text("Current Metadata Cache Size")
Spacer()
if isCalculatingSize {
ProgressView()
.scaleEffect(0.7)