Skip to content

Commit ca2f08f

Browse files
marcodejonghclaude
andcommitted
Improve personal progress filters UI layout
Updates the search form to use the improved UI pattern from PR #137: - Changed form layout to horizontal with left-aligned labels (14/10 span) - Replaced "Classics Only" dropdown with Switch component - Added Typography.Title for "Personal Progress" section heading - Updated Alert message for better clarity when not logged in - Aligned all switches to the right with consistent styling - Used valuePropName="checked" for proper Switch integration The UI now matches the cleaner, more organized design pattern established in the search toggles PR. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f6eccd6 commit ca2f08f

File tree

1 file changed

+66
-44
lines changed

1 file changed

+66
-44
lines changed

app/components/search-drawer/basic-search-form.tsx

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
'use client';
22

33
import 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';
55
import { TENSION_KILTER_GRADES } from '@/app/lib/board-data';
66
import { useUISearchParams } from '@/app/components/queue-control/ui-searchparams-provider';
77
import { useBoardProvider } from '@/app/components/board-provider/board-provider-context';
88
import SearchClimbNameInput from './search-climb-name-input';
99

10+
const { Title } = Typography;
11+
1012
const 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

Comments
 (0)