@@ -11,31 +11,91 @@ import KeychainAccess
11
11
import LaunchAtLogin
12
12
13
13
struct PreferencesView : View {
14
-
14
+
15
15
@Default ( . githubApiBaseUrl) var githubApiBaseUrl
16
16
@Default ( . githubUsername) var githubUsername
17
17
@Default ( . githubAdditionalQuery) var githubAdditionalQuery
18
18
@FromKeychain ( . githubToken) var githubToken
19
-
19
+
20
20
@Default ( . showAssigned) var showAssigned
21
21
@Default ( . showCreated) var showCreated
22
22
@Default ( . showRequested) var showRequested
23
-
23
+
24
24
@Default ( . showAvatar) var showAvatar
25
25
@Default ( . showLabels) var showLabels
26
-
26
+
27
27
@Default ( . refreshRate) var refreshRate
28
28
@Default ( . buildType) var builtType
29
29
@Default ( . counterType) var counterType
30
-
30
+
31
31
@State private var showGhAlert = false
32
32
33
+ @State private var selectedTab : Int = 1
34
+
33
35
@StateObject private var githubTokenValidator = GithubTokenValidator ( )
34
36
@ObservedObject private var launchAtLogin = LaunchAtLogin . observable
35
37
38
+ @State private var isExpanded : Bool = false
39
+
36
40
var body : some View {
37
-
38
- TabView {
41
+
42
+ TabView ( selection: $selectedTab) {
43
+ Form {
44
+ HStack ( alignment: . center) {
45
+ Text ( " Pull Requests: " ) . frame ( width: 120 , alignment: . trailing)
46
+ VStack ( alignment: . leading) {
47
+ Toggle ( " assigned " , isOn: $showAssigned)
48
+ Toggle ( " created " , isOn: $showCreated)
49
+ Toggle ( " review requested " , isOn: $showRequested)
50
+ }
51
+ }
52
+
53
+ HStack ( alignment: . center) {
54
+ Text ( " Build Information: " ) . frame ( width: 120 , alignment: . trailing)
55
+ Picker ( " " , selection: $builtType, content: {
56
+ ForEach ( BuildType . allCases) { bt in
57
+ Text ( bt. description)
58
+ }
59
+ } )
60
+ . labelsHidden ( )
61
+ . pickerStyle ( RadioGroupPickerStyle ( ) )
62
+ . frame ( width: 120 )
63
+ }
64
+
65
+ HStack ( alignment: . center) {
66
+ Text ( " Show Avatar: " ) . frame ( width: 120 , alignment: . trailing)
67
+ Toggle ( " " , isOn: $showAvatar)
68
+ }
69
+
70
+ HStack ( alignment: . center) {
71
+ Text ( " Show Labels: " ) . frame ( width: 120 , alignment: . trailing)
72
+ Toggle ( " " , isOn: $showLabels)
73
+ }
74
+
75
+ HStack ( alignment: . center) {
76
+ Text ( " Refresh Rate: " ) . frame ( width: 120 , alignment: . trailing)
77
+ Picker ( " " , selection: $refreshRate, content: {
78
+ Text ( " 1 minute " ) . tag ( 1 )
79
+ Text ( " 5 minutes " ) . tag ( 5 )
80
+ Text ( " 10 minutes " ) . tag ( 10 )
81
+ Text ( " 15 minutes " ) . tag ( 15 )
82
+ Text ( " 30 minutes " ) . tag ( 30 )
83
+ } ) . labelsHidden ( )
84
+ . pickerStyle ( MenuPickerStyle ( ) )
85
+ . frame ( width: 100 )
86
+ }
87
+
88
+ HStack ( alignment: . center) {
89
+ Text ( " Launch at login: " ) . frame ( width: 120 , alignment: . trailing)
90
+ Toggle ( " " , isOn: $launchAtLogin. isEnabled)
91
+
92
+ }
93
+
94
+ }
95
+ . padding ( 8 )
96
+ . frame ( maxWidth: . infinity)
97
+ . tabItem { Text ( " General " ) }
98
+
39
99
Form {
40
100
HStack ( alignment: . center) {
41
101
Text ( " API Base URL: " ) . frame ( width: 120 , alignment: . trailing)
@@ -53,14 +113,7 @@ struct PreferencesView: View {
53
113
. textContentType ( . password)
54
114
. frame ( width: 200 )
55
115
}
56
- HStack ( alignment: . center) {
57
- Text ( " Additional Query: " ) . frame ( width: 120 , alignment: . trailing)
58
- TextField ( " " , text: $githubAdditionalQuery)
59
- . textFieldStyle ( RoundedBorderTextFieldStyle ( ) )
60
- . disableAutocorrection ( true )
61
- . textContentType ( . password)
62
- . frame ( width: 380 )
63
- }
116
+
64
117
HStack ( alignment: . center) {
65
118
Text ( " Token: " ) . frame ( width: 120 , alignment: . trailing)
66
119
VStack ( alignment: . leading) {
@@ -96,62 +149,8 @@ struct PreferencesView: View {
96
149
githubTokenValidator. validate ( )
97
150
}
98
151
. tabItem { Text ( " Authentication " ) }
99
-
100
- Form {
101
- HStack ( alignment: . center) {
102
- Text ( " Pull Requests: " ) . frame ( width: 120 , alignment: . trailing)
103
- VStack ( alignment: . leading) {
104
- Toggle ( " assigned " , isOn: $showAssigned)
105
- Toggle ( " created " , isOn: $showCreated)
106
- Toggle ( " review requested " , isOn: $showRequested)
107
- }
108
- }
109
-
110
- HStack ( alignment: . center) {
111
- Text ( " Build Information: " ) . frame ( width: 120 , alignment: . trailing)
112
- Picker ( " " , selection: $builtType, content: {
113
- ForEach ( BuildType . allCases) { bt in
114
- Text ( bt. description)
115
- }
116
- } )
117
- . labelsHidden ( )
118
- . pickerStyle ( RadioGroupPickerStyle ( ) )
119
- . frame ( width: 120 )
120
- }
121
-
122
- HStack ( alignment: . center) {
123
- Text ( " Show Avatar: " ) . frame ( width: 120 , alignment: . trailing)
124
- Toggle ( " " , isOn: $showAvatar)
125
- }
126
-
127
- HStack ( alignment: . center) {
128
- Text ( " Show Labels: " ) . frame ( width: 120 , alignment: . trailing)
129
- Toggle ( " " , isOn: $showLabels)
130
- }
131
-
132
- HStack ( alignment: . center) {
133
- Text ( " Refresh Rate: " ) . frame ( width: 120 , alignment: . trailing)
134
- Picker ( " " , selection: $refreshRate, content: {
135
- Text ( " 1 minute " ) . tag ( 1 )
136
- Text ( " 5 minutes " ) . tag ( 5 )
137
- Text ( " 10 minutes " ) . tag ( 10 )
138
- Text ( " 15 minutes " ) . tag ( 15 )
139
- Text ( " 30 minutes " ) . tag ( 30 )
140
- } ) . labelsHidden ( )
141
- . pickerStyle ( MenuPickerStyle ( ) )
142
- . frame ( width: 100 )
143
- }
144
-
145
- HStack ( alignment: . center) {
146
- Text ( " Launch at login: " ) . frame ( width: 120 , alignment: . trailing)
147
- Toggle ( " " , isOn: $launchAtLogin. isEnabled)
148
-
149
- }
150
- }
151
- . padding ( 8 )
152
- . frame ( maxWidth: . infinity)
153
- . tabItem { Text ( " Menu " ) }
154
-
152
+ . tag ( 1 )
153
+
155
154
Form {
156
155
HStack ( alignment: . center) {
157
156
VStack ( alignment: . leading) {
@@ -173,9 +172,27 @@ struct PreferencesView: View {
173
172
. frame ( maxWidth: . infinity)
174
173
. tabItem { Text ( " Menubar icon " ) }
175
174
175
+ Form {
176
+ HStack ( alignment: . top) {
177
+ Text ( " Additional Query: " ) . frame ( width: 120 , alignment: . trailing)
178
+ TextField ( " " , text: $githubAdditionalQuery)
179
+ . textFieldStyle ( RoundedBorderTextFieldStyle ( ) )
180
+ . disableAutocorrection ( true )
181
+ . textContentType ( . password)
182
+ . frame ( width: 380 )
183
+
184
+ }
185
+ Text ( " See the GitHub [search documentation](https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax) for more information on advanced queries " )
186
+ . font ( . footnote)
187
+ . padding ( . leading, 8 )
188
+ . foregroundColor ( . secondary)
189
+ } . padding ( 8 )
190
+ . frame ( maxWidth: . infinity)
191
+ . tabItem { Text ( " Advanced " ) }
192
+
176
193
}
177
194
. padding ( )
178
-
195
+
179
196
}
180
197
}
181
198
0 commit comments