Skip to content

Commit ee5b5ed

Browse files
RoemerRoman Bäriswyl
andauthored
Feature/help texts (#248)
* Fixed build for Windows/Git-Bash * Added custom tooltip component * Switch to the new tooltip component * Added new help texts Co-authored-by: Roman Bäriswyl <[email protected]>
1 parent af6f1ab commit ee5b5ed

File tree

12 files changed

+71
-39
lines changed

12 files changed

+71
-39
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"use-image": "^1.0.6"
3232
},
3333
"scripts": {
34-
"start": "chmod +x ./env.sh && ./env.sh && cp env-config.js ./public/ && react-scripts start",
34+
"start": "chmod +x ./env.sh && sh ./env.sh && cp env-config.js ./public/ && react-scripts start",
3535
"build": "react-scripts build",
3636
"test": "react-scripts test",
3737
"test:cy": "cypress run-ct"

src/components/ApproveRejectButtons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Grid, Tooltip, Chip, Button } from "@material-ui/core";
1+
import { Grid, Chip, Button } from "@material-ui/core";
22
import { useSnackbar } from "notistack";
33
import { useHotkeys } from "react-hotkeys-hook";
44
import React from "react";
55
import { testRunService } from "../services";
66
import { TestRun } from "../types";
7+
import { Tooltip } from "./Tooltip";
78

