From dcd0f7a030cd3ba639ed4895221595ce4265b471 Mon Sep 17 00:00:00 2001 From: cpojer Date: Tue, 3 Dec 2024 09:04:23 +0900 Subject: [PATCH] Allow for secondary action styles to be shown on top of units. GitOrigin-RevId: 380aea763c54a8d4a470b1c01c3ba698a15713f8 --- hera/Unit.tsx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/hera/Unit.tsx b/hera/Unit.tsx index 7f1c9c62..a57130f7 100644 --- a/hera/Unit.tsx +++ b/hera/Unit.tsx @@ -109,11 +109,13 @@ const getAmmoStyle = (unit: Unit) => { const Action = ({ actionStyle, hide, + position, rescuer, unit, }: { actionStyle: ActionStyle | null; hide: boolean; + position?: 'secondary'; rescuer: PlayerID | null; unit: Unit; }) => { @@ -134,6 +136,7 @@ const Action = ({ absoluteStyle, baseIconStyle, statusStyle, + position === 'secondary' ? secondaryStyle : null, className, hide && hideStyle, )} @@ -160,6 +163,7 @@ const Status = ({ fuelStyle, hide, rescuer, + secondaryActionStyle, unit, }: { actionStyle: ActionStyle | null; @@ -167,9 +171,12 @@ const Status = ({ fuelStyle: FuelStyle | null; hide: boolean; rescuer: PlayerID | null; + secondaryActionStyle: ActionStyle | null; unit: Unit; }) => { const hasOne = !!(fuelStyle || ammoStyle); + const hasSecondaryAction = + secondaryActionStyle && secondaryActionStyle !== actionStyle; return ( <> + {hasSecondaryAction && ( + + )} {unit.health ? (