|
4 | 4 | Button, |
5 | 5 | Checkbox, |
6 | 6 | HStack, |
| 7 | + List, |
7 | 8 | ListItem, |
8 | 9 | Text, |
9 | 10 | Tooltip, |
@@ -32,6 +33,7 @@ import { |
32 | 33 | import MultipleSelect from "../MultipleSelect"; |
33 | 34 | import { DownloadVariantListLink } from "./DownloadVariantList"; |
34 | 35 | import VariantsTable from "./VariantsTable"; |
| 36 | +import HelpTextHover from "../HelpTextHover"; |
35 | 37 |
|
36 | 38 | export const combineVariants = ( |
37 | 39 | variants: Variant[], |
@@ -181,16 +183,63 @@ const VariantListVariants = (props: VariantListVariantsProps) => { |
181 | 183 | (variant) => (variant.AC || [])[0] === 0 |
182 | 184 | ).length; |
183 | 185 |
|
| 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 | + |
184 | 227 | return ( |
185 | 228 | <> |
186 | 229 | <Text mb={2}> |
187 | 230 | This variant list contains {renderedVariants.length} variant |
188 | 231 | {variantList.variants.length !== 1 ? "s" : ""}. |
189 | 232 | </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 | + )} |
194 | 243 |
|
195 | 244 | {variantList.status === "Ready" ? ( |
196 | 245 | <> |
|
0 commit comments