11'use client' ;
22
33import React from 'react' ;
4- import { Form , InputNumber , Row , Col , Select , Input , Switch , Divider } 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 { useBoardProvider } from '@/app/components/board-provider/board-provider-context' ;
88import SearchClimbNameInput from './search-climb-name-input' ;
99
10+ const { Title } = Typography ;
11+
1012const BasicSearchForm : React . FC = ( ) => {
1113 const { uiSearchParams, updateFilters } = useUISearchParams ( ) ;
1214 const { token, user_id } = useBoardProvider ( ) ;
@@ -22,8 +24,59 @@ const BasicSearchForm: React.FC = () => {
2224 }
2325 } ;
2426
27+ const renderLogbookSection = ( ) => {
28+ if ( ! isLoggedIn ) {
29+ return (
30+ < Form . Item >
31+ < Alert
32+ message = "Sign in to access personal progress filters"
33+ description = "Login to your account to filter climbs based on your attempt and completion history."
34+ type = "info"
35+ showIcon
36+ />
37+ </ Form . Item >
38+ ) ;
39+ }
40+
41+ return (
42+ < >
43+ < Form . Item label = "Hide Attempted" valuePropName = "checked" >
44+ < Switch
45+ style = { { float : 'right' } }
46+ checked = { uiSearchParams . hideAttempted }
47+ onChange = { ( checked ) => updateFilters ( { hideAttempted : checked } ) }
48+ />
49+ </ Form . Item >
50+
51+ < Form . Item label = "Hide Completed" valuePropName = "checked" >
52+ < Switch
53+ style = { { float : 'right' } }
54+ checked = { uiSearchParams . hideCompleted }
55+ onChange = { ( checked ) => updateFilters ( { hideCompleted : checked } ) }
56+ />
57+ </ Form . Item >
58+
59+ < Form . Item label = "Only Attempted" valuePropName = "checked" >
60+ < Switch
61+ style = { { float : 'right' } }
62+ checked = { uiSearchParams . showOnlyAttempted }
63+ onChange = { ( checked ) => updateFilters ( { showOnlyAttempted : checked } ) }
64+ />
65+ </ Form . Item >
66+
67+ < Form . Item label = "Only Completed" valuePropName = "checked" >
68+ < Switch
69+ style = { { float : 'right' } }
70+ checked = { uiSearchParams . showOnlyCompleted }
71+ onChange = { ( checked ) => updateFilters ( { showOnlyCompleted : checked } ) }
72+ />
73+ </ Form . Item >
74+ </ >
75+ ) ;
76+ } ;
77+
2578 return (
26- < Form labelCol = { { span : 8 } } wrapperCol = { { span : 16 } } >
79+ < Form layout = "horizontal" labelAlign = "left" labelCol = { { span : 14 } } wrapperCol = { { span : 10 } } >
2780 < Form . Item label = "Climb Name" >
2881 < SearchClimbNameInput />
2982 </ Form . Item >
@@ -116,15 +169,12 @@ const BasicSearchForm: React.FC = () => {
116169 />
117170 </ Form . Item >
118171
119- < Form . Item label = "Classics Only" >
120- < Select
121- value = { uiSearchParams . onlyClassics }
122- onChange = { ( value ) => updateFilters ( { onlyClassics : value } ) }
123- style = { { width : '100%' } }
124- >
125- < Select . Option value = "0" > No</ Select . Option >
126- < Select . Option value = "1" > Yes</ Select . Option >
127- </ Select >
172+ < Form . Item label = "Classics Only" valuePropName = "checked" >
173+ < Switch
174+ style = { { float : 'right' } }
175+ checked = { uiSearchParams . onlyClassics }
176+ onChange = { ( checked ) => updateFilters ( { onlyClassics : checked } ) }
177+ />
128178 </ Form . Item >
129179
130180 < Form . Item label = "Grade Accuracy" >
@@ -144,39 +194,11 @@ const BasicSearchForm: React.FC = () => {
144194 < Input value = { uiSearchParams . settername } onChange = { ( e ) => updateFilters ( { settername : e . target . value } ) } />
145195 </ Form . Item >
146196
147- { isLoggedIn && (
148- < >
149- < Divider > Personal Progress</ Divider >
150-
151- < Form . Item label = "Hide Attempted" tooltip = "Hide climbs you have attempted" >
152- < Switch
153- checked = { uiSearchParams . hideAttempted }
154- onChange = { ( checked ) => updateFilters ( { hideAttempted : checked } ) }
155- />
156- </ Form . Item >
157-
158- < Form . Item label = "Hide Completed" tooltip = "Hide climbs you have completed" >
159- < Switch
160- checked = { uiSearchParams . hideCompleted }
161- onChange = { ( checked ) => updateFilters ( { hideCompleted : checked } ) }
162- />
163- </ Form . Item >
164-
165- < Form . Item label = "Only Attempted" tooltip = "Show only climbs you have attempted" >
166- < Switch
167- checked = { uiSearchParams . showOnlyAttempted }
168- onChange = { ( checked ) => updateFilters ( { showOnlyAttempted : checked } ) }
169- />
170- </ Form . Item >
171-
172- < Form . Item label = "Only Completed" tooltip = "Show only climbs you have completed" >
173- < Switch
174- checked = { uiSearchParams . showOnlyCompleted }
175- onChange = { ( checked ) => updateFilters ( { showOnlyCompleted : checked } ) }
176- />
177- </ Form . Item >
178- </ >
179- ) }
197+ < Form . Item >
198+ < Title level = { 5 } > Personal Progress</ Title >
199+ </ Form . Item >
200+
201+ { renderLogbookSection ( ) }
180202 </ Form >
181203 ) ;
182204} ;
0 commit comments