mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 12:53:56 +01:00
hide compare rows with just 1 cell of value
This commit is contained in:
1 file changed
+4
-1
@@ -181,10 +181,13 @@ interface GroupProps {
|
|||||||
function Group({ group, characteristics }: GroupProps) {
|
function Group({ group, characteristics }: GroupProps) {
|
||||||
const strings = useStrings();
|
const strings = useStrings();
|
||||||
const members = CompareEphemeral.use((state) => state.members);
|
const members = CompareEphemeral.use((state) => state.members);
|
||||||
|
// A lone tank still shows its values; otherwise rows need two tanks to compare
|
||||||
|
const minimumPresent = Math.min(2, characteristics.length);
|
||||||
const items = group.order.filter(
|
const items = group.order.filter(
|
||||||
(item): item is CharacteristicRenderConfig =>
|
(item): item is CharacteristicRenderConfig =>
|
||||||
"name" in item &&
|
"name" in item &&
|
||||||
characteristics.some((computed) => computed.has(item.name)),
|
characteristics.filter((computed) => computed.has(item.name)).length >=
|
||||||
|
minimumPresent,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (items.length === 0) return null;
|
if (items.length === 0) return null;
|
||||||
|
|||||||
Reference in new issue
Block a user