Skip to content

Commit 7f96a12

Browse files
committed
Add test environment label in the login view
1 parent c99dfa7 commit 7f96a12

5 files changed

Lines changed: 29 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- Test label in the login view int he test environment
8+
59
### Changed
610

711
- Hide create event button when project does not allow loose events

src/common/components/appTitle/AppTitle.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
import React from 'react';
22
import { useTranslate } from 'react-admin';
33

4-
import Config from '../../../domain/config';
5-
import styles from './appTitle.module.css';
4+
import IsTestEnvironmentLabel from '../isTestEnvironmentLabel/IsTestEnvironmentLabel';
65

76
const AppTitle = () => {
87
const translate = useTranslate();
98

10-
const isTestEnvironment = Config.IS_TEST_ENVIRONMENT;
11-
const testEnvironmentString = ` ${translate('application.test')}`;
12-
139
return (
1410
<>
1511
{translate('dashboard.title')}
16-
{isTestEnvironment && (
17-
<span className={styles.uppercase}>{testEnvironmentString}</span>
18-
)}
12+
<IsTestEnvironmentLabel />
1913
</>
2014
);
2115
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import { useTranslate } from 'react-admin';
3+
4+
import Config from '../../../domain/config';
5+
import styles from './isTestEnvironmentLabel.module.css';
6+
7+
const IsTestEnvironmentLabel = () => {
8+
const translate = useTranslate();
9+
10+
const isTestEnvironment = Config.IS_TEST_ENVIRONMENT;
11+
const testEnvironmentString = ` ${translate('application.test')}`;
12+
13+
return isTestEnvironment ? (
14+
<span className={styles.uppercase}>{testEnvironmentString}</span>
15+
) : null;
16+
};
17+
18+
export default IsTestEnvironmentLabel;

src/common/components/appTitle/appTitle.module.css renamed to src/common/components/isTestEnvironmentLabel/isTestEnvironmentLabel.module.css

File renamed without changes.

src/domain/authentication/LoginPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { makeStyles } from '@material-ui/core/styles';
66
import { RouteComponentProps, StaticContext } from 'react-router';
77

88
import theme from '../../common/materialUI/themeConfig';
9+
import IsTestEnvironmentLabel from '../../common/components/isTestEnvironmentLabel/IsTestEnvironmentLabel';
910

1011
const useStyles = makeStyles({
1112
container: {
@@ -45,7 +46,10 @@ const LoginPage = ({ location }: Props) => {
4546
<Card>
4647
<CardContent>
4748
<div className={classes.container}>
48-
<p>{translate('dashboard.title')}</p>
49+
<p>
50+
{translate('dashboard.title')}
51+
<IsTestEnvironmentLabel />
52+
</p>
4953
<Button
5054
className={classes.button}
5155
variant="contained"

0 commit comments

Comments
 (0)