@four-leaf-studios/rl-overlay 1.0.4 → 1.0.5
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 +10 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/TargetPlayer.tsx +14 -3
package/package.json
CHANGED
package/src/TargetPlayer.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// src/components/TargetPlayer.tsx
|
|
2
|
+
|
|
1
3
|
import { AnimatePresence, motion } from "framer-motion";
|
|
2
4
|
import React, { memo } from "react";
|
|
3
5
|
import { useBroadcast } from "./context/BroadcastContext";
|
|
@@ -9,9 +11,18 @@ export const TargetPlayer = () => {
|
|
|
9
11
|
const broadcast = useBroadcast();
|
|
10
12
|
const targetPlayer = useTargetPlayer();
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
// Safeguard conditions
|
|
15
|
+
if (
|
|
16
|
+
!targetPlayer ||
|
|
17
|
+
!broadcast ||
|
|
18
|
+
!broadcast.teams ||
|
|
19
|
+
!broadcast.teams[targetPlayer.team]
|
|
20
|
+
) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
13
23
|
|
|
14
|
-
const
|
|
24
|
+
const teamData = broadcast.teams[targetPlayer.team];
|
|
25
|
+
const teamColor = teamData?.color?.primary_color ?? "#ffffff";
|
|
15
26
|
const modifier = targetPlayer.team === 0 ? "left" : "right";
|
|
16
27
|
|
|
17
28
|
return (
|
|
@@ -23,7 +34,7 @@ export const TargetPlayer = () => {
|
|
|
23
34
|
initial={{ x: modifier === "left" ? -300 : 300, opacity: 0 }}
|
|
24
35
|
animate={{ x: 0, opacity: 1 }}
|
|
25
36
|
exit={{ x: modifier === "left" ? -300 : 300, opacity: 0 }}
|
|
26
|
-
transition={{ duration: 0.8, ease: [0.77, 0, 0.175, 1] }}
|
|
37
|
+
transition={{ duration: 0.8, ease: [0.77, 0, 0.175, 1] }}
|
|
27
38
|
>
|
|
28
39
|
<motion.div
|
|
29
40
|
className={`stat_box_player ${modifier}_stat_box_player`}
|