fix(backend-test-repo): show notice when test repo is in use (#2678)
This commit is contained in:
parent
435d772384
commit
c1c95874f4
@ -169,6 +169,7 @@ class App extends React.Component {
|
|||||||
openMediaLibrary={openMediaLibrary}
|
openMediaLibrary={openMediaLibrary}
|
||||||
hasWorkflow={hasWorkflow}
|
hasWorkflow={hasWorkflow}
|
||||||
displayUrl={config.get('display_url')}
|
displayUrl={config.get('display_url')}
|
||||||
|
isTestRepo={config.getIn(['backend', 'name']) === 'test-repo'}
|
||||||
showMediaButton={showMediaButton}
|
showMediaButton={showMediaButton}
|
||||||
/>
|
/>
|
||||||
<AppMainContainer>
|
<AppMainContainer>
|
||||||
|
@ -118,6 +118,7 @@ class Header extends React.Component {
|
|||||||
openMediaLibrary: PropTypes.func.isRequired,
|
openMediaLibrary: PropTypes.func.isRequired,
|
||||||
hasWorkflow: PropTypes.bool.isRequired,
|
hasWorkflow: PropTypes.bool.isRequired,
|
||||||
displayUrl: PropTypes.string,
|
displayUrl: PropTypes.string,
|
||||||
|
isTestRepo: PropTypes.bool,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ class Header extends React.Component {
|
|||||||
openMediaLibrary,
|
openMediaLibrary,
|
||||||
hasWorkflow,
|
hasWorkflow,
|
||||||
displayUrl,
|
displayUrl,
|
||||||
|
isTestRepo,
|
||||||
t,
|
t,
|
||||||
showMediaButton,
|
showMediaButton,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -198,6 +200,7 @@ class Header extends React.Component {
|
|||||||
)}
|
)}
|
||||||
<SettingsDropdown
|
<SettingsDropdown
|
||||||
displayUrl={displayUrl}
|
displayUrl={displayUrl}
|
||||||
|
isTestRepo={isTestRepo}
|
||||||
imageUrl={user.get('avatar_url')}
|
imageUrl={user.get('avatar_url')}
|
||||||
onLogoutClick={onLogoutClick}
|
onLogoutClick={onLogoutClick}
|
||||||
/>
|
/>
|
||||||
|
@ -39,6 +39,13 @@ const AppHeaderSiteLink = styled.a`
|
|||||||
padding: 10px 16px;
|
padding: 10px 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const AppHeaderTestRepoIndicator = styled.a`
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #7b8290;
|
||||||
|
padding: 10px 16px;
|
||||||
|
`;
|
||||||
|
|
||||||
const Avatar = ({ imageUrl }) =>
|
const Avatar = ({ imageUrl }) =>
|
||||||
imageUrl ? <AvatarImage src={imageUrl} /> : <AvatarPlaceholderIcon type="user" size="large" />;
|
imageUrl ? <AvatarImage src={imageUrl} /> : <AvatarPlaceholderIcon type="user" size="large" />;
|
||||||
|
|
||||||
@ -46,8 +53,17 @@ Avatar.propTypes = {
|
|||||||
imageUrl: PropTypes.string,
|
imageUrl: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick, t }) => (
|
const SettingsDropdown = ({ displayUrl, isTestRepo, imageUrl, onLogoutClick, t }) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
{isTestRepo && (
|
||||||
|
<AppHeaderTestRepoIndicator
|
||||||
|
href="https://www.netlifycms.org/docs/authentication-backends#test-repo-backend"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Test Backend ↗
|
||||||
|
</AppHeaderTestRepoIndicator>
|
||||||
|
)}
|
||||||
{displayUrl ? (
|
{displayUrl ? (
|
||||||
<AppHeaderSiteLink href={displayUrl} target="_blank">
|
<AppHeaderSiteLink href={displayUrl} target="_blank">
|
||||||
{stripProtocol(displayUrl)}
|
{stripProtocol(displayUrl)}
|
||||||
@ -70,6 +86,7 @@ const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick, t }) => (
|
|||||||
|
|
||||||
SettingsDropdown.propTypes = {
|
SettingsDropdown.propTypes = {
|
||||||
displayUrl: PropTypes.string,
|
displayUrl: PropTypes.string,
|
||||||
|
isTestRepo: PropTypes.bool,
|
||||||
imageUrl: PropTypes.string,
|
imageUrl: PropTypes.string,
|
||||||
onLogoutClick: PropTypes.func.isRequired,
|
onLogoutClick: PropTypes.func.isRequired,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user