From 0964fc1f4df267ad6bbd7e82506d708fffe1ef67 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 26 Jan 2022 19:37:32 -0600 Subject: [PATCH] Add "demo" mode for taking screenshots --- app/images/soapbox-logo.svg | 1 + app/soapbox/containers/soapbox.js | 7 +++++-- app/soapbox/features/ui/components/tabs_bar.js | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 app/images/soapbox-logo.svg diff --git a/app/images/soapbox-logo.svg b/app/images/soapbox-logo.svg new file mode 100644 index 000000000..270b7b810 --- /dev/null +++ b/app/images/soapbox-logo.svg @@ -0,0 +1 @@ + diff --git a/app/soapbox/containers/soapbox.js b/app/soapbox/containers/soapbox.js index 651ddb703..40b4e10b6 100644 --- a/app/soapbox/containers/soapbox.js +++ b/app/soapbox/containers/soapbox.js @@ -54,6 +54,9 @@ const mapStateToProps = (state) => { const soapboxConfig = getSoapboxConfig(state); const locale = settings.get('locale'); + // In demo mode, force the default brand color + const brandColor = settings.get('demo') ? '#0482d8' : soapboxConfig.get('brandColor'); + return { showIntroduction, me, @@ -63,11 +66,11 @@ const mapStateToProps = (state) => { dyslexicFont: settings.get('dyslexicFont'), demetricator: settings.get('demetricator'), locale: validLocale(locale) ? locale : 'en', - themeCss: generateThemeCss(soapboxConfig.get('brandColor')), + themeCss: generateThemeCss(brandColor), brandColor: soapboxConfig.get('brandColor'), themeMode: settings.get('themeMode'), halloween: settings.get('halloween'), - customCss: soapboxConfig.get('customCss'), + customCss: settings.get('demo') ? null : soapboxConfig.get('customCss'), }; }; diff --git a/app/soapbox/features/ui/components/tabs_bar.js b/app/soapbox/features/ui/components/tabs_bar.js index b6ca8f420..8e833334a 100644 --- a/app/soapbox/features/ui/components/tabs_bar.js +++ b/app/soapbox/features/ui/components/tabs_bar.js @@ -6,6 +6,7 @@ import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; import { connect } from 'react-redux'; import { Link, NavLink, withRouter } from 'react-router-dom'; +import { getSettings } from 'soapbox/actions/settings'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import Icon from 'soapbox/components/icon'; import IconWithCounter from 'soapbox/components/icon_with_counter'; @@ -168,10 +169,14 @@ const mapStateToProps = state => { const reportsCount = state.getIn(['admin', 'openReports']).count(); const approvalCount = state.getIn(['admin', 'awaitingApproval']).count(); const instance = state.get('instance'); + const settings = getSettings(state); + + // In demo mode, use the Soapbox logo + const logo = settings.get('demo') ? require('images/soapbox-logo.svg') : getSoapboxConfig(state).get('logo'); return { account: state.getIn(['accounts', me]), - logo: getSoapboxConfig(state).get('logo'), + logo, features: getFeatures(instance), notificationCount: state.getIn(['notifications', 'unread']), chatsCount: state.getIn(['chats', 'items']).reduce((acc, curr) => acc + Math.min(curr.get('unread', 0), 1), 0),