-
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.
- Loading branch information
1 parent
6c6dd93
commit 6d6dc81
Showing
7 changed files
with
155 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { useState, useEffect, useRef } from 'react' | ||
import { | ||
COMMODITY_FILTER_MAX_DAYS_AGO_DEFAULT, | ||
COMMODITY_FILTER_FLEET_CARRIER_DEFAULT, | ||
COMMODITY_FILTER_MIN_VOLUME_DEFAULT | ||
} from 'lib/consts' | ||
|
||
export default ({ onChange }) => { | ||
const componentMounted = useRef(false); | ||
const [lastUpdatedFilter, setLastUpdatedFilter] = useState(window.localStorage?.getItem('lastUpdatedFilter') ?? COMMODITY_FILTER_MAX_DAYS_AGO_DEFAULT) | ||
const [fleetCarrierFilter, setFleetCarrierFilter] = useState(window.localStorage?.getItem('fleetCarrierFilter') ?? COMMODITY_FILTER_FLEET_CARRIER_DEFAULT) | ||
const [minVolumeFilter, setMinVolumeFilter] = useState(window.localStorage?.getItem('minVolumeFilter') ?? COMMODITY_FILTER_MIN_VOLUME_DEFAULT) | ||
|
||
useEffect(() => { | ||
if (componentMounted.current === true) { | ||
if (onChange) onChange() | ||
} else { | ||
componentMounted.current = true | ||
} | ||
}, [lastUpdatedFilter, fleetCarrierFilter, minVolumeFilter]) | ||
|
||
return ( | ||
<div className='tab-optionss'> | ||
<form onSubmit={(e) => e.preventDefault()}> | ||
<label> | ||
Updated | ||
<select name='selector' value={lastUpdatedFilter} onChange={(e) => { | ||
setLastUpdatedFilter(e.target.value) | ||
;(e.target.value == COMMODITY_FILTER_MAX_DAYS_AGO_DEFAULT) | ||
? window.localStorage.removeItem('lastUpdatedFilter') | ||
: window.localStorage.setItem('lastUpdatedFilter', e.target.value) | ||
}}> | ||
<option value='1'>Today</option> | ||
<option value='7'>In the last week</option> | ||
<option value='30'>In the last month</option> | ||
<option value='90'>In the last 3 months</option> | ||
<option value='1000'>Anytime</option> | ||
</select> | ||
</label> | ||
|
||
<label> | ||
Fleet Carriers | ||
<select name='selector' value={fleetCarrierFilter} onChange={(e) => { | ||
setFleetCarrierFilter(e.target.value) | ||
;(e.target.value == COMMODITY_FILTER_FLEET_CARRIER_DEFAULT) | ||
? window.localStorage.removeItem('fleetCarrierFilter') | ||
: window.localStorage.setItem('fleetCarrierFilter', e.target.value) | ||
}}> | ||
<option value='included'>Included</option> | ||
<option value='excluded'>Excluded</option> | ||
<option value='only'>Only</option> | ||
</select> | ||
</label> | ||
|
||
<label> | ||
Minimum Quantity | ||
<select name='selector' value={minVolumeFilter} onChange={(e) => { | ||
setMinVolumeFilter(e.target.value) | ||
;(e.target.value == COMMODITY_FILTER_MIN_VOLUME_DEFAULT) | ||
? window.localStorage.removeItem('minVolumeFilter') | ||
: window.localStorage.setItem('minVolumeFilter', e.target.value) | ||
}}> | ||
<option value='1'>No minimum</option> | ||
<option value='100'>100 T</option> | ||
<option value='1000'>1000 T</option> | ||
<option value='10000'>10000 T</option> | ||
</select> | ||
</label> | ||
</form> | ||
</div> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -88,4 +88,10 @@ | |
padding-right: 0; | ||
padding-left: .25rem; | ||
} | ||
|
||
|
||
.tab-optionss form label { | ||
display: block; | ||
margin-top: .5rem; | ||
} | ||
} |
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