Skip to content

Commit e2ab4a1

Browse files
removed magic numbers for sparkle overlay
1 parent 198e3d8 commit e2ab4a1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

client/src/components/ui/eventHighlightCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ const renderCardHeader = (card: eventHighlightCardType) => {
5151
};
5252

5353
// helper to ensure sparkles are different
54-
function getTwoUniqueIndexes(): [number, number] {
55-
const first = Math.floor(Math.random() * 3);
56-
let second = Math.floor(Math.random() * 3);
54+
function getTwoUniqueIndexes(sparkleImages: string[]): [number, number] {
55+
const first = Math.floor(Math.random() * sparkleImages.length);
56+
let second = Math.floor(Math.random() * sparkleImages.length);
5757

5858
if (second === first) {
5959
second = (first + 1) % 3;
@@ -63,7 +63,7 @@ function getTwoUniqueIndexes(): [number, number] {
6363

6464
// only render sparkles on specific cards
6565
export function renderSparkleOverlay(card: eventHighlightCardType) {
66-
const [i1, i2] = getTwoUniqueIndexes();
66+
const [i1, i2] = getTwoUniqueIndexes(sparkleImages);
6767
switch (card.id) {
6868
case 2:
6969
return (

0 commit comments

Comments
 (0)