Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#864 Sticky filter hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Jun 27, 2017
1 parent 0424c8e commit 875befa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ class DocumentList extends Component {
clickOutsideLock: !!value
})
}

clearStaticFilters = () => {
const {dispatch, windowType, viewId} = this.props;

dispatch(push('/window/' + windowType));
}

// FETCHING LAYOUT && DATA -------------------------------------------------

Expand Down Expand Up @@ -498,6 +504,7 @@ class DocumentList extends Component {
filterData={layout.filters}
filtersActive={filters}
updateDocList={this.handleFilterChange}
clearStaticFilters={this.clearStaticFilters}
/>}
</div>
<QuickActions
Expand Down
18 changes: 13 additions & 5 deletions src/components/filters/Filters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {push} from 'react-router-redux';

import FiltersFrequent from './FiltersFrequent';
import FiltersNotFrequent from './FiltersNotFrequent';
Expand Down Expand Up @@ -117,11 +118,12 @@ class Filters extends Component {
// RENDERING FILTERS -------------------------------------------------------

render() {
const {filterData, windowType, viewId} = this.props;
const {filterData, windowType, viewId, clearStaticFilters} = this.props;
const {
frequentFilters, notFrequentFilters, staticFilters
} = this.sortFilters(filterData);
const {notValidFields, widgetShown, filter} = this.state;

return (
<div className="filter-wrapper js-not-unselect">
<span>Filters: </span>
Expand Down Expand Up @@ -154,12 +156,18 @@ class Filters extends Component {
dropdownToggled={this.dropdownToggled}
/>
}
{!!staticFilters.length &&


{
//TODO: temporary solution to refactor.
// Structure data/layout corrupted.
}
{filter && filter.static && (
<FiltersStatic
data={staticFilters}
clearFilters={this.clearFilters}
data={[filter]}
clearFilters={clearStaticFilters}
/>
}
)}
</div>
</div>
)
Expand Down

0 comments on commit 875befa

Please sign in to comment.