From c9736ec0fafaef4ea9cfce5342f2e08792916aef Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Sun, 14 Oct 2018 23:42:25 +0300 Subject: [PATCH] capitalize category name --- client/src/components/Dashboard/Statistics.js | 2 +- client/src/components/ui/Popover.js | 5 ++++- client/src/helpers/helpers.js | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/components/Dashboard/Statistics.js b/client/src/components/Dashboard/Statistics.js index 434c21fd..a54e0c00 100644 --- a/client/src/components/Dashboard/Statistics.js +++ b/client/src/components/Dashboard/Statistics.js @@ -48,7 +48,7 @@ class Statistics extends Component { {getPercent(dnsQueries, blockedFiltering)}
- Blocked by Filters + Blocked by Filters
diff --git a/client/src/components/ui/Popover.js b/client/src/components/ui/Popover.js index 7ffbabed..4ed27afd 100644 --- a/client/src/components/ui/Popover.js +++ b/client/src/components/ui/Popover.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { getSourceData } from '../../helpers/trackers/trackers'; +import { captitalizeWords } from '../../helpers/helpers'; import './Popover.css'; @@ -22,6 +23,8 @@ class Popover extends Component {
); + const categoryName = captitalizeWords(data.category); + return (
@@ -34,7 +37,7 @@ class Popover extends Component {
{tracker}
- Category: {data.category} + Category: {categoryName}
{source}
diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 1dea8b8a..07c343bc 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -81,3 +81,5 @@ export const getPercent = (amount, number) => { } return 0; }; + +export const captitalizeWords = text => text.split(/[ -_]/g).map(str => str.charAt(0).toUpperCase() + str.substr(1)).join(' ');