89
export const ApproveRejectButtons: React.FunctionComponent<{
910
testRun: TestRun;

src/components/BuildDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import {
55
Grid,
66
Box,
77
LinearProgress,
8-
Tooltip,
98
} from "@material-ui/core";
109
import { BuildStatusChip } from "./BuildStatusChip";
1110
import { formatDateTime } from "../_helpers/format.helper";
1211
import { useBuildState } from "../contexts";
1312
import { LOCATOR_BUILD_DETAILS } from "../constants/help";
13+
import { Tooltip } from "./Tooltip";
1414

1515
const BuildDetails: React.FunctionComponent = () => {
1616
const { selectedBuild } = useBuildState();

src/components/BuildList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Menu,
1616
MenuItem,
1717
Box,
18-
Tooltip,
1918
} from "@material-ui/core";
2019
import { MoreVert } from "@material-ui/icons";
2120
import {
@@ -35,6 +34,7 @@ import { BaseModal } from "../BaseModal";
3534
import { buildsService } from "../../services";
3635
import { useHistory } from "react-router";
3736
import { buildTestRunLocation } from "../../_helpers/route.helpers";
37+
import { Tooltip } from "../Tooltip";
3838

3939
const useStyles = makeStyles((theme: Theme) =>
4040
createStyles({

src/components/ImageDetails.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react";
2-
import { Typography, Chip, Grid, IconButton, Tooltip } from "@material-ui/core";
2+
import { Typography, Chip, Grid, IconButton } from "@material-ui/core";
33
import { WarningRounded } from "@material-ui/icons";
44
import { staticService } from "../services";
55
import useImage from "use-image";
66
import { IgnoreArea } from "../types/ignoreArea";
7+
import { Tooltip } from "./Tooltip";
78

89
interface IProps {
910
type: "Baseline" | "Image" | "Diff";

src/components/ProjectForm/PixelmatchConfigForm.tsx

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,48 @@ import { FormControlLabel, Switch } from "@material-ui/core";
22
import React from "react";
33
import { TextValidator } from "react-material-ui-form-validator";
44
import { PixelmatchConfig } from "../../types/imageComparison";
5+
import { Tooltip } from "../Tooltip";
56
import { useConfigHook } from "./useConfigHook";
67

78
export const PixelmatchConfigForm: React.FunctionComponent = () => {
89
const [config, updateConfig] = useConfigHook<PixelmatchConfig>();
910

1011
return (
1112
<React.Fragment>
12-
<FormControlLabel
13-
label="Allow diff dimensions"
14-
control={
15-
<Switch
16-
checked={config.allowDiffDimensions}
17-
onChange={(event, checked) =>
18-
updateConfig("allowDiffDimensions", checked)
19-
}
20-
color="primary"
21-
name="diffDimensionsFeature"
22-
/>
23-
}
24-
/>
25-
<FormControlLabel
26-
label="Ignore anti-aliasing"
27-
control={
28-
<Switch
29-
checked={config.ignoreAntialiasing}
30-
onChange={(event, checked) =>
31-
updateConfig("ignoreAntialiasing", checked)
32-
}
33-
color="primary"
34-
name="ignoreAntialiasing"
35-
/>
36-
}
37-
/>
13+
<Tooltip
14+
title="Enable comparison of images with different sizes."
15+
>
16+
<FormControlLabel
17+
label="Allow diff dimensions"
18+
control={
19+
<Switch
20+
checked={config.allowDiffDimensions}
21+
onChange={(event, checked) =>
22+
updateConfig("allowDiffDimensions", checked)
23+
}
24+
color="primary"
25+
name="diffDimensionsFeature"
26+
/>
27+
}
28+
/>
29+
</Tooltip>
30+
<Tooltip
31+
title="Ignore detecting and ignoring anti-aliased pixels."
32+
>
33+
<FormControlLabel
34+
label="Ignore anti-aliasing"
35+
control={
36+
<Switch
37+
checked={config.ignoreAntialiasing}
38+
onChange={(event, checked) =>
39+
updateConfig("ignoreAntialiasing", checked)
40+
}
41+
color="primary"
42+
name="ignoreAntialiasing"
43+
/>
44+
}
45+
/>
46+
</Tooltip>
3847
<TextValidator
3948
name="threshold"
4049
validators={["minNumber:0", "maxNumber:1"]}
@@ -43,6 +52,7 @@ export const PixelmatchConfigForm: React.FunctionComponent = () => {
4352
margin="dense"
4453
id="threshold"
4554
label="Pixel diff threshold"
55+
helperText="The threshold of how much a pixel can deviate until it is detected as change (0-1)."
4656
type="number"
4757
fullWidth
4858
required

src/components/TestDetailsDialog/ArrowButtons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { IconButton, makeStyles, Tooltip } from "@material-ui/core";
1+
import { IconButton, makeStyles } from "@material-ui/core";
22
import { NavigateNext, NavigateBefore } from "@material-ui/icons";
33
import React from "react";
44
import { useHotkeys } from "react-hotkeys-hook";
55
import { TestRun } from "../../types";
6+
import { Tooltip } from "../Tooltip";
67

78
const useStyles = makeStyles((theme) => ({
89
button: {

src/components/TestDetailsDialog/TestDetailsModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
IconButton,
1010
Box,
1111
makeStyles,
12-
Tooltip,
1312
Select,
1413
MenuItem,
1514
LinearProgress,
@@ -43,6 +42,7 @@ import { ApproveRejectButtons } from "../ApproveRejectButtons";
4342
import { head } from "lodash";
4443
import { invertIgnoreArea } from "../../_helpers/ignoreArea.helper";
4544
import { BaseModal } from "../BaseModal";
45+
import { Tooltip } from "../Tooltip";
4646

4747
const defaultStagePos = {
4848
x: 0,

src/components/TestRunDetails.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22
import { Grid, Typography } from "@material-ui/core";
33
import { TestRun } from "../types";
44
import TestStatusChip from "./TestStatusChip";
5+
import { Tooltip } from "./Tooltip";
56

67
interface IProps {
78
testRun: TestRun;
@@ -37,12 +38,16 @@ export const TestRunDetails: React.FunctionComponent<IProps> = ({
3738
</Grid>
3839
)}
3940
<Grid item>
40-
<Typography>Diff: {testRun.diffPercent}%</Typography>
41+
<Tooltip title="How many percent of pixels are different according to the defined settings.">
42+
<Typography>Diff: {testRun.diffPercent}%</Typography>
43+
</Tooltip>
4144
</Grid>
4245
<Grid item>
43-
<Typography>
44-
Diff tollerance: {testRun.diffTollerancePercent}%
45-
</Typography>
46+
<Tooltip title="The allowed diff tolerance. Can be set with the diffTollerancePercent property in the track method.">
47+
<Typography>
48+
Diff tolerance: {testRun.diffTollerancePercent}%
49+
</Typography>
50+
</Tooltip>
4651
</Grid>
4752
<Grid item>
4853
<Typography display="inline">Status: </Typography>

src/components/TestRunList/BulkOperation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import {
33
Typography,
44
IconButton,
5-
Tooltip,
65
LinearProgress,
76
} from "@material-ui/core";
87
import {
@@ -17,6 +16,7 @@ import { Delete, LayersClear, ThumbDown, ThumbUp } from "@material-ui/icons";
1716
import { testRunService } from "../../services";
1817
import { TestStatus } from "../../types";
1918
import { head } from "lodash";
19+
import { Tooltip } from "../Tooltip";
2020

2121
export const BulkOperation: React.FunctionComponent = () => {
2222
const props = useGridSlotComponentProps();

0 commit comments

Comments
 (0)