1
1
'use client' ;
2
2
3
3
import React from 'react' ;
4
- import { Form , InputNumber , Row , Col , Select , Input } from 'antd' ;
4
+ import { Form , InputNumber , Row , Col , Select , Input , Switch , Alert , Typography } from 'antd' ;
5
5
import { TENSION_KILTER_GRADES } from '@/app/lib/board-data' ;
6
6
import { useUISearchParams } from '@/app/components/queue-control/ui-searchparams-provider' ;
7
7
import SearchClimbNameInput from './search-climb-name-input' ;
8
+ import { useBoardProvider } from '../board-provider/board-provider-context' ;
9
+
10
+ const { Title } = Typography ;
8
11
9
12
const BasicSearchForm : React . FC = ( ) => {
10
13
const { uiSearchParams, updateFilters } = useUISearchParams ( ) ;
14
+ const { user } = useBoardProvider ( ) ;
15
+ const userId = user ?. id ;
11
16
const grades = TENSION_KILTER_GRADES ;
12
17
13
18
const handleGradeChange = ( type : 'min' | 'max' , value : number | undefined ) => {
@@ -18,6 +23,53 @@ const BasicSearchForm: React.FC = () => {
18
23
}
19
24
} ;
20
25
26
+ const renderLogbookSection = ( ) => {
27
+ if ( ! userId ) {
28
+ return (
29
+ < Form . Item >
30
+ < Alert
31
+ message = "Sign in to access your logbook"
32
+ description = "Login to your account to search for your favourite climbs, climbs you've done, or attempted."
33
+ type = "info"
34
+ showIcon
35
+ />
36
+ </ Form . Item >
37
+ ) ;
38
+ }
39
+
40
+ return (
41
+ < >
42
+ < Form . Item label = "Climbs I have Done" valuePropName = "checked" >
43
+ < Switch
44
+ checked = { uiSearchParams . showDone }
45
+ onChange = { ( checked ) => updateFilters ( { showDone : checked } ) }
46
+ />
47
+ </ Form . Item >
48
+
49
+ < Form . Item label = "Climbs I have Attempted" valuePropName = "checked" >
50
+ < Switch
51
+ checked = { uiSearchParams . showAttempted }
52
+ onChange = { ( checked ) => updateFilters ( { showAttempted : checked } ) }
53
+ />
54
+ </ Form . Item >
55
+
56
+ < Form . Item label = "Climbs I have Not Attempted" valuePropName = "checked" >
57
+ < Switch
58
+ checked = { uiSearchParams . showNotAttempted }
59
+ onChange = { ( checked ) => updateFilters ( { showNotAttempted : checked } ) }
60
+ />
61
+ </ Form . Item >
62
+
63
+ < Form . Item label = "Climbs I Liked" valuePropName = "checked" >
64
+ < Switch
65
+ checked = { uiSearchParams . showOnlyLiked }
66
+ onChange = { ( checked ) => updateFilters ( { showOnlyLiked : checked } ) }
67
+ />
68
+ </ Form . Item >
69
+ </ >
70
+ ) ;
71
+ } ;
72
+
21
73
return (
22
74
< Form labelCol = { { span : 8 } } wrapperCol = { { span : 16 } } >
23
75
< Form . Item label = "Climb Name" >
@@ -139,8 +191,82 @@ const BasicSearchForm: React.FC = () => {
139
191
< Form . Item label = "Setter Name" >
140
192
< Input value = { uiSearchParams . settername } onChange = { ( e ) => updateFilters ( { settername : e . target . value } ) } />
141
193
</ Form . Item >
194
+
195
+ < Form . Item >
196
+ < Title level = { 5 } > Logbook</ Title >
197
+ </ Form . Item >
198
+
199
+ { renderLogbookSection ( ) }
200
+
201
+ < Form . Item label = "Only Climbs with Beta Videos" valuePropName = "checked" >
202
+ < Switch
203
+ checked = { uiSearchParams . onlyWithBeta }
204
+ onChange = { ( checked ) => updateFilters ( { onlyWithBeta : checked } ) }
205
+ />
206
+ </ Form . Item >
207
+
208
+ < Form . Item >
209
+ < Title level = { 5 } > Climb Types</ Title >
210
+ </ Form . Item >
211
+
212
+ < Form . Item label = "Boulders" valuePropName = "checked" >
213
+ < Switch
214
+ checked = { uiSearchParams . showBoulders }
215
+ onChange = { ( checked ) => updateFilters ( { showBoulders : checked } ) }
216
+ />
217
+ </ Form . Item >
218
+
219
+ < Form . Item label = "Routes" valuePropName = "checked" >
220
+ < Switch
221
+ checked = { uiSearchParams . showRoutes }
222
+ onChange = { ( checked ) => updateFilters ( { showRoutes : checked } ) }
223
+ />
224
+ </ Form . Item >
225
+
226
+ < Form . Item >
227
+ < Title level = { 5 } > Climb Status</ Title >
228
+ </ Form . Item >
229
+
230
+ < Form . Item label = "Established" valuePropName = "checked" >
231
+ < Switch
232
+ checked = { uiSearchParams . showEstablished }
233
+ onChange = { ( checked ) => updateFilters ( { showEstablished : checked } ) }
234
+ />
235
+ </ Form . Item >
236
+
237
+ < Form . Item label = "Open Projects" valuePropName = "checked" >
238
+ < Switch
239
+ checked = { uiSearchParams . showProjects }
240
+ onChange = { ( checked ) => updateFilters ( { showProjects : checked } ) }
241
+ />
242
+ </ Form . Item >
243
+
244
+ < Form . Item label = "Drafts" valuePropName = "checked" >
245
+ < Switch
246
+ checked = { uiSearchParams . showDrafts }
247
+ onChange = { ( checked ) => updateFilters ( { showDrafts : checked } ) }
248
+ />
249
+ </ Form . Item >
250
+
251
+ < Form . Item >
252
+ < Title level = { 5 } > Climb Size & Shape </ Title >
253
+ </ Form . Item >
254
+
255
+ < Form . Item label = "Only Tall Climbs" valuePropName = "checked" >
256
+ < Switch
257
+ checked = { uiSearchParams . onlyTall }
258
+ onChange = { ( checked ) => updateFilters ( { onlyTall : checked } ) }
259
+ />
260
+ </ Form . Item >
261
+
262
+ < Form . Item label = "Only Side Climbs" valuePropName = "checked" >
263
+ < Switch
264
+ checked = { uiSearchParams . onlySide }
265
+ onChange = { ( checked ) => updateFilters ( { onlySide : checked } ) }
266
+ />
267
+ </ Form . Item >
142
268
</ Form >
143
269
) ;
144
270
} ;
145
271
146
- export default BasicSearchForm ;
272
+ export default BasicSearchForm ;
0 commit comments