@@ -5,17 +5,17 @@ import 'react-bootstrap-table2-paginator/dist/react-bootstrap-table2-paginator.m
5
5
import './GameSearch.css'
6
6
import BootstrapTable , { Column } from 'react-bootstrap-table-next'
7
7
import { Container , Dropdown , DropdownButton , FormControl , InputGroup , Spinner } from 'react-bootstrap'
8
- import React , { Component , useEffect , useRef , useState } from 'react'
9
- import ToolkitProvider , { Search , SearchProps , ToolkitProviderProps } from 'react-bootstrap-table2-toolkit'
8
+ import React , { useEffect , useState } from 'react'
9
+ import ToolkitProvider , { ToolkitProviderProps } from 'react-bootstrap-table2-toolkit'
10
10
import filterFactory , { Comparator , multiSelectFilter , numberFilter } from 'react-bootstrap-table2-filter'
11
11
import paginationFactory , { PaginationListStandalone , PaginationProvider , PaginationTotalStandalone , SizePerPageDropdownStandalone } from 'react-bootstrap-table2-paginator'
12
12
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
13
+ import GameCategorySearch from './GameCategorySearchBar'
13
14
import { Picky } from 'react-picky'
14
15
import { apiGet } from '../fetchers/api'
15
16
import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'
16
17
import { faLongArrowAltDown } from '@fortawesome/free-solid-svg-icons'
17
18
import { faLongArrowAltUp } from '@fortawesome/free-solid-svg-icons'
18
- const { SearchBar } = Search
19
19
20
20
interface PlatformDto {
21
21
id : string
@@ -274,8 +274,6 @@ const fetchValueNamesForRun = async (runId: string) => {
274
274
}
275
275
276
276
const GameSearch = ( ) => {
277
- const searchBarRef = useRef < Component < SearchProps > > ( null )
278
- const boostrapTableRef = useRef < BootstrapTable > ( null )
279
277
const [ gameValues , setGameValues ] = useState < GameValueRow [ ] > ( [ ] )
280
278
const [ platforms , setPlatforms ] = useState < IdToNameMap > ( )
281
279
const [ selectedPlatforms , setSelectedPlatforms ] = useState < PlatformSelectOption [ ] > ( [ ] )
@@ -294,13 +292,13 @@ const GameSearch = () => {
294
292
getAllPlatforms ( ) . then ( setPlatforms )
295
293
} , [ ] )
296
294
297
- const doPlatformSelection = ( platforms : PlatformSelectOption [ ] ) => {
298
- platformFilter ( platforms . map ( platform => platform . id ) )
299
- setSelectedPlatforms ( platforms )
295
+ const doPlatformSelection = ( selectedPlatformOptions : PlatformSelectOption [ ] ) => {
296
+ platformFilter ( selectedPlatformOptions . map ( platform => platform . id ) )
297
+ setSelectedPlatforms ( selectedPlatformOptions )
300
298
}
301
- const handlePlatformSelection = ( platforms : PlatformSelectOption [ ] ) => {
302
- doPlatformSelection ( platforms )
303
- localStorage . setItem ( 'selectedPlatforms' , JSON . stringify ( platforms ) )
299
+ const handlePlatformSelection = ( selectedPlatformOptions : PlatformSelectOption [ ] ) => {
300
+ doPlatformSelection ( selectedPlatformOptions )
301
+ localStorage . setItem ( 'selectedPlatforms' , JSON . stringify ( selectedPlatformOptions ) )
304
302
}
305
303
306
304
const doMinTimeChange = ( minTime : string ) => {
@@ -353,10 +351,10 @@ const GameSearch = () => {
353
351
>
354
352
{ ( ( { paginationProps, paginationTableProps } ) =>
355
353
< div >
356
- < SearchBar
357
- ref = { searchBarRef }
354
+ < GameCategorySearch
358
355
{ ...toolkitprops . searchProps }
359
356
placeholder = "Game / Category search"
357
+ setGameMap = { setGameMap }
360
358
/>
361
359
< Picky
362
360
id = "platform-multiselect"
@@ -401,7 +399,6 @@ const GameSearch = () => {
401
399
</ div >
402
400
< SizePerPageDropdownStandalone { ...paginationProps } />
403
401
< BootstrapTable
404
- ref = { boostrapTableRef }
405
402
wrapperClasses = "table-responsive"
406
403
striped
407
404
{ ...toolkitprops . baseProps }
0 commit comments