Dev instance changelog button.

This commit is contained in:
infinite-persistence 2021-12-13 16:17:30 +08:00
parent 9c723b3db3
commit f3634c881d
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 26 additions and 5 deletions

View file

@ -1,4 +1,3 @@
import * as MODALS from 'constants/modal_types';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet'; import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
@ -33,7 +32,7 @@ const select = (state) => ({
const perform = (dispatch) => ({ const perform = (dispatch) => ({
setClientSetting: (key, value, push) => dispatch(doSetClientSetting(key, value, push)), setClientSetting: (key, value, push) => dispatch(doSetClientSetting(key, value, push)),
signOut: () => dispatch(doSignOut()), signOut: () => dispatch(doSignOut()),
openSignOutModal: () => dispatch(doOpenModal(MODALS.SIGN_OUT)), doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
clearEmailEntry: () => dispatch(doClearEmailEntry()), clearEmailEntry: () => dispatch(doClearEmailEntry()),
clearPasswordEntry: () => dispatch(doClearPasswordEntry()), clearPasswordEntry: () => dispatch(doClearPasswordEntry()),
}); });

View file

@ -1,6 +1,7 @@
// @flow // @flow
import { ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM, ENABLE_UI_NOTIFICATIONS } from 'config'; import { ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM, ENABLE_UI_NOTIFICATIONS } from 'config';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
@ -55,7 +56,7 @@ type Props = {
syncError: ?string, syncError: ?string,
emailToVerify?: string, emailToVerify?: string,
signOut: () => void, signOut: () => void,
openSignOutModal: () => void, doOpenModal: (string, ?{}) => void,
clearEmailEntry: () => void, clearEmailEntry: () => void,
clearPasswordEntry: () => void, clearPasswordEntry: () => void,
hasNavigated: boolean, hasNavigated: boolean,
@ -82,7 +83,7 @@ const Header = (props: Props) => {
authHeader, authHeader,
signOut, signOut,
syncError, syncError,
openSignOutModal, doOpenModal,
clearEmailEntry, clearEmailEntry,
clearPasswordEntry, clearPasswordEntry,
emailToVerify, emailToVerify,
@ -270,6 +271,27 @@ const Header = (props: Props) => {
> >
<Logo /> <Logo />
</Button> </Button>
{/* @if process.env.DEV_CHANGELOG */}
{history.location.pathname === '/' && (
<Button
title={'Changelog'}
className="badge--alert"
label={'Changelog'}
icon={ICONS.FEEDBACK}
onClick={() => {
doOpenModal(MODALS.CONFIRM, {
title: __('Changelog'),
subtitle: __('Warning: this is a test instance.'),
body: <p style={{ whiteSpace: 'pre-wrap' }}>{process.env.DEV_CHANGELOG}</p>,
onConfirm: (closeModal) => closeModal(),
hideCancel: true,
});
}}
/>
)}
{/* @endif */}
{!authHeader && ( {!authHeader && (
<div className="header__center"> <div className="header__center">
{/* @if TARGET='app' */} {/* @if TARGET='app' */}
@ -347,7 +369,7 @@ const Header = (props: Props) => {
</MenuLink> </MenuLink>
{authenticated ? ( {authenticated ? (
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}> <MenuItem onSelect={IS_WEB ? signOut : () => doOpenModal(MODALS.SIGN_OUT)}>
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={ICONS.SIGN_OUT} /> <Icon aria-hidden icon={ICONS.SIGN_OUT} />
{__('Sign Out')} {__('Sign Out')}