-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from marcodejongh/add_board_renderer_edit_mode
Implement search by hold
- Loading branch information
Showing
37 changed files
with
5,859 additions
and
3,784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { Form, InputNumber, Row, Col, Select, Input } from 'antd'; | ||
import { TENSION_KILTER_GRADES } from '@/app/lib/board-data'; | ||
import { useUISearchParams } from '@/app/components/queue-control/ui-searchparams-provider'; | ||
import SearchClimbNameInput from './search-climb-name-input'; | ||
|
||
const BasicSearchForm: React.FC = () => { | ||
const { uiSearchParams, updateFilters } = useUISearchParams(); | ||
const grades = TENSION_KILTER_GRADES; | ||
|
||
const handleGradeChange = (type: 'min' | 'max', value: number | undefined) => { | ||
if (type === 'min') { | ||
updateFilters({ minGrade: value }); | ||
} else { | ||
updateFilters({ maxGrade: value }); | ||
} | ||
}; | ||
|
||
return ( | ||
<Form labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}> | ||
<Form.Item label="Climb Name"> | ||
<SearchClimbNameInput /> | ||
</Form.Item> | ||
|
||
<Form.Item label="Grade Range"> | ||
<Row gutter={8}> | ||
<Col span={12}> | ||
<Form.Item label="Min" noStyle> | ||
<Select | ||
value={uiSearchParams.minGrade || 0} | ||
defaultValue={0} | ||
onChange={(value) => handleGradeChange('min', value)} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value={0}>Any</Select.Option> | ||
{grades.map((grade) => ( | ||
<Select.Option key={grade.difficulty_id} value={grade.difficulty_id}> | ||
{grade.difficulty_name} | ||
</Select.Option> | ||
))} | ||
</Select> | ||
</Form.Item> | ||
</Col> | ||
<Col span={12}> | ||
<Form.Item label="Max" noStyle> | ||
<Select | ||
value={uiSearchParams.maxGrade || 0} | ||
defaultValue={0} | ||
onChange={(value) => handleGradeChange('max', value)} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value={0}>Any</Select.Option> | ||
{grades.map((grade) => ( | ||
<Select.Option key={grade.difficulty_id} value={grade.difficulty_id}> | ||
{grade.difficulty_name} | ||
</Select.Option> | ||
))} | ||
</Select> | ||
</Form.Item> | ||
</Col> | ||
</Row> | ||
</Form.Item> | ||
|
||
<Form.Item label="Min Ascents"> | ||
<InputNumber | ||
min={1} | ||
value={uiSearchParams.minAscents} | ||
onChange={(value) => updateFilters({ minAscents: value || undefined })} | ||
style={{ width: '100%' }} | ||
placeholder="Any" | ||
/> | ||
</Form.Item> | ||
|
||
<Form.Item label="Sort By"> | ||
<Row gutter={8}> | ||
<Col span={16}> | ||
<Select | ||
value={uiSearchParams.sortBy} | ||
onChange={(value) => updateFilters({ sortBy: value })} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value="ascents">Ascents</Select.Option> | ||
<Select.Option value="difficulty">Difficulty</Select.Option> | ||
<Select.Option value="name">Name</Select.Option> | ||
<Select.Option value="quality">Quality</Select.Option> | ||
</Select> | ||
</Col> | ||
<Col span={8}> | ||
<Select | ||
value={uiSearchParams.sortOrder} | ||
onChange={(value) => updateFilters({ sortOrder: value })} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value="desc">Descending</Select.Option> | ||
<Select.Option value="asc">Ascending</Select.Option> | ||
</Select> | ||
</Col> | ||
</Row> | ||
</Form.Item> | ||
|
||
<Form.Item label="Min Rating"> | ||
<InputNumber | ||
min={1.0} | ||
max={3.0} | ||
step={0.1} | ||
value={uiSearchParams.minRating} | ||
onChange={(value) => updateFilters({ minRating: value || undefined })} | ||
style={{ width: '100%' }} | ||
placeholder="Any" | ||
/> | ||
</Form.Item> | ||
|
||
<Form.Item label="Classics Only"> | ||
<Select | ||
value={uiSearchParams.onlyClassics} | ||
onChange={(value) => updateFilters({ onlyClassics: value })} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value="0">No</Select.Option> | ||
<Select.Option value="1">Yes</Select.Option> | ||
</Select> | ||
</Form.Item> | ||
|
||
<Form.Item label="Grade Accuracy"> | ||
<Select | ||
value={uiSearchParams.gradeAccuracy} | ||
onChange={(value) => updateFilters({ gradeAccuracy: value || undefined })} | ||
style={{ width: '100%' }} | ||
> | ||
<Select.Option value={undefined}>Any</Select.Option> | ||
<Select.Option value={0.2}>Somewhat Accurate (<0.2)</Select.Option> | ||
<Select.Option value={0.1}>Very Accurate (<0.1)</Select.Option> | ||
<Select.Option value={0.05}>Extremely Accurate (<0.05)</Select.Option> | ||
</Select> | ||
</Form.Item> | ||
|
||
<Form.Item label="Setter Name"> | ||
<Input value={uiSearchParams.settername} onChange={(e) => updateFilters({ settername: e.target.value })} /> | ||
</Form.Item> | ||
</Form> | ||
); | ||
}; | ||
|
||
export default BasicSearchForm; |
Oops, something went wrong.
d3645c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
boardsesh – ./
boardsesh-marcodejonghs-projects.vercel.app
boardsesh-git-main-marcodejonghs-projects.vercel.app
kilter-nextjs.vercel.app
boardsesh.com
www.boardsesh.com