diff --git a/Sora/Views/SearchView/SearchViewComponents.swift b/Sora/Views/SearchView/SearchViewComponents.swift index b626bcf..148e394 100644 --- a/Sora/Views/SearchView/SearchViewComponents.swift +++ b/Sora/Views/SearchView/SearchViewComponents.swift @@ -120,72 +120,70 @@ struct SearchContent: View { let onClearHistory: () -> Void var body: some View { - 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) + 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) } - - 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) + .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) } + .frame(maxWidth: .infinity, alignment: .center) } } - .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 - ) - } + .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 + ) } } }