From 420821f0ca05d7564714233f087f30afd643bbec Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Tue, 28 May 2019 19:49:18 -0300 Subject: [PATCH] only show hostname of HTTPS upgrades in details view close https://github.com/brave/brave-browser/issues/3367 --- .../controls/httpsUpgradesControl.tsx | 5 +- .../components/list/httpsUpgrades.tsx | 70 +++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 components/brave_extension/extension/brave_extension/components/list/httpsUpgrades.tsx diff --git a/components/brave_extension/extension/brave_extension/components/controls/httpsUpgradesControl.tsx b/components/brave_extension/extension/brave_extension/components/controls/httpsUpgradesControl.tsx index baa461642925..f4d0925e780e 100644 --- a/components/brave_extension/extension/brave_extension/components/controls/httpsUpgradesControl.tsx +++ b/components/brave_extension/extension/brave_extension/components/controls/httpsUpgradesControl.tsx @@ -15,7 +15,7 @@ import { } from 'brave-ui/features/shields' // Group Components -import StaticList from '../list/static' +import HTTPSUpgrades from '../list/httpsUpgrades' // Locale import { getLocale } from '../../background/api/localeAPI' @@ -128,11 +128,10 @@ export default class HTTPSUpgradesControl extends React.PureComponent { connectionsUpgradedOpen && - diff --git a/components/brave_extension/extension/brave_extension/components/list/httpsUpgrades.tsx b/components/brave_extension/extension/brave_extension/components/list/httpsUpgrades.tsx new file mode 100644 index 000000000000..4834e4b21834 --- /dev/null +++ b/components/brave_extension/extension/brave_extension/components/list/httpsUpgrades.tsx @@ -0,0 +1,70 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import * as React from 'react' + +import { + BlockedListHeader, + BlockedListSummary, + BlockedListContent, + BlockedListStatic, + BlockedListItem, + BlockedListFooter, + ArrowUpIcon, + Favicon, + SiteInfoText, + BlockedInfoRowStats, + BlockedListSummaryText, + ShieldsButton +} from 'brave-ui/features/shields' + +// Helpers +import { blockedResourcesSize } from '../../helpers/shieldsUtils' + +// Locale +import { getLocale } from '../../background/api/localeAPI' + +interface Props { + favicon: string + hostname: string + stats: number + list: Array + onClose?: (event?: React.MouseEvent) => void +} + +export default class HTTPSUpgrades extends React.PureComponent { + get statsDisplay (): string { + const { stats } = this.props + return blockedResourcesSize(stats) + } + + getHostname = (url: string): string => { + return new window.URL(url).hostname + } + + render () { + const { favicon, hostname, list, onClose } = this.props + return ( + + + + {hostname} + +
+ + + {this.statsDisplay} + {getLocale('connectionsUpgradedHTTPS')} + + + {list.map((item, index) => {this.getHostname(item)})} + +
+ + + +
+ ) + } +}