11'use client' ;
22
33import 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' ;
55import { TENSION_KILTER_GRADES } from '@/app/lib/board-data' ;
66import { useUISearchParams } from '@/app/components/queue-control/ui-searchparams-provider' ;
77import SearchClimbNameInput from './search-climb-name-input' ;
8+ import { useBoardProvider } from '../board-provider/board-provider-context' ;
9+
10+ const { Title } = Typography ;
811
912const BasicSearchForm : React . FC = ( ) => {
1013 const { uiSearchParams, updateFilters } = useUISearchParams ( ) ;
14+ const { user } = useBoardProvider ( ) ;
15+ const userId = user ?. id ;
1116 const grades = TENSION_KILTER_GRADES ;
1217
1318 const handleGradeChange = ( type : 'min' | 'max' , value : number | undefined ) => {
@@ -18,6 +23,53 @@ const BasicSearchForm: React.FC = () => {
1823 }
1924 } ;
2025
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+
2173 return (
2274 < Form labelCol = { { span : 8 } } wrapperCol = { { span : 16 } } >
2375 < Form . Item label = "Climb Name" >
@@ -139,8 +191,82 @@ const BasicSearchForm: React.FC = () => {
139191 < Form . Item label = "Setter Name" >
140192 < Input value = { uiSearchParams . settername } onChange = { ( e ) => updateFilters ( { settername : e . target . value } ) } />
141193 </ 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 >
142268 </ Form >
143269 ) ;
144270} ;
145271
146- export default BasicSearchForm ;
272+ export default BasicSearchForm ;
0 commit comments