From e79d26ddbcdc6c78b114770ecb64ede04f41706c Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Thu, 7 Jun 2018 13:55:54 -0500 Subject: [PATCH] fix error in last, add commas to rule count ref #272 --- src/FilterLists.Api/V1/Controllers/RulesController.cs | 2 +- src/FilterLists.Web/ClientApp/components/Home.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/FilterLists.Api/V1/Controllers/RulesController.cs b/src/FilterLists.Api/V1/Controllers/RulesController.cs index 714bb13ab..b1037c0cc 100644 --- a/src/FilterLists.Api/V1/Controllers/RulesController.cs +++ b/src/FilterLists.Api/V1/Controllers/RulesController.cs @@ -14,6 +14,6 @@ public RulesController(RuleService ruleService) } [HttpGet] - public async Task Index() => Json(new {Count = await _ruleService.GetCountAll()}); + public async Task Index() => Json(await _ruleService.GetCountAll()); } } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/components/Home.tsx b/src/FilterLists.Web/ClientApp/components/Home.tsx index 10b12ef87..adf13e0e7 100644 --- a/src/FilterLists.Web/ClientApp/components/Home.tsx +++ b/src/FilterLists.Web/ClientApp/components/Home.tsx @@ -58,12 +58,17 @@ export class Home extends React.Component, IHomeState> { private static renderTagline(state: IHomeState) { return

- The independent, comprehensive directory of {state.ruleCount + The independent, comprehensive directory of {this.insertCommasInNumber(state.ruleCount) } unique rules across {state.lists.length } filter and host lists for advertisements, trackers, malware, and annoyances.

; } + //https://stackoverflow.com/a/2901298/2343739 + private static insertCommasInNumber(num: number) { + return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + } + private static renderFilterListsTable(filterLists: IListDto[]) { return