Explorar el Código

Show only the latest recent dictionary search and align its UI with existing toolbar buttons.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 hace 1 mes
padre
commit
7784496e22
Se han modificado 1 ficheros con 4 adiciones y 19 borrados
  1. 4 19
      gramora/Views/DictionaryView.swift

+ 4 - 19
gramora/Views/DictionaryView.swift

@@ -230,28 +230,13 @@ struct DictionaryView: View {
 
     private var recentSearchesSection: some View {
         VStack(alignment: .leading, spacing: 10) {
-            Text("Recent Searches")
+            Text("Recent Search")
                 .font(.system(size: 13, weight: .semibold))
                 .foregroundStyle(AppTheme.textSecondary)
 
-            LazyVGrid(
-                columns: [GridItem(.adaptive(minimum: 72), spacing: 8)],
-                alignment: .leading,
-                spacing: 8
-            ) {
-                ForEach(viewModel.recentSearches, id: \.self) { word in
-                    Button {
-                        viewModel.lookUpRecent(word)
-                    } label: {
-                        Text(word)
-                            .font(.system(size: 13, weight: .medium))
-                            .foregroundStyle(AppTheme.teal)
-                            .padding(.horizontal, 12)
-                            .padding(.vertical, 7)
-                            .background(AppTheme.tealLight)
-                            .clipShape(Capsule())
-                    }
-                    .buttonStyle(.plain)
+            if let latestSearch = viewModel.recentSearches.first {
+                ToolbarButton(title: latestSearch, iconName: "clock") {
+                    viewModel.lookUpRecent(latestSearch)
                 }
             }
         }