Skip to content

Commit a5497d5

Browse files
committed
feat(frontend): clearly list variants not included in calculations
1 parent 145875a commit a5497d5

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed

frontend/src/components/VariantListPage/VariantListVariants.tsx

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Button,
55
Checkbox,
66
HStack,
7+
List,
78
ListItem,
89
Text,
910
Tooltip,
@@ -32,6 +33,7 @@ import {
3233
import MultipleSelect from "../MultipleSelect";
3334
import { DownloadVariantListLink } from "./DownloadVariantList";
3435
import VariantsTable from "./VariantsTable";
36+
import HelpTextHover from "../HelpTextHover";
3537

3638
export const combineVariants = (
3739
variants: Variant[],
@@ -181,16 +183,63 @@ const VariantListVariants = (props: VariantListVariantsProps) => {
181183
(variant) => (variant.AC || [])[0] === 0
182184
).length;
183185

186+
const allUnincludedVariants = renderedVariants.filter(
187+
(variant) => !selectedVariants.has(variant.id)
188+
);
189+
const unselectedVariants = allUnincludedVariants.filter(
190+
(variant) => !notIncludedVariants.has(variant.id)
191+
);
192+
const neverIncludedVariants = renderedVariants.filter((variant) =>
193+
notIncludedVariants.has(variant.id)
194+
);
195+
196+
const unselectedVariantsTooltip = (
197+
<>
198+
{unselectedVariants.length > 0 && (
199+
<>
200+
<Text>
201+
Currently unselected variant
202+
{unselectedVariants.length > 1 ? "s" : ""}:
203+
</Text>
204+
<List>
205+
{unselectedVariants.map((variant) => {
206+
return <ListItem pl={"2"}>{variant.id}</ListItem>;
207+
})}
208+
</List>
209+
</>
210+
)}
211+
{neverIncludedVariants.length > 0 && (
212+
<>
213+
<Text>
214+
Currently fully excluded variant
215+
{neverIncludedVariants.length > 1 ? "s" : ""}:
216+
</Text>
217+
<List>
218+
{neverIncludedVariants.map((variant) => {
219+
return <ListItem pl={"2"}>{variant.id}</ListItem>;
220+
})}
221+
</List>
222+
</>
223+
)}
224+
</>
225+
);
226+
184227
return (
185228
<>
186229
<Text mb={2}>
187230
This variant list contains {renderedVariants.length} variant
188231
{variantList.variants.length !== 1 ? "s" : ""}.
189232
</Text>
190-
<Text mb={2}>
191-
{notIncludedVariants.size} variant
192-
{notIncludedVariants.size !== 1 ? "s" : ""} are not included.
193-
</Text>
233+
{allUnincludedVariants.length > 0 && (
234+
<>
235+
<Text mb={2}>
236+
{allUnincludedVariants.length} variant
237+
{allUnincludedVariants.length !== 1 ? "s are" : " is"} not currently
238+
included in the calculations.{" "}
239+
<HelpTextHover helpText={unselectedVariantsTooltip} />
240+
</Text>
241+
</>
242+
)}
194243

195244
{variantList.status === "Ready" ? (
196245
<>

0 commit comments

Comments
 (0)