diff --git a/src/FilterLists.Web/ClientApp/components/Home.tsx b/src/FilterLists.Web/ClientApp/components/Home.tsx index bcf58ed49..ee267c288 100644 --- a/src/FilterLists.Web/ClientApp/components/Home.tsx +++ b/src/FilterLists.Web/ClientApp/components/Home.tsx @@ -11,6 +11,8 @@ interface IHomeState { loadingLists: boolean; ruleCount: number; loadingRuleCount: boolean; + software: ISoftwareDto[]; + loadingSoftware: boolean; pageSize: number; } @@ -22,13 +24,15 @@ export class Home extends React.Component, IHomeState> { loadingLists: true, ruleCount: 0, loadingRuleCount: true, + software: [], + loadingSoftware: true, pageSize: 20 }; this.updatePageSize = this.updatePageSize.bind(this); } render() { - const contents = this.state.loadingLists || this.state.loadingRuleCount + const contents = this.state.loadingLists || this.state.loadingRuleCount || this.state.loadingSoftware ?

Loading...

@@ -59,6 +63,14 @@ export class Home extends React.Component, IHomeState> { loadingRuleCount: false }); }); + fetch("https://filterlists.com/api/v1/software") + .then(response => response.json() as Promise) + .then(data => { + this.setState({ + software: data, + loadingSoftware: false + }); + }); } updatePageSize() { @@ -91,6 +103,29 @@ export class Home extends React.Component, IHomeState> { sortMethod: (a: any, b: any) => a.toUpperCase() > b.toUpperCase() ? 1 : -1, Cell: (cell: any) =>

{cell.value}

}, + { + Header: "Software", + accessor: "softwareIds", + filterable: true, + filterMethod: (filter: any, row: any) => { + if (filter.value === "any") { + return true; + } + return row[filter.id].join(",").split(",").includes(filter.value); + }, + Filter: ({ filter, onChange }) => + , + Cell: () => null, + width: 100, + headerClassName: "d-none d-md-block", + className: "d-none d-md-block" + }, { Header: "Tags", accessor: "tags", @@ -116,7 +151,8 @@ export class Home extends React.Component, IHomeState> { .includes(filter.value.toUpperCase()), sortMethod: (a: any, b: any) => a.join().toUpperCase() > b.join().toUpperCase() ? 1 : -1, Cell: (cell: any) =>
{cell.value.map( - (e: any) => {e.iso6391})}
, + (e: any) => {e.iso6391}) + }, style: { whiteSpace: "inherit" }, width: 60, headerClassName: "d-none d-md-block", @@ -168,10 +204,16 @@ export class Home extends React.Component, IHomeState> { } } +interface ISoftwareDto { + id: number; + name: string; +} + interface IListDto { id: number; name: string; languages: IListLanguageDto[]; + softwareIds: number[]; tags: IListTagDto[]; updatedDate: string; }