From 889450405f53db9c5306e4422b1cb6474f1a9be3 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 20 Jun 2019 15:17:38 -0700 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20Add=20setting=20options=20to=20?= =?UTF-8?q?toggle=20NTP=20widgets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- browser/ui/webui/brave_webui_source.cc | 3 + .../components/newTab/index.tsx | 28 +++++-- .../components/newTab/settings.tsx | 41 +++++++++- .../components/newTab/stats.tsx | 6 +- components/brave_new_tab_ui/storage.ts | 3 + components/definitions/newTab.d.ts | 23 +++--- .../resources/brave_components_strings.grd | 5 +- package-lock.json | 82 +++++++++---------- 8 files changed, 131 insertions(+), 60 deletions(-) diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index 24903bc8d8a6..27fa5942692b 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -137,6 +137,9 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "dashboardSettingsTitle", IDS_BRAVE_NEW_TAB_DASHBOARD_SETTINGS_TITLE }, { "showBackgroundImage", IDS_BRAVE_NEW_TAB_SHOW_BACKGROUND_IMAGE }, + { "showBraveStats", IDS_BRAVE_NEW_TAB_SHOW_BRAVE_STATS }, + { "showClock", IDS_BRAVE_NEW_TAB_SHOW_CLOCK }, + { "showTopSites", IDS_BRAVE_NEW_TAB_SHOW_TOP_SITES }, // Private Tab - General { "learnMore", IDS_BRAVE_PRIVATE_NEW_TAB_LEARN_MORE }, diff --git a/components/brave_new_tab_ui/components/newTab/index.tsx b/components/brave_new_tab_ui/components/newTab/index.tsx index a504a0444dfd..be48eab267ac 100644 --- a/components/brave_new_tab_ui/components/newTab/index.tsx +++ b/components/brave_new_tab_ui/components/newTab/index.tsx @@ -8,9 +8,9 @@ import HTML5Backend from 'react-dnd-html5-backend' import { Page, Header, - Clock, + ClockWidget as Clock, Main, - List, + ListWidget as List, Footer, DynamicBackground, Gradient @@ -69,6 +69,18 @@ class NewTabPage extends React.Component { ) } + toggleShowClock = () => { + this.props.actions.toggleShowClock() + } + + toggleShowStats = () => { + this.props.actions.toggleShowStats() + } + + toggleShowTopSites = () => { + this.props.actions.toggleShowTopSites() + } + showSettings = () => { this.props.actions.showSettingsMenu() } @@ -89,10 +101,10 @@ class NewTabPage extends React.Component { {newTabData.showBackgroundImage && }
- - + +
- + { this.props.newTabData.gridSites.map((site: NewTab.Site) => { }