From 6ebebf2bffab70e27ea30fffe4a875c50712c5c2 Mon Sep 17 00:00:00 2001 From: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> Date: Tue, 25 Sep 2018 20:14:35 +0200 Subject: [PATCH] Fixes to filters (#54) --- packages/frontend/src/components/Chain/Chain.tsx | 10 ++++++++-- packages/frontend/src/components/Node/Location.css | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/Chain/Chain.tsx b/packages/frontend/src/components/Chain/Chain.tsx index 6a16216..3753d3e 100644 --- a/packages/frontend/src/components/Chain/Chain.tsx +++ b/packages/frontend/src/components/Chain/Chain.tsx @@ -287,7 +287,7 @@ export class Chain extends React.Component { } private onFilterChange = (filter: string) => { - this.setState({ filter: filter.toLowerCase() }); + this.setState({ filter }); } private getNodeFilter(): Maybe<(node: AppState.Node) => boolean> { @@ -299,6 +299,12 @@ export class Chain extends React.Component { const filterLC = filter.toLowerCase(); - return ({ nodeDetails }) => nodeDetails[0].indexOf(filterLC) !== -1; + return ({ nodeDetails, location }) => { + const city = location && location[2]; + const matchesName = nodeDetails[0].toLowerCase().indexOf(filterLC) !== -1; + const matchesCity = city != null && city.toLowerCase().indexOf(filterLC) !== -1; + + return matchesName || matchesCity; + } } } diff --git a/packages/frontend/src/components/Node/Location.css b/packages/frontend/src/components/Node/Location.css index 090f87c..d9193aa 100644 --- a/packages/frontend/src/components/Node/Location.css +++ b/packages/frontend/src/components/Node/Location.css @@ -48,7 +48,7 @@ } .Node-Location:hover { - z-index: 3; + z-index: 4; border-color: #fff; }