change(ui): duck/filters minor cleanup
This commit is contained in:
parent
577e47e11d
commit
acf3fb4275
2 changed files with 12 additions and 16 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import filters from 'App/duck/filters';
|
||||
import Filter from 'App/mstore/types/filter';
|
||||
import { FilterKey } from 'App/types/filter/filterType';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
|
|
|||
|
|
@ -1,32 +1,29 @@
|
|||
import React, { useState } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { save } from 'Duck/filters';
|
||||
import { Button } from 'UI';
|
||||
import SaveSearchModal from 'Shared/SaveSearchModal'
|
||||
import SaveSearchModal from 'Shared/SaveSearchModal';
|
||||
|
||||
interface Props {
|
||||
filter: any;
|
||||
savedSearch: any;
|
||||
}
|
||||
|
||||
function SaveFilterButton(props: Props) {
|
||||
const { savedSearch } = props;
|
||||
const [showModal, setshowModal] = useState(false)
|
||||
const [showModal, setshowModal] = useState(false);
|
||||
return (
|
||||
<div>
|
||||
<Button
|
||||
variant="text-primary"
|
||||
className="mr-2"
|
||||
onClick={() => setshowModal(true)}
|
||||
icon="zoom-in">
|
||||
{savedSearch.exists() ? 'UPDATE SEARCH' : 'SAVE SEARCH'}
|
||||
</Button>
|
||||
{ showModal && ( <SaveSearchModal show={showModal} closeHandler={() => setshowModal(false)} /> )}
|
||||
<Button
|
||||
variant="text-primary"
|
||||
className="mr-2"
|
||||
onClick={() => setshowModal(true)}
|
||||
icon="zoom-in">
|
||||
{savedSearch.exists() ? 'UPDATE SEARCH' : 'SAVE SEARCH'}
|
||||
</Button>
|
||||
{showModal && (<SaveSearchModal show={showModal} closeHandler={() => setshowModal(false)} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(state => ({
|
||||
filter: state.getIn([ 'search', 'instance' ]),
|
||||
savedSearch: state.getIn([ 'search', 'savedSearch' ]),
|
||||
}), { save })(SaveFilterButton);
|
||||
savedSearch: state.getIn(['search', 'savedSearch'])
|
||||
}))(SaveFilterButton);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue