@@ -123,8 +123,6 @@ struct SidebarView: View {
123123 loadingState
124124 } else if tables. isEmpty {
125125 emptyState
126- } else if filteredTables. isEmpty {
127- noMatchState
128126 } else {
129127 tableList
130128 }
@@ -170,57 +168,54 @@ struct SidebarView: View {
170168 . frame ( maxWidth: . infinity, maxHeight: . infinity)
171169 }
172170
173- private var noMatchState : some View {
174- VStack ( spacing: 8 ) {
175- Image ( systemName: " magnifyingglass " )
176- . font ( . title)
177- . foregroundStyle ( . tertiary)
178- Text ( sidebarLabel ( mongodb: " No matching collections " , redis: " No matching databases " , default: " No matching tables " ) )
179- . font ( . subheadline)
180- . foregroundStyle ( . secondary)
181- }
182- . frame ( maxWidth: . infinity, maxHeight: . infinity)
183- }
184-
185171 // MARK: - Table List
186172
187173 private var tableList : some View {
188174 List ( selection: selectedTablesBinding) {
189- Section ( isExpanded: $viewModel. isTablesExpanded) {
190- ForEach ( filteredTables) { table in
191- TableRow (
192- table: table,
193- isActive: activeTableName == table. name,
194- isPendingTruncate: pendingTruncates. contains ( table. name) ,
195- isPendingDelete: pendingDeletes. contains ( table. name)
196- )
197- . tag ( table)
198- . contextMenu {
199- SidebarContextMenu (
200- clickedTable: table,
201- selectedTables: selectedTablesBinding,
202- isReadOnly: AppState . shared. isReadOnly,
203- onBatchToggleTruncate: { viewModel. batchToggleTruncate ( ) } ,
204- onBatchToggleDelete: { viewModel. batchToggleDelete ( ) }
175+ if filteredTables. isEmpty {
176+ ContentUnavailableView (
177+ sidebarLabel ( mongodb: " No matching collections " , redis: " No matching databases " , default: " No matching tables " ) ,
178+ systemImage: " magnifyingglass "
179+ )
180+ . listRowSeparator ( . hidden)
181+ . listRowBackground ( Color . clear)
182+ } else {
183+ Section ( isExpanded: $viewModel. isTablesExpanded) {
184+ ForEach ( filteredTables) { table in
185+ TableRow (
186+ table: table,
187+ isActive: activeTableName == table. name,
188+ isPendingTruncate: pendingTruncates. contains ( table. name) ,
189+ isPendingDelete: pendingDeletes. contains ( table. name)
205190 )
206- }
207- }
208- } header: {
209- Text ( sidebarLabel ( mongodb: " Collections " , redis: " Databases " , default: " Tables " ) )
210- . help ( sidebarLabel (
211- mongodb: " Right-click to show all collections " ,
212- redis: " Right-click to show all databases " ,
213- default: " Right-click to show all tables "
214- ) )
215- . contextMenu {
216- Button ( sidebarLabel (
217- mongodb: String ( localized: " Show All Collections " ) ,
218- redis: String ( localized: " Show All Databases " ) ,
219- default: String ( localized: " Show All Tables " )
220- ) ) {
221- onShowAllTables ? ( )
191+ . tag ( table)
192+ . contextMenu {
193+ SidebarContextMenu (
194+ clickedTable: table,
195+ selectedTables: selectedTablesBinding,
196+ isReadOnly: AppState . shared. isReadOnly,
197+ onBatchToggleTruncate: { viewModel. batchToggleTruncate ( ) } ,
198+ onBatchToggleDelete: { viewModel. batchToggleDelete ( ) }
199+ )
222200 }
223201 }
202+ } header: {
203+ Text ( sidebarLabel ( mongodb: " Collections " , redis: " Databases " , default: " Tables " ) )
204+ . help ( sidebarLabel (
205+ mongodb: " Right-click to show all collections " ,
206+ redis: " Right-click to show all databases " ,
207+ default: " Right-click to show all tables "
208+ ) )
209+ . contextMenu {
210+ Button ( sidebarLabel (
211+ mongodb: String ( localized: " Show All Collections " ) ,
212+ redis: String ( localized: " Show All Databases " ) ,
213+ default: String ( localized: " Show All Tables " )
214+ ) ) {
215+ onShowAllTables ? ( )
216+ }
217+ }
218+ }
224219 }
225220 }
226221 . listStyle ( . sidebar)
0 commit comments