@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@four-leaf-studios/rl-overlay",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -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
- if (!targetPlayer || !broadcast) return null;
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 teamColor = broadcast.teams[targetPlayer.team].color?.primary_color;
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] }} // Quartic easing equivalent
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`}