@@ -14,39 +14,51 @@ struct UnifiedRightPanelView: View {
1414 let connection : DatabaseConnection
1515 let tables : [ TableInfo ]
1616
17+ private var detailsView : some View {
18+ RightSidebarView (
19+ tableName: inspectorContext. tableName,
20+ tableMetadata: inspectorContext. tableMetadata,
21+ selectedRowData: inspectorContext. selectedRowData,
22+ isEditable: inspectorContext. isEditable,
23+ isRowDeleted: inspectorContext. isRowDeleted,
24+ onSave: { state. onSave ? ( ) } ,
25+ editState: state. editState
26+ )
27+ }
28+
1729 var body : some View {
1830 VStack ( spacing: 0 ) {
19- // Tab switcher
20- Picker ( " " , selection: $state. activeTab) {
21- ForEach ( RightPanelTab . allCases, id: \. self) { tab in
22- Label ( tab. localizedTitle, systemImage: tab. systemImage)
23- . tag ( tab)
31+ if AppSettingsManager . shared. ai. enabled {
32+ Picker ( " " , selection: $state. activeTab) {
33+ ForEach ( RightPanelTab . allCases, id: \. self) { tab in
34+ Label ( tab. localizedTitle, systemImage: tab. systemImage)
35+ . tag ( tab)
36+ }
2437 }
25- }
26- . pickerStyle ( . segmented)
27- . labelsHidden ( )
28- . padding ( . horizontal, 12 )
29- . padding ( . vertical, 8 )
38+ . pickerStyle ( . segmented)
39+ . labelsHidden ( )
40+ . padding ( . horizontal, 12 )
41+ . padding ( . vertical, 8 )
3042
31- switch state. activeTab {
32- case . details:
33- RightSidebarView (
34- tableName : inspectorContext . tableName ,
35- tableMetadata : inspectorContext . tableMetadata ,
36- selectedRowData : inspectorContext . selectedRowData ,
37- isEditable : inspectorContext . isEditable ,
38- isRowDeleted : inspectorContext. isRowDeleted ,
39- onSave : { state . onSave ? ( ) } ,
40- editState : state. editState
41- )
42- case . aiChat :
43- AIChatPanelView (
44- connection : connection ,
45- tables : tables ,
46- currentQuery : inspectorContext . currentQuery ,
47- queryResults : inspectorContext . queryResults ,
48- viewModel : state . aiViewModel
49- )
43+ switch state. activeTab {
44+ case . details:
45+ detailsView
46+ case . aiChat :
47+ AIChatPanelView (
48+ connection : connection ,
49+ tables : tables ,
50+ currentQuery : inspectorContext. currentQuery ,
51+ queryResults : inspectorContext . queryResults ,
52+ viewModel : state. aiViewModel
53+ )
54+ }
55+ } else {
56+ detailsView
57+ }
58+ }
59+ . onChange ( of : AppSettingsManager . shared . ai . enabled ) {
60+ if !AppSettingsManager . shared . ai . enabled {
61+ state . activeTab = . details
5062 }
5163 }
5264 }
0 commit comments