diff --git a/client/homebrew/pages/basePages/listPage/brewItem/brewItem.jsx b/client/homebrew/pages/basePages/listPage/brewItem/brewItem.jsx index 90f9d32f23..0369305d5e 100644 --- a/client/homebrew/pages/basePages/listPage/brewItem/brewItem.jsx +++ b/client/homebrew/pages/basePages/listPage/brewItem/brewItem.jsx @@ -20,7 +20,8 @@ const BrewItem = createClass({ authors : [], stubbed : true }, - reportError : ()=>{} + updateListFilter : ()=>{}, + reportError : ()=>{} }; }, @@ -44,6 +45,10 @@ const BrewItem = createClass({ }); }, + updateFilter : function(type, term){ + this.props.updateListFilter(type, term); + }, + renderDeleteBrewLink : function(){ if(!this.props.brew.editId) return; @@ -109,6 +114,9 @@ const BrewItem = createClass({ const brew = this.props.brew; if(Array.isArray(brew.tags)) { // temporary fix until dud tags are cleaned brew.tags = brew.tags?.filter((tag)=>tag); //remove tags that are empty strings + brew.tags.sort((a, b)=>{ + return a.indexOf(':') - b.indexOf(':') != 0 ? a.indexOf(':') - b.indexOf(':') : a.toLowerCase().localeCompare(b.toLowerCase()); + }); } const dateFormatString = 'YYYY-MM-DD HH:mm:ss'; @@ -129,7 +137,7 @@ const BrewItem = createClass({ {brew.tags.map((tag, idx)=>{ const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/); - return {matches[2]}; + return {this.updateFilter(tag);}}>{matches[2]}; })} > : <>> diff --git a/client/homebrew/pages/basePages/listPage/brewItem/brewItem.less b/client/homebrew/pages/basePages/listPage/brewItem/brewItem.less index 5a1bb3d922..9bee4e5ebd 100644 --- a/client/homebrew/pages/basePages/listPage/brewItem/brewItem.less +++ b/client/homebrew/pages/basePages/listPage/brewItem/brewItem.less @@ -63,6 +63,41 @@ white-space: nowrap; display: inline-block; font-weight: bold; + border-color: currentColor; + cursor : pointer; + &:before { + font-family: 'Font Awesome 5 Free'; + font-size: 12px; + margin-right: 3px; + } + &.type { + background-color: #0080003b; + color: #008000; + &:before{ + content: '\f0ad'; + } + } + &.group { + background-color: #5050503b; + color: #000000; + &:before{ + content: '\f500'; + } + } + &.meta { + background-color: #0000803b; + color: #000080; + &:before{ + content: '\f05a'; + } + } + &.system { + background-color: #8000003b; + color: #800000; + &:before{ + content: '\f518'; + } + } } &:hover{ .links{ diff --git a/client/homebrew/pages/basePages/listPage/listPage.jsx b/client/homebrew/pages/basePages/listPage/listPage.jsx index d0cd11ec6b..2385b4490f 100644 --- a/client/homebrew/pages/basePages/listPage/listPage.jsx +++ b/client/homebrew/pages/basePages/listPage/listPage.jsx @@ -36,6 +36,7 @@ const ListPage = createClass({ return { filterString : this.props.query?.filter || '', + filterTags : [], sortType : this.props.query?.sort || null, sortDir : this.props.query?.dir || null, query : this.props.query, @@ -82,7 +83,7 @@ const ListPage = createClass({ if(!brews || !brews.length) return