lighteningcards 2.1.8 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +695 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +696 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/LighteningCard.css +279 -0
- package/src/LighteningCard.js +102 -19
- package/src/components/LightningCardHTML.js +566 -0
- package/src/hooks/useLighteningStartWithRank.js +170 -162
- package/src/hooks/useLighteningWithRank.js +166 -160
- package/src/utils/generateBaccaratCardHTMLSVG.js +163 -0
package/dist/index.cjs.js
CHANGED
|
@@ -45191,6 +45191,632 @@ const useBaccaratCardStart = () => {
|
|
|
45191
45191
|
};
|
|
45192
45192
|
};
|
|
45193
45193
|
|
|
45194
|
+
/**
|
|
45195
|
+
* Generates SVG code for a baccarat card matching the HTML structure
|
|
45196
|
+
* Uses the same structure as the provided HTML with use tags for SVG symbols
|
|
45197
|
+
* @param {string} rank - The card rank (e.g., "5", "A", "K", "Q", "J", "10", "9", etc.)
|
|
45198
|
+
* @param {string} suit - The card suit (e.g., "hearts", "diamonds", "clubs", "spades")
|
|
45199
|
+
* @param {boolean} isMatching - Whether this is a matching card (changes colors)
|
|
45200
|
+
* @param {boolean} isMobile - Whether to use mobile sizing for rank/suit
|
|
45201
|
+
* @returns {string} SVG code as a string matching the HTML structure
|
|
45202
|
+
*/
|
|
45203
|
+
const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false, isMobile = false) => {
|
|
45204
|
+
// Format rank for display
|
|
45205
|
+
const formatRank = r => {
|
|
45206
|
+
if (!r) return "";
|
|
45207
|
+
const rankUpper = r.toUpperCase();
|
|
45208
|
+
const rankMap = {
|
|
45209
|
+
ACE: "A",
|
|
45210
|
+
KING: "K",
|
|
45211
|
+
QUEEN: "Q",
|
|
45212
|
+
JACK: "J",
|
|
45213
|
+
JOKER: "J"
|
|
45214
|
+
};
|
|
45215
|
+
return rankMap[rankUpper] || r;
|
|
45216
|
+
};
|
|
45217
|
+
const displayRank = formatRank(rank);
|
|
45218
|
+
const suitLower = (suit || "").toLowerCase();
|
|
45219
|
+
|
|
45220
|
+
// Get suit symbol and class
|
|
45221
|
+
const getSuitInfo = s => {
|
|
45222
|
+
switch (s) {
|
|
45223
|
+
case "hearts":
|
|
45224
|
+
case "heart":
|
|
45225
|
+
return {
|
|
45226
|
+
symbol: "H",
|
|
45227
|
+
class: "red--db016"
|
|
45228
|
+
};
|
|
45229
|
+
case "diamonds":
|
|
45230
|
+
case "diamond":
|
|
45231
|
+
return {
|
|
45232
|
+
symbol: "D",
|
|
45233
|
+
class: "red--db016"
|
|
45234
|
+
};
|
|
45235
|
+
case "clubs":
|
|
45236
|
+
case "club":
|
|
45237
|
+
return {
|
|
45238
|
+
symbol: "C",
|
|
45239
|
+
class: "darkKhaki--2565e"
|
|
45240
|
+
};
|
|
45241
|
+
case "spades":
|
|
45242
|
+
case "spade":
|
|
45243
|
+
return {
|
|
45244
|
+
symbol: "S",
|
|
45245
|
+
class: "darkKhaki--2565e"
|
|
45246
|
+
};
|
|
45247
|
+
default:
|
|
45248
|
+
return {
|
|
45249
|
+
symbol: "S",
|
|
45250
|
+
class: "darkKhaki--2565e"
|
|
45251
|
+
};
|
|
45252
|
+
}
|
|
45253
|
+
};
|
|
45254
|
+
const suitInfo = getSuitInfo(suitLower);
|
|
45255
|
+
suitInfo.symbol;
|
|
45256
|
+
const suitClass = suitInfo.class;
|
|
45257
|
+
|
|
45258
|
+
// Check if rank is "10" to use different positioning
|
|
45259
|
+
const isTen = displayRank === "10";
|
|
45260
|
+
|
|
45261
|
+
// Position values based on whether rank is "10" or not
|
|
45262
|
+
const rankXTop = isTen ? isMobile ? "10" : "5" : isMobile ? "18" : "15";
|
|
45263
|
+
const suitXTop = isTen ? isMobile ? "110" : "125" : isMobile ? "110" : "100";
|
|
45264
|
+
const rankXBottom = isTen ? isMobile ? "0" : "-10" : isMobile ? "12" : "10";
|
|
45265
|
+
const suitXBottom = isTen ? isMobile ? "100" : "115" : isMobile ? "100" : "100";
|
|
45266
|
+
const rankY = isMobile ? "18" : "25";
|
|
45267
|
+
const suitY = isMobile ? "15" : "10";
|
|
45268
|
+
const rankFontSize = isMobile ? "72" : "100";
|
|
45269
|
+
const suitFontSize = isMobile ? "84" : "115";
|
|
45270
|
+
|
|
45271
|
+
// Determine colors based on matching status
|
|
45272
|
+
let bgColor = "#2D2926";
|
|
45273
|
+
let bgColorEnd = "#2C2926";
|
|
45274
|
+
let fillColor;
|
|
45275
|
+
if (isMatching) {
|
|
45276
|
+
// Matching cards: white background
|
|
45277
|
+
bgColor = "#FFFFFF";
|
|
45278
|
+
bgColorEnd = "#FFFFFF";
|
|
45279
|
+
|
|
45280
|
+
// Determine fill color based on suit
|
|
45281
|
+
if (suitInfo.class === "red--db016") {
|
|
45282
|
+
// Hearts and Diamonds: red
|
|
45283
|
+
fillColor = "#e02423";
|
|
45284
|
+
} else {
|
|
45285
|
+
// Spades and Clubs: black
|
|
45286
|
+
fillColor = "#000000";
|
|
45287
|
+
}
|
|
45288
|
+
} else {
|
|
45289
|
+
// Non-matching cards: use original colors
|
|
45290
|
+
fillColor = suitInfo.class === "red--db016" ? "#e02423" : "#756957";
|
|
45291
|
+
}
|
|
45292
|
+
|
|
45293
|
+
// Generate SVG matching the HTML structure
|
|
45294
|
+
// The HTML uses viewBox="0 0 180 250" and uses symbols
|
|
45295
|
+
// We'll create a complete SVG that matches the visual appearance
|
|
45296
|
+
return `
|
|
45297
|
+
<svg viewBox="0 0 180 250" class="card--32433 ${suitClass}" ${isMatching ? 'style="z-index: 100; position: relative;"' : ""} xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
45298
|
+
<defs>
|
|
45299
|
+
<linearGradient id="card-bg-${isMatching ? "white" : "dark"}" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
45300
|
+
<stop offset="0%" stop-color="${bgColor}" />
|
|
45301
|
+
<stop offset="100%" stop-color="${bgColorEnd}" />
|
|
45302
|
+
</linearGradient>
|
|
45303
|
+
<linearGradient id="card-border-dark" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
45304
|
+
<stop offset="0%" stop-color="#F4E2C5" />
|
|
45305
|
+
<stop offset="91%" stop-color="#635541" />
|
|
45306
|
+
<stop offset="97%" stop-color="#978468" />
|
|
45307
|
+
<stop offset="100%" stop-color="#A79375" />
|
|
45308
|
+
</linearGradient>
|
|
45309
|
+
<radialGradient id="card-glow-dark" cx="53%" cy="58%" r="116%">
|
|
45310
|
+
<stop offset="0%" stop-color="#F4E2C5" />
|
|
45311
|
+
<stop offset="54%" stop-color="#635541" />
|
|
45312
|
+
<stop offset="100%" stop-color="#A79375" />
|
|
45313
|
+
</radialGradient>
|
|
45314
|
+
</defs>
|
|
45315
|
+
<g>
|
|
45316
|
+
<!-- Rank at top left corner -->
|
|
45317
|
+
<text x="${rankXTop}" y="${rankY}" font-family="Arial, sans-serif" font-size="${rankFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${displayRank}</text>
|
|
45318
|
+
<!-- Suit at top left, below rank -->
|
|
45319
|
+
<text x="${suitXTop}" y="${suitY}" font-family="Arial, sans-serif" font-size="${suitFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${getSuitSymbol(suitLower)}</text>
|
|
45320
|
+
<!-- Rank and suit at bottom right (rotated 180 degrees) -->
|
|
45321
|
+
<g transform="rotate(180, 90, 125)">
|
|
45322
|
+
<text x="${rankXBottom}" y="${rankY}" font-family="Arial, sans-serif" font-size="${rankFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${displayRank}</text>
|
|
45323
|
+
<text x="${suitXBottom}" y="${suitY}" font-family="Arial, sans-serif" font-size="${suitFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${getSuitSymbol(suitLower)}</text>
|
|
45324
|
+
</g>
|
|
45325
|
+
</g>
|
|
45326
|
+
</svg>
|
|
45327
|
+
`.trim();
|
|
45328
|
+
};
|
|
45329
|
+
|
|
45330
|
+
/**
|
|
45331
|
+
* Get suit symbol character
|
|
45332
|
+
*/
|
|
45333
|
+
const getSuitSymbol = suit => {
|
|
45334
|
+
switch (suit) {
|
|
45335
|
+
case "hearts":
|
|
45336
|
+
case "heart":
|
|
45337
|
+
return "♥";
|
|
45338
|
+
case "diamonds":
|
|
45339
|
+
case "diamond":
|
|
45340
|
+
return "♦";
|
|
45341
|
+
case "clubs":
|
|
45342
|
+
case "club":
|
|
45343
|
+
return "♣";
|
|
45344
|
+
case "spades":
|
|
45345
|
+
case "spade":
|
|
45346
|
+
return "♠";
|
|
45347
|
+
default:
|
|
45348
|
+
return "♠";
|
|
45349
|
+
}
|
|
45350
|
+
};
|
|
45351
|
+
|
|
45352
|
+
// Animation asset URLs
|
|
45353
|
+
const thunder_left$1 = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.f9848fb7.webp";
|
|
45354
|
+
const thunder_middle$1 = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/feeborderb.0e2c6bbe.webp";
|
|
45355
|
+
const thunder_right$1 = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.aeaa062e.webp";
|
|
45356
|
+
const border_start$1 = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/borderstar.65180209.webp";
|
|
45357
|
+
const border_loop$1 = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/borderloop.c55570cc.webp";
|
|
45358
|
+
|
|
45359
|
+
/**
|
|
45360
|
+
* HTML/CSS-based Lightning Card component matching the provided HTML structure
|
|
45361
|
+
*/
|
|
45362
|
+
const LightningCardHTML = ({
|
|
45363
|
+
cards,
|
|
45364
|
+
roundStatus,
|
|
45365
|
+
showRank = false,
|
|
45366
|
+
gameType,
|
|
45367
|
+
matchingCards = []
|
|
45368
|
+
}) => {
|
|
45369
|
+
const containerRef = React.useRef(null);
|
|
45370
|
+
React.useRef([]);
|
|
45371
|
+
const thunderLeftRef = React.useRef(null);
|
|
45372
|
+
const thunderRightRef = React.useRef(null);
|
|
45373
|
+
const thunderMiddleTopRef = React.useRef(null);
|
|
45374
|
+
const thunderMiddleBottomRef = React.useRef(null);
|
|
45375
|
+
const borderCanvasRefs = React.useRef([]);
|
|
45376
|
+
|
|
45377
|
+
// Determine card count for layout classes
|
|
45378
|
+
const cardCount = (cards === null || cards === void 0 ? void 0 : cards.length) || 0;
|
|
45379
|
+
const getCardCountClass = () => {
|
|
45380
|
+
if (cardCount === 1) return "oneCard--a7d9e";
|
|
45381
|
+
if (cardCount === 2) return "twoCards--4ca7e";
|
|
45382
|
+
if (cardCount === 3) return "threeCards--72213";
|
|
45383
|
+
if (cardCount === 4) return "fourCards--8b11f";
|
|
45384
|
+
return "";
|
|
45385
|
+
};
|
|
45386
|
+
|
|
45387
|
+
// Get device class - memoize to prevent unnecessary re-renders
|
|
45388
|
+
const [isDesktop, setIsDesktop] = React.useState(() => window.innerWidth >= 768);
|
|
45389
|
+
React.useEffect(() => {
|
|
45390
|
+
const handleResize = () => {
|
|
45391
|
+
setIsDesktop(window.innerWidth >= 768);
|
|
45392
|
+
};
|
|
45393
|
+
window.addEventListener("resize", handleResize, {
|
|
45394
|
+
passive: true
|
|
45395
|
+
});
|
|
45396
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
45397
|
+
}, []);
|
|
45398
|
+
const deviceClass = isDesktop ? "desktop--36d4c" : "mobile--4607f";
|
|
45399
|
+
|
|
45400
|
+
// Generate shell background SVG (from the HTML)
|
|
45401
|
+
const shellBackgroundSVG = `data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2258%22%20height%3D%2299%22%20preserveAspectRatio%3D%22none%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cdefs%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22b%22%20x1%3D%2250%25%22%20x2%3D%2250%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%232D2926%22%20offset%3D%220%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%232C2926%22%20offset%3D%22100%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22a%22%20x1%3D%2250%25%22%20x2%3D%2250%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%23F4E2C5%22%20offset%3D%220%25%22%20%2F%3E%3Cstop%20stop-color%3D%22%23635541%22%20offset%3D%2291%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%23978468%22%20offset%3D%2297%25%22%20%2F%3E%3Cstop%20stop-color%3D%22%23A79375%22%20offset%3D%22100%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CradialGradient%20id%3D%22c%22%20cx%3D%2253%25%22%20cy%3D%2258%25%22%20r%3D%22116%25%22%20fx%3D%2253%25%22%20fy%3D%22588%25%22%20gradientTransform%3D%22matrix(0%20.57%20-1%200%201.11%20.278)%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%23F4E2C5%22%20offset%3D%220%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%23635541%22%20offset%3D%2254%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20stop-color%3D%22%23A79375%22%20offset%3D%22100%25%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FradialGradient%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fdefs%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20fill%3D%22none%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20id%3D%22Rectangle%22%20fill%3D%22url(%23b)%22%20stroke%3D%22url(%23a)%22%20stroke-width%3D%223.38%22%20d%3D%22M29.15%2097.35l23.72-2.56c1.5-.17%202.64-1.5%202.57-3L53.36%2048.1v-.17l2.04-36.1c.08-1.5-1.02-2.83-2.52-3l-9.1-1.15L43%204.56%2029.15%201.8%2014.7%204.54l-.4%203.13-9.62%201.17c-1.5.18-2.6%201.5-2.53%203.02L4.2%2047.94v.18L2.12%2091.78c-.08%201.52%201.05%202.83%202.57%203l24.45%202.57z%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20stroke%3D%22url(%23c)%22%20stroke-width%3D%22.85%22%20d%3D%22M44.04%203.48L29.14.5l-15.6%202.97-.38%203.07L4.53%207.6C2.35%207.84.76%209.74.9%2011.93l2.03%2036.12L.85%2091.72c-.1%202.2%201.52%204.1%203.7%204.32l24.56%202.6%2023.9-2.6c2.18-.23%203.8-2.12%203.7-4.3L54.62%2048l2.04-36.1c.13-2.17-1.46-4.07-3.62-4.34L44.8%206.55l-.76-3.07z%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%20%20%20%20%3C%2Fsvg%3E`;
|
|
45402
|
+
|
|
45403
|
+
// Initialize refs and animations
|
|
45404
|
+
React.useEffect(() => {
|
|
45405
|
+
borderCanvasRefs.current = [];
|
|
45406
|
+
|
|
45407
|
+
// Animate thunder sprite helper
|
|
45408
|
+
const animateThunderSprite = (img, columns, rows, loop = true, speed = 0.25) => {
|
|
45409
|
+
if (!img || !img.complete) return null;
|
|
45410
|
+
const canvas = document.createElement("canvas");
|
|
45411
|
+
const ctx = canvas.getContext("2d");
|
|
45412
|
+
const imgWidth = img.naturalWidth;
|
|
45413
|
+
const imgHeight = img.naturalHeight;
|
|
45414
|
+
const frameWidth = imgWidth / columns;
|
|
45415
|
+
const frameHeight = imgHeight / rows;
|
|
45416
|
+
canvas.width = frameWidth;
|
|
45417
|
+
canvas.height = frameHeight;
|
|
45418
|
+
let currentFrame = 0;
|
|
45419
|
+
const totalFrames = columns * rows;
|
|
45420
|
+
let frameCount = 0;
|
|
45421
|
+
let animationId;
|
|
45422
|
+
const animate = () => {
|
|
45423
|
+
const col = currentFrame % columns;
|
|
45424
|
+
const row = Math.floor(currentFrame / columns);
|
|
45425
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
45426
|
+
ctx.drawImage(img, col * frameWidth, row * frameHeight, frameWidth, frameHeight, 0, 0, frameWidth, frameHeight);
|
|
45427
|
+
frameCount++;
|
|
45428
|
+
if (frameCount >= Math.floor(60 / (speed * 60))) {
|
|
45429
|
+
currentFrame = loop ? (currentFrame + 1) % totalFrames : currentFrame + 1;
|
|
45430
|
+
frameCount = 0;
|
|
45431
|
+
}
|
|
45432
|
+
if (loop || currentFrame < totalFrames) {
|
|
45433
|
+
animationId = requestAnimationFrame(animate);
|
|
45434
|
+
}
|
|
45435
|
+
};
|
|
45436
|
+
animate();
|
|
45437
|
+
return {
|
|
45438
|
+
canvas,
|
|
45439
|
+
stop: () => cancelAnimationFrame(animationId)
|
|
45440
|
+
};
|
|
45441
|
+
};
|
|
45442
|
+
|
|
45443
|
+
// Load and animate thunder left
|
|
45444
|
+
if (thunderLeftRef.current) {
|
|
45445
|
+
thunderLeftRef.current.innerHTML = "";
|
|
45446
|
+
const img = new Image();
|
|
45447
|
+
img.crossOrigin = "anonymous";
|
|
45448
|
+
img.onload = () => {
|
|
45449
|
+
const {
|
|
45450
|
+
canvas
|
|
45451
|
+
} = animateThunderSprite(img, 3, 10, true, 0.25);
|
|
45452
|
+
if (canvas) {
|
|
45453
|
+
canvas.style.position = "absolute";
|
|
45454
|
+
canvas.style.left = isDesktop ? "calc(50% - 40px)" : "calc(50% + 75px)";
|
|
45455
|
+
canvas.style.top = "calc(50% + 15px)";
|
|
45456
|
+
canvas.style.transform = "translate(-50%, -50%) scale(0.3)";
|
|
45457
|
+
canvas.style.zIndex = "1";
|
|
45458
|
+
thunderLeftRef.current.appendChild(canvas);
|
|
45459
|
+
}
|
|
45460
|
+
};
|
|
45461
|
+
img.src = thunder_left$1;
|
|
45462
|
+
}
|
|
45463
|
+
|
|
45464
|
+
// Load and animate thunder right
|
|
45465
|
+
if (thunderRightRef.current) {
|
|
45466
|
+
thunderRightRef.current.innerHTML = "";
|
|
45467
|
+
const img = new Image();
|
|
45468
|
+
img.crossOrigin = "anonymous";
|
|
45469
|
+
img.onload = () => {
|
|
45470
|
+
const {
|
|
45471
|
+
canvas
|
|
45472
|
+
} = animateThunderSprite(img, 3, 10, true, 0.25);
|
|
45473
|
+
if (canvas) {
|
|
45474
|
+
canvas.style.position = "absolute";
|
|
45475
|
+
canvas.style.right = isDesktop ? "calc(50% - 40px)" : "calc(50% - 75px)";
|
|
45476
|
+
canvas.style.top = "calc(50% + 15px)";
|
|
45477
|
+
canvas.style.transform = "translate(50%, -50%) scale(0.3)";
|
|
45478
|
+
canvas.style.zIndex = "1";
|
|
45479
|
+
thunderRightRef.current.appendChild(canvas);
|
|
45480
|
+
}
|
|
45481
|
+
};
|
|
45482
|
+
img.src = thunder_right$1;
|
|
45483
|
+
}
|
|
45484
|
+
|
|
45485
|
+
// Load and animate thunder middle (top and bottom)
|
|
45486
|
+
const loadMiddleThunder = (ref, yPos) => {
|
|
45487
|
+
if (!ref.current) return;
|
|
45488
|
+
ref.current.innerHTML = "";
|
|
45489
|
+
const img = new Image();
|
|
45490
|
+
img.crossOrigin = "anonymous";
|
|
45491
|
+
img.onload = () => {
|
|
45492
|
+
const {
|
|
45493
|
+
canvas
|
|
45494
|
+
} = animateThunderSprite(img, 3, 18, false, 0.25);
|
|
45495
|
+
if (canvas) {
|
|
45496
|
+
canvas.style.position = "absolute";
|
|
45497
|
+
canvas.style.left = "50%";
|
|
45498
|
+
canvas.style.top = yPos;
|
|
45499
|
+
canvas.style.transform = "translate(-50%, -50%) scale(0.5)";
|
|
45500
|
+
canvas.style.zIndex = "1";
|
|
45501
|
+
ref.current.appendChild(canvas);
|
|
45502
|
+
}
|
|
45503
|
+
};
|
|
45504
|
+
img.src = thunder_middle$1;
|
|
45505
|
+
};
|
|
45506
|
+
loadMiddleThunder(thunderMiddleTopRef, "0");
|
|
45507
|
+
loadMiddleThunder(thunderMiddleBottomRef, "100%");
|
|
45508
|
+
|
|
45509
|
+
// Animate border on canvas - will be set up when canvas refs are available
|
|
45510
|
+
const animateBorders = () => {
|
|
45511
|
+
borderCanvasRefs.current.forEach((canvas, index) => {
|
|
45512
|
+
if (!canvas) return;
|
|
45513
|
+
const ctx = canvas.getContext("2d");
|
|
45514
|
+
const img = new Image();
|
|
45515
|
+
img.crossOrigin = "anonymous";
|
|
45516
|
+
img.onload = () => {
|
|
45517
|
+
const columns = 10;
|
|
45518
|
+
const rows = 3;
|
|
45519
|
+
const imgWidth = img.naturalWidth;
|
|
45520
|
+
const imgHeight = img.naturalHeight;
|
|
45521
|
+
const frameWidth = imgWidth / columns;
|
|
45522
|
+
const frameHeight = imgHeight / rows;
|
|
45523
|
+
let currentFrame = 0;
|
|
45524
|
+
const totalFrames = columns * rows;
|
|
45525
|
+
let frameCount = 0;
|
|
45526
|
+
const speed = 0.25;
|
|
45527
|
+
const animate = () => {
|
|
45528
|
+
const col = currentFrame % columns;
|
|
45529
|
+
const row = Math.floor(currentFrame / columns);
|
|
45530
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
45531
|
+
ctx.drawImage(img, col * frameWidth, row * frameHeight, frameWidth, frameHeight, 0, 0, canvas.width, canvas.height);
|
|
45532
|
+
frameCount++;
|
|
45533
|
+
if (frameCount >= Math.floor(60 / (speed * 60))) {
|
|
45534
|
+
currentFrame = (currentFrame + 1) % totalFrames;
|
|
45535
|
+
frameCount = 0;
|
|
45536
|
+
}
|
|
45537
|
+
requestAnimationFrame(animate);
|
|
45538
|
+
};
|
|
45539
|
+
animate();
|
|
45540
|
+
};
|
|
45541
|
+
|
|
45542
|
+
// Use border_loop for LIGHTNING status, border_start for others
|
|
45543
|
+
img.src = roundStatus === "LIGHTNING" ? border_loop$1 : border_start$1;
|
|
45544
|
+
});
|
|
45545
|
+
};
|
|
45546
|
+
|
|
45547
|
+
// Delay border animation to ensure canvas refs are set
|
|
45548
|
+
setTimeout(animateBorders, 100);
|
|
45549
|
+
}, [cards, roundStatus, isDesktop]);
|
|
45550
|
+
if (!cards || cards.length === 0) {
|
|
45551
|
+
return null;
|
|
45552
|
+
}
|
|
45553
|
+
|
|
45554
|
+
// Helper function to check if a card is a matching card
|
|
45555
|
+
const isMatchingCard = card => {
|
|
45556
|
+
if (!matchingCards || matchingCards.length === 0) return false;
|
|
45557
|
+
const cardRank = (card.rank || "").toString().toUpperCase();
|
|
45558
|
+
const cardSuit = (card.suit || "").toString().toLowerCase();
|
|
45559
|
+
return matchingCards.some(matchCard => {
|
|
45560
|
+
const matchRank = (matchCard.rank || "").toString().toUpperCase();
|
|
45561
|
+
const matchSuit = (matchCard.suit || "").toString().toLowerCase();
|
|
45562
|
+
return matchRank === cardRank && matchSuit === cardSuit;
|
|
45563
|
+
});
|
|
45564
|
+
};
|
|
45565
|
+
|
|
45566
|
+
// Calculate layout for 5 cards: 3 in first row, 2 in second row (desktop only)
|
|
45567
|
+
const shouldUseMultiRow = cardCount === 5 && isDesktop;
|
|
45568
|
+
const firstRowCards = shouldUseMultiRow ? cards.slice(0, 3) : cards;
|
|
45569
|
+
const secondRowCards = shouldUseMultiRow ? cards.slice(3) : [];
|
|
45570
|
+
|
|
45571
|
+
// Render cards in a container similar to the HTML structure
|
|
45572
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45573
|
+
ref: containerRef,
|
|
45574
|
+
style: {
|
|
45575
|
+
display: "flex",
|
|
45576
|
+
flexDirection: "column",
|
|
45577
|
+
justifyContent: "center",
|
|
45578
|
+
alignItems: "center",
|
|
45579
|
+
width: "100%",
|
|
45580
|
+
height: "100%",
|
|
45581
|
+
position: "relative",
|
|
45582
|
+
overflow: "hidden"
|
|
45583
|
+
}
|
|
45584
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45585
|
+
ref: thunderLeftRef,
|
|
45586
|
+
style: {
|
|
45587
|
+
position: "absolute",
|
|
45588
|
+
width: "100%",
|
|
45589
|
+
height: "100%",
|
|
45590
|
+
pointerEvents: "none"
|
|
45591
|
+
}
|
|
45592
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45593
|
+
ref: thunderRightRef,
|
|
45594
|
+
style: {
|
|
45595
|
+
position: "absolute",
|
|
45596
|
+
width: "100%",
|
|
45597
|
+
height: "100%",
|
|
45598
|
+
pointerEvents: "none"
|
|
45599
|
+
}
|
|
45600
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45601
|
+
ref: thunderMiddleTopRef,
|
|
45602
|
+
style: {
|
|
45603
|
+
position: "absolute",
|
|
45604
|
+
width: "100%",
|
|
45605
|
+
height: "100%",
|
|
45606
|
+
pointerEvents: "none"
|
|
45607
|
+
}
|
|
45608
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45609
|
+
ref: thunderMiddleBottomRef,
|
|
45610
|
+
style: {
|
|
45611
|
+
position: "absolute",
|
|
45612
|
+
width: "100%",
|
|
45613
|
+
height: "100%",
|
|
45614
|
+
pointerEvents: "none"
|
|
45615
|
+
}
|
|
45616
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45617
|
+
style: {
|
|
45618
|
+
display: "flex",
|
|
45619
|
+
justifyContent: "center",
|
|
45620
|
+
alignItems: "flex-start",
|
|
45621
|
+
flexWrap: "wrap",
|
|
45622
|
+
maxHeight: shouldUseMultiRow ? "48%" : "100%",
|
|
45623
|
+
overflow: "hidden",
|
|
45624
|
+
paddingTop: shouldUseMultiRow ? "2%" : "0",
|
|
45625
|
+
...(!isDesktop && {
|
|
45626
|
+
gap: "10px"
|
|
45627
|
+
})
|
|
45628
|
+
}
|
|
45629
|
+
}, firstRowCards.map((card, index) => {
|
|
45630
|
+
var _card$multiplier, _card$suit;
|
|
45631
|
+
const multiplier = (_card$multiplier = card.multiplier) !== null && _card$multiplier !== void 0 ? _card$multiplier : card.multplier;
|
|
45632
|
+
const isMatching = isMatchingCard(card);
|
|
45633
|
+
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching, !isDesktop);
|
|
45634
|
+
const cardId = `${card.rank || ""}${((_card$suit = card.suit) === null || _card$suit === void 0 || (_card$suit = _card$suit[0]) === null || _card$suit === void 0 ? void 0 : _card$suit.toUpperCase()) || ""}`;
|
|
45635
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45636
|
+
key: `card-${cardId}-${index}-${multiplier || 0}`,
|
|
45637
|
+
className: `lightningCard--9ec39 ${deviceClass} ${getCardCountClass()}`,
|
|
45638
|
+
"data-role": `card-${cardId}-multiplier-${multiplier || 0}-lightning-${roundStatus === "LIGHTNING"}`
|
|
45639
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45640
|
+
className: "container--5cb15 noAnimation--94619",
|
|
45641
|
+
style: {
|
|
45642
|
+
animationDelay: "0ms",
|
|
45643
|
+
animationDuration: "0ms"
|
|
45644
|
+
}
|
|
45645
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45646
|
+
className: "shell--013b5",
|
|
45647
|
+
style: {
|
|
45648
|
+
backgroundImage: `url("${shellBackgroundSVG}")`
|
|
45649
|
+
}
|
|
45650
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45651
|
+
className: "elements--d38d6"
|
|
45652
|
+
}, multiplier !== null && multiplier !== undefined && /*#__PURE__*/React.createElement("div", {
|
|
45653
|
+
className: "multiplier--22733",
|
|
45654
|
+
style: {
|
|
45655
|
+
fontSize: "18px"
|
|
45656
|
+
}
|
|
45657
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45658
|
+
className: "multiplier--fe086"
|
|
45659
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45660
|
+
className: "textContainer--1a1ac",
|
|
45661
|
+
style: {
|
|
45662
|
+
justifyContent: "center"
|
|
45663
|
+
}
|
|
45664
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45665
|
+
className: "text--68a0b placeholder--6cec6"
|
|
45666
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45667
|
+
className: "text--68a0b base--b286e",
|
|
45668
|
+
"data-role": "multiplierBase"
|
|
45669
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45670
|
+
className: "text--68a0b shadow--551ae"
|
|
45671
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45672
|
+
className: "text--68a0b textBackground--cded2 lightning--2aac5"
|
|
45673
|
+
}, multiplier, "x")))), /*#__PURE__*/React.createElement("div", {
|
|
45674
|
+
className: "cardContainer--68186"
|
|
45675
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45676
|
+
className: "card--88842"
|
|
45677
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45678
|
+
className: "wrapper--9fd49",
|
|
45679
|
+
"data-role": `card-${cardId}`,
|
|
45680
|
+
style: isMatching ? {
|
|
45681
|
+
zIndex: 100,
|
|
45682
|
+
position: "relative"
|
|
45683
|
+
} : {}
|
|
45684
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45685
|
+
className: "suit--2017b active--9b94f",
|
|
45686
|
+
dangerouslySetInnerHTML: {
|
|
45687
|
+
__html: cardSvg
|
|
45688
|
+
}
|
|
45689
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
45690
|
+
className: "cardBorder--a2a73",
|
|
45691
|
+
style: isMatching ? {
|
|
45692
|
+
backgroundColor: "#ffffff"
|
|
45693
|
+
} : {}
|
|
45694
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
45695
|
+
className: "lightningBorder--21495"
|
|
45696
|
+
}, /*#__PURE__*/React.createElement("canvas", {
|
|
45697
|
+
ref: el => {
|
|
45698
|
+
if (el && !borderCanvasRefs.current[index]) {
|
|
45699
|
+
borderCanvasRefs.current[index] = el;
|
|
45700
|
+
}
|
|
45701
|
+
},
|
|
45702
|
+
width: "194",
|
|
45703
|
+
height: "276",
|
|
45704
|
+
"data-role": `sprite-effect-lightningCardBorder-${index}`,
|
|
45705
|
+
style: {
|
|
45706
|
+
width: "100%",
|
|
45707
|
+
height: "100%"
|
|
45708
|
+
}
|
|
45709
|
+
}))));
|
|
45710
|
+
})), shouldUseMultiRow && secondRowCards.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
45711
|
+
style: {
|
|
45712
|
+
display: "flex",
|
|
45713
|
+
justifyContent: "center",
|
|
45714
|
+
alignItems: "flex-start",
|
|
45715
|
+
marginTop: "5px",
|
|
45716
|
+
maxHeight: "48%",
|
|
45717
|
+
overflow: "hidden",
|
|
45718
|
+
paddingTop: "1%",
|
|
45719
|
+
...(!isDesktop && {
|
|
45720
|
+
gap: "10px"
|
|
45721
|
+
})
|
|
45722
|
+
}
|
|
45723
|
+
}, secondRowCards.map((card, index) => {
|
|
45724
|
+
var _card$multiplier2, _card$suit2;
|
|
45725
|
+
const multiplier = (_card$multiplier2 = card.multiplier) !== null && _card$multiplier2 !== void 0 ? _card$multiplier2 : card.multplier;
|
|
45726
|
+
const isMatching = isMatchingCard(card);
|
|
45727
|
+
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching, !isDesktop);
|
|
45728
|
+
const cardId = `${card.rank || ""}${((_card$suit2 = card.suit) === null || _card$suit2 === void 0 || (_card$suit2 = _card$suit2[0]) === null || _card$suit2 === void 0 ? void 0 : _card$suit2.toUpperCase()) || ""}`;
|
|
45729
|
+
const actualIndex = index + 3; // Continue index from first row
|
|
45730
|
+
|
|
45731
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45732
|
+
key: `card-${cardId}-${actualIndex}-${multiplier || 0}`,
|
|
45733
|
+
className: `lightningCard--9ec39 ${deviceClass} ${getCardCountClass()}`,
|
|
45734
|
+
"data-role": `card-${cardId}-multiplier-${multiplier || 0}-lightning-${roundStatus === "LIGHTNING"}`
|
|
45735
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45736
|
+
className: "container--5cb15 noAnimation--94619",
|
|
45737
|
+
style: {
|
|
45738
|
+
animationDelay: "0ms",
|
|
45739
|
+
animationDuration: "0ms"
|
|
45740
|
+
}
|
|
45741
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45742
|
+
className: "shell--013b5",
|
|
45743
|
+
style: {
|
|
45744
|
+
backgroundImage: `url("${shellBackgroundSVG}")`
|
|
45745
|
+
}
|
|
45746
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
45747
|
+
className: "elements--d38d6"
|
|
45748
|
+
}, multiplier !== null && multiplier !== undefined && /*#__PURE__*/React.createElement("div", {
|
|
45749
|
+
className: "multiplier--22733",
|
|
45750
|
+
style: {
|
|
45751
|
+
fontSize: "18px"
|
|
45752
|
+
}
|
|
45753
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45754
|
+
className: "multiplier--fe086"
|
|
45755
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45756
|
+
className: "textContainer--1a1ac",
|
|
45757
|
+
style: {
|
|
45758
|
+
justifyContent: "center"
|
|
45759
|
+
}
|
|
45760
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45761
|
+
className: "text--68a0b placeholder--6cec6"
|
|
45762
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45763
|
+
className: "text--68a0b base--b286e",
|
|
45764
|
+
"data-role": "multiplierBase"
|
|
45765
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45766
|
+
className: "text--68a0b shadow--551ae"
|
|
45767
|
+
}, multiplier, "x"), /*#__PURE__*/React.createElement("span", {
|
|
45768
|
+
className: "text--68a0b textBackground--cded2 lightning--2aac5"
|
|
45769
|
+
}, multiplier, "x")))), /*#__PURE__*/React.createElement("div", {
|
|
45770
|
+
className: "cardContainer--68186"
|
|
45771
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45772
|
+
className: "card--88842"
|
|
45773
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45774
|
+
className: "wrapper--9fd49",
|
|
45775
|
+
"data-role": `card-${cardId}`
|
|
45776
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
45777
|
+
className: "suit--2017b active--9b94f",
|
|
45778
|
+
dangerouslySetInnerHTML: {
|
|
45779
|
+
__html: cardSvg
|
|
45780
|
+
}
|
|
45781
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
45782
|
+
className: "cardBorder--a2a73"
|
|
45783
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
45784
|
+
className: "lightningBorder--21495"
|
|
45785
|
+
}, /*#__PURE__*/React.createElement("canvas", {
|
|
45786
|
+
ref: el => {
|
|
45787
|
+
if (el && !borderCanvasRefs.current[actualIndex]) {
|
|
45788
|
+
borderCanvasRefs.current[actualIndex] = el;
|
|
45789
|
+
}
|
|
45790
|
+
},
|
|
45791
|
+
width: "194",
|
|
45792
|
+
height: "276",
|
|
45793
|
+
"data-role": `sprite-effect-lightningCardBorder-${actualIndex}`,
|
|
45794
|
+
style: {
|
|
45795
|
+
width: "100%",
|
|
45796
|
+
height: "100%"
|
|
45797
|
+
}
|
|
45798
|
+
}))));
|
|
45799
|
+
})));
|
|
45800
|
+
};
|
|
45801
|
+
LightningCardHTML.propTypes = {
|
|
45802
|
+
cards: PropTypes.arrayOf(PropTypes.shape({
|
|
45803
|
+
multiplier: PropTypes.number,
|
|
45804
|
+
rank: PropTypes.string,
|
|
45805
|
+
suit: PropTypes.string
|
|
45806
|
+
})),
|
|
45807
|
+
roundStatus: PropTypes.string,
|
|
45808
|
+
showRank: PropTypes.bool,
|
|
45809
|
+
gameType: PropTypes.string,
|
|
45810
|
+
matchingCards: PropTypes.arrayOf(PropTypes.shape({
|
|
45811
|
+
rank: PropTypes.string,
|
|
45812
|
+
suit: PropTypes.string
|
|
45813
|
+
}))
|
|
45814
|
+
};
|
|
45815
|
+
LightningCardHTML.defaultProps = {
|
|
45816
|
+
cards: [],
|
|
45817
|
+
showRank: false
|
|
45818
|
+
};
|
|
45819
|
+
|
|
45194
45820
|
// CSS is provided separately via the style field in package.json
|
|
45195
45821
|
|
|
45196
45822
|
const thunder_left = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.f9848fb7.webp";
|
|
@@ -45202,7 +45828,8 @@ const LighteningCard = ({
|
|
|
45202
45828
|
roundStatus,
|
|
45203
45829
|
cards,
|
|
45204
45830
|
showRank = false,
|
|
45205
|
-
gameType
|
|
45831
|
+
gameType,
|
|
45832
|
+
matchingCards
|
|
45206
45833
|
}) => {
|
|
45207
45834
|
const containerRef = React.useRef(null);
|
|
45208
45835
|
const appRef = React.useRef(null);
|
|
@@ -45243,42 +45870,89 @@ const LighteningCard = ({
|
|
|
45243
45870
|
["NO_MORE_BETS", "LIGHTNING", "NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new MiddleThunder(thunder_middle, appRef);
|
|
45244
45871
|
|
|
45245
45872
|
// Debug logging
|
|
45246
|
-
console.log("LighteningCard render:", {
|
|
45247
|
-
|
|
45248
|
-
|
|
45249
|
-
|
|
45250
|
-
|
|
45251
|
-
|
|
45252
|
-
});
|
|
45873
|
+
// console.log("LighteningCard render:", {
|
|
45874
|
+
// roundStatus,
|
|
45875
|
+
// showRank,
|
|
45876
|
+
// gameType,
|
|
45877
|
+
// cardsCount: cards?.length || 0,
|
|
45878
|
+
// cards: cards,
|
|
45879
|
+
// });
|
|
45253
45880
|
|
|
45254
45881
|
// Check if this is baccarat game - use SVG cards
|
|
45255
45882
|
// Use baccarat SVG cards when gameType is baccarat OR when showRank is true (baccarat-style display)
|
|
45256
45883
|
const isBaccarat = (gameType === null || gameType === void 0 ? void 0 : gameType.toLowerCase()) === "baccarat" || showRank === true;
|
|
45257
45884
|
if (isBaccarat) {
|
|
45258
45885
|
// Use baccarat SVG cards (no PNGs, uses SVG suit symbols)
|
|
45259
|
-
["LIGHTNING"].includes(roundStatus) && new BaccaratCardStart(cards,
|
|
45260
|
-
["NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new BaccaratCard(cards,
|
|
45886
|
+
["LIGHTNING"].includes(roundStatus) && new BaccaratCardStart(cards, border_start, appRef);
|
|
45887
|
+
["NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new BaccaratCard(cards, border_loop, appRef);
|
|
45261
45888
|
} else {
|
|
45262
45889
|
// Use suit-only display (with PNG suit images)
|
|
45263
|
-
["LIGHTNING"].includes(roundStatus) && new LighteningStart(cards,
|
|
45264
|
-
["NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new Lightening(cards,
|
|
45890
|
+
["LIGHTNING"].includes(roundStatus) && new LighteningStart(cards, border_start, appRef);
|
|
45891
|
+
["NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new Lightening(cards, border_loop, appRef);
|
|
45265
45892
|
}
|
|
45266
45893
|
};
|
|
45267
45894
|
React.useEffect(() => {
|
|
45895
|
+
// Check if this is baccarat game - use HTML/CSS cards (don't create Pixi.js app)
|
|
45896
|
+
const isBaccarat = (gameType === null || gameType === void 0 ? void 0 : gameType.toLowerCase()) === "baccarat" || showRank === true;
|
|
45897
|
+
|
|
45898
|
+
// Only create Pixi.js application if NOT using HTML/CSS cards
|
|
45899
|
+
if (isBaccarat && (roundStatus === "LIGHTNING" || roundStatus === "NEW_CARD" || roundStatus === "ROUND_END" || roundStatus === "BETTING_STARTED")) {
|
|
45900
|
+
// Using HTML/CSS cards, skip Pixi.js initialization
|
|
45901
|
+
return;
|
|
45902
|
+
}
|
|
45268
45903
|
if (!containerRef.current) return;
|
|
45904
|
+
|
|
45905
|
+
// Clean up existing app before creating new one
|
|
45906
|
+
if (appRef.current) {
|
|
45907
|
+
try {
|
|
45908
|
+
if (appRef.current.renderer && typeof appRef.current.destroy === "function") {
|
|
45909
|
+
appRef.current.destroy(true);
|
|
45910
|
+
}
|
|
45911
|
+
appRef.current = null;
|
|
45912
|
+
} catch (error) {
|
|
45913
|
+
console.warn("Error destroying Pixi.js app:", error);
|
|
45914
|
+
}
|
|
45915
|
+
}
|
|
45269
45916
|
initiatePixiApplication();
|
|
45917
|
+
|
|
45270
45918
|
// Cleanup function
|
|
45271
45919
|
return () => {
|
|
45272
|
-
|
|
45273
|
-
|
|
45274
|
-
|
|
45920
|
+
const app = appRef.current;
|
|
45921
|
+
if (!app) return;
|
|
45922
|
+
try {
|
|
45923
|
+
// Remove canvas from DOM first
|
|
45924
|
+
if (app.canvas && containerRef.current && containerRef.current.contains(app.canvas)) {
|
|
45925
|
+
containerRef.current.removeChild(app.canvas);
|
|
45926
|
+
}
|
|
45927
|
+
if (app.renderer && typeof app.destroy === "function") {
|
|
45928
|
+
app.destroy(true);
|
|
45929
|
+
}
|
|
45930
|
+
} catch (error) {
|
|
45931
|
+
console.warn("Error in cleanup:", error);
|
|
45932
|
+
} finally {
|
|
45275
45933
|
appRef.current = null;
|
|
45276
45934
|
}
|
|
45277
45935
|
};
|
|
45278
|
-
}, [roundStatus, showRank,
|
|
45936
|
+
}, [roundStatus, showRank, gameType, cards]);
|
|
45279
45937
|
|
|
45280
45938
|
// Add class for 5-card layout to apply min-height
|
|
45281
45939
|
const containerClass = (cards === null || cards === void 0 ? void 0 : cards.length) === 5 ? "lightening-card five-cards" : "lightening-card";
|
|
45940
|
+
|
|
45941
|
+
// Check if this is baccarat game - use HTML/CSS cards
|
|
45942
|
+
const isBaccarat = (gameType === null || gameType === void 0 ? void 0 : gameType.toLowerCase()) === "baccarat" || showRank === true;
|
|
45943
|
+
|
|
45944
|
+
// Use HTML/CSS component for baccarat cards to match the provided HTML structure
|
|
45945
|
+
if (isBaccarat && (roundStatus === "LIGHTNING" || roundStatus === "NEW_CARD" || roundStatus === "ROUND_END" || roundStatus === "BETTING_STARTED")) {
|
|
45946
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45947
|
+
className: containerClass
|
|
45948
|
+
}, /*#__PURE__*/React.createElement(LightningCardHTML, {
|
|
45949
|
+
cards: cards,
|
|
45950
|
+
roundStatus: roundStatus,
|
|
45951
|
+
showRank: showRank,
|
|
45952
|
+
gameType: gameType,
|
|
45953
|
+
matchingCards: matchingCards
|
|
45954
|
+
}));
|
|
45955
|
+
}
|
|
45282
45956
|
return /*#__PURE__*/React.createElement("div", {
|
|
45283
45957
|
className: containerClass,
|
|
45284
45958
|
ref: containerRef
|
|
@@ -45295,6 +45969,11 @@ LighteningCard.propTypes = {
|
|
|
45295
45969
|
// If true, displays rank at center and suit at top-left. If false, displays suit only.
|
|
45296
45970
|
gameType: PropTypes.string,
|
|
45297
45971
|
// Game type (e.g., "baccarat") - if "baccarat", uses SVG cards
|
|
45972
|
+
matchingCards: PropTypes.arrayOf(PropTypes.shape({
|
|
45973
|
+
rank: PropTypes.string,
|
|
45974
|
+
suit: PropTypes.string
|
|
45975
|
+
})),
|
|
45976
|
+
// Array of matching cards to highlight with different colors
|
|
45298
45977
|
assetPath: PropTypes.string,
|
|
45299
45978
|
// Path to the animation asset
|
|
45300
45979
|
onAnimationReady: PropTypes.func // Callback when animation is ready
|