From 99d5e6f6cd66bf9a7c9eb34cc7399e8ec004707c Mon Sep 17 00:00:00 2001 From: Francesco <100066266+cranci1@users.noreply.github.com> Date: Sat, 31 May 2025 18:00:35 +0200 Subject: [PATCH] =?UTF-8?q?even=20more=20tests=20=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sora/Views/SearchView/SearchResultsGrid.swift | 1 - .../SearchView/SearchViewComponents.swift | 120 +++++++++--------- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/Sora/Views/SearchView/SearchResultsGrid.swift b/Sora/Views/SearchView/SearchResultsGrid.swift index 4b6a877..e45cd4f 100644 --- a/Sora/Views/SearchView/SearchResultsGrid.swift +++ b/Sora/Views/SearchView/SearchResultsGrid.swift @@ -72,6 +72,5 @@ struct SearchResultsGrid: View { .padding(.top) .padding() } - .navigationViewStyle(StackNavigationViewStyle()) } } diff --git a/Sora/Views/SearchView/SearchViewComponents.swift b/Sora/Views/SearchView/SearchViewComponents.swift index 148e394..b626bcf 100644 --- a/Sora/Views/SearchView/SearchViewComponents.swift +++ b/Sora/Views/SearchView/SearchViewComponents.swift @@ -120,70 +120,72 @@ struct SearchContent: View { let onClearHistory: () -> Void var body: some View { - VStack(spacing: 0) { - if selectedModule == nil { - VStack(spacing: 8) { - Image(systemName: "questionmark.app") - .font(.largeTitle) - .foregroundColor(.secondary) - Text("No Module Selected") - .font(.headline) - Text("Please select a module from settings") - .font(.caption) - .foregroundColor(.secondary) + NavigationView { + VStack(spacing: 0) { + if selectedModule == nil { + VStack(spacing: 8) { + Image(systemName: "questionmark.app") + .font(.largeTitle) + .foregroundColor(.secondary) + Text("No Module Selected") + .font(.headline) + Text("Please select a module from settings") + .font(.caption) + .foregroundColor(.secondary) + } + .padding() + .frame(maxWidth: .infinity) + .background(Color(.systemBackground)) + .shadow(color: Color.black.opacity(0.1), radius: 2, y: 1) } - .padding() - .frame(maxWidth: .infinity) - .background(Color(.systemBackground)) - .shadow(color: Color.black.opacity(0.1), radius: 2, y: 1) - } - - if searchQuery.isEmpty { - if !searchHistory.isEmpty { - SearchHistorySection(title: "Recent Searches") { - VStack(spacing: 0) { - Divider() - .padding(.horizontal, 16) - - ForEach(searchHistory.indices, id: \.self) { index in - SearchHistoryRow( - text: searchHistory[index], - onTap: { - onHistoryItemSelected(searchHistory[index]) - }, - onDelete: { - onHistoryItemDeleted(index) - }, - showDivider: index < searchHistory.count - 1 - ) - } - HStack { - Button(action: onClearHistory) { - Text("Clear") - .foregroundColor(.accentColor) + + if searchQuery.isEmpty { + if !searchHistory.isEmpty { + SearchHistorySection(title: "Recent Searches") { + VStack(spacing: 0) { + Divider() + .padding(.horizontal, 16) + + ForEach(searchHistory.indices, id: \.self) { index in + SearchHistoryRow( + text: searchHistory[index], + onTap: { + onHistoryItemSelected(searchHistory[index]) + }, + onDelete: { + onHistoryItemDeleted(index) + }, + showDivider: index < searchHistory.count - 1 + ) + } + HStack { + Button(action: onClearHistory) { + Text("Clear") + .foregroundColor(.accentColor) + } + .frame(maxWidth: .infinity, alignment: .center) } - .frame(maxWidth: .infinity, alignment: .center) } } + .padding(.vertical) } - .padding(.vertical) - } - } else { - if let module = selectedModule { - if !searchItems.isEmpty { - SearchResultsGrid( - items: searchItems, - columns: columns, - selectedModule: module, - cellWidth: cellWidth - ) - } else { - SearchStateView( - isSearching: isSearching, - hasNoResults: hasNoResults, - columnsCount: columnsCount, - cellWidth: cellWidth - ) + } else { + if let module = selectedModule { + if !searchItems.isEmpty { + SearchResultsGrid( + items: searchItems, + columns: columns, + selectedModule: module, + cellWidth: cellWidth + ) + } else { + SearchStateView( + isSearching: isSearching, + hasNoResults: hasNoResults, + columnsCount: columnsCount, + cellWidth: cellWidth + ) + } } } }