add filter by name, other minor cleanup

This commit is contained in:
Collin Barrett 2018-02-17 12:35:52 -06:00
parent da94d102cf
commit 53c65fbf60
2 changed files with 9 additions and 14 deletions

View file

@ -34,27 +34,24 @@ export class Home extends React.Component<RouteComponentProps<{}>, IFilterListsS
return <ReactTable
data={filterLists}
columns={[
{
Header: "Id",
accessor: "id",
maxWidth: 50
},
{
Header: "Name",
accessor: "name"
accessor: "name",
filterable: true,
filterMethod: (filter: any, row: any) => row[filter.id].toUpperCase().startsWith(filter.value.toUpperCase())
},
{
Header: "Details",
accessor: "id",
Cell: (d: any) => <ListDetailsModal listId={d.value}/>,
sortable: false,
Cell: (rowInfo: any) => <ListDetailsModal listId={rowInfo.original.id}/>,
style: { textAlign: "center" },
width: 100
},
{
Header: "Subscribe",
accessor: "viewUrl",
Cell: (d: any) => <a
href={`abp:subscribe?location=${encodeURIComponent(d.value)}&amp;title=${encodeURIComponent(d.row.name)}`}
sortable: false,
Cell: (rowInfo: any) => <a
href={`abp:subscribe?location=${encodeURIComponent(rowInfo.row.viewUrl)}&amp;title=${encodeURIComponent(rowInfo.row.name)}`}
className="btn btn-primary btn-block"
title={"Subscribe to list with browser extension supporting \"abp:\" protcool (e.g. uBlock Origin, AdBlock Plus)."}>
Subscribe</a>,

View file

@ -68,9 +68,7 @@ function Name(props: any) {
function Description(props: any) {
if (props.description) {
if (props.url) {
return <p>
<blockquote cite={props.url}>{props.description}</blockquote>
</p>;
return <blockquote cite={props.url}>{props.description}</blockquote>;
} else {
return <p>{props.description}</p>;
}