Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task PM-668: Remove "Show Only My Markets" from Olympia and Mainnet #400

Merged
merged 3 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^1.0.1",
"webpack": "^4.10.0",
"webpack-cli": "^2.1.4",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.1.4"
}
}
18 changes: 2 additions & 16 deletions src/routes/MarketList/components/Filter/Form.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { reduxForm, Field } from 'redux-form'
import cn from 'classnames/bind'
import { TextInput, Checkbox, Select, RadioButtonGroup } from 'components/Form'
import { TextInput, Select, RadioButtonGroup } from 'components/Form'
import style from './Filter.mod.scss'

const cx = cn.bind(style)
Expand Down Expand Up @@ -43,7 +42,7 @@ const MARKETFILTER_STATUS_OPTIONS = [
},
]

const Form = ({ userAccount }) => (
const Form = () => (
<form>
<Field
label="Search"
Expand All @@ -61,22 +60,9 @@ const Form = ({ userAccount }) => (
options={MARKETFILTER_STATUS_OPTIONS}
light
/>
{userAccount && (
<Field label="Show Only" name="filterMyMarkets" component={Checkbox} light>
My Markets
</Field>
)}
</form>
)

Form.propTypes = {
userAccount: PropTypes.string,
}

Form.defaultProps = {
userAccount: undefined,
}

export default reduxForm({
form: MARKETFILTER_FORM_NAME,
destroyOnUnmount: false,
Expand Down
8 changes: 2 additions & 6 deletions src/routes/MarketList/store/selectors/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ import { MARKETFILTER_FORM_NAME } from 'routes/MarketList/components/Filter/Form
const formFilterSelector = getFormValues(MARKETFILTER_FORM_NAME)

// Fields in MarketFilter Form
const FIELD_FILTER_MY_MARKETS = 'filterMyMarkets'
const FIELD_FILTER_MARKETSTATUS = 'filterByStatus'
const FIELD_FILTER_QUERY = 'filterQuery'

const FILTER_FIELDS = [
FIELD_FILTER_MY_MARKETS, FIELD_FILTER_MARKETSTATUS, FIELD_FILTER_QUERY,
FIELD_FILTER_MARKETSTATUS, FIELD_FILTER_QUERY,
]

// Default Filter Values
const FILTER_DEFAULTS = {
[FIELD_FILTER_MY_MARKETS]: false,
}
const FILTER_DEFAULTS = {}

// Functions for RadioButton Filters for MarketStatus
const MARKET_STATUS_FILTERS = {
Expand All @@ -30,7 +27,6 @@ const MARKET_STATUS_FILTERS = {

// Functions for each filter field
const FILTER_FUNCTIONS = {
[FIELD_FILTER_MY_MARKETS]: params => market => market.creator === params.currentAccount,
[FIELD_FILTER_MARKETSTATUS]: params => market => MARKET_STATUS_FILTERS[params.filterValue](market),
[FIELD_FILTER_QUERY]: params => market => (
market.title.toLowerCase().indexOf(params.filterValue.toLowerCase()) > -1 ||
Expand Down