feat: highlight for datetime in card summary

This commit is contained in:
2025-04-11 11:01:23 +04:00
parent bf6f373e21
commit 4b2db371d9

View File

@@ -30,6 +30,13 @@ const CardAttributesInSummaryItem = ({ cardSummary }: Props) => {
return value;
};
const isHighlightNeeded = (cardAttr: CardAttributeSchema): boolean => {
const type = cardAttr.attribute.type.type;
if (type !== "datetime") return false;
const datetime = new Date(cardAttr.value as string);
return datetime < new Date();
};
return (
<Flex direction={"column"}>
{cardSummary.attributes
@@ -38,11 +45,14 @@ const CardAttributesInSummaryItem = ({ cardSummary }: Props) => {
cardAttr.value !== null &&
attributeIds.has(cardAttr.attribute.id)
))
.map(cardAttr => (
<Text c={"gray.6"} size={"sm"}>
{cardAttr.attribute.label}: {getAttrValueValue(cardAttr)}
</Text>
))
.map(cardAttr => {
const isHighlight = isHighlightNeeded(cardAttr);
return (
<Text c={isHighlight ? "white" : "gray.6"} size={"sm"}>
{cardAttr.attribute.label}: {getAttrValueValue(cardAttr)}
</Text>
);
})
}
</Flex>
);