diff --git a/WORKLOG.md b/WORKLOG.md index e61cdcd9..2f72978e 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -3,13 +3,9 @@ *PRODUCTION* -* rename vbox to shop (just for display) -* give the shop and inventory distinct delineation -* proper victory / lose page instead of just face off (you are the winner or something) +* give the vbox and inventory distinct delineation * vbox phase skill list navigator (overlay maybe?) -* clear active mtx after joining game - * mobile styles * mobile info page diff --git a/client/assets/styles/instance.less b/client/assets/styles/instance.less index 05952fc7..60ba9412 100644 --- a/client/assets/styles/instance.less +++ b/client/assets/styles/instance.less @@ -413,9 +413,10 @@ text-align: center; overflow: hidden; display: grid; - grid-template-rows: 1fr 1.5fr; + grid-template-rows: 1fr 0.25fr 1.5fr; grid-template-areas: "opponent" + "text" "player"; h1 { @@ -445,6 +446,13 @@ } } +.faceoff-text { + grid-area: text; + text-align: center; + align-self: center; + height: auto; +} + /* Mobile Nav*/ .instance-nav { display: none; } diff --git a/client/src/components/faceoff.jsx b/client/src/components/faceoff.jsx index 68de5481..41a95e86 100644 --- a/client/src/components/faceoff.jsx +++ b/client/src/components/faceoff.jsx @@ -66,6 +66,7 @@ function Faceoff(props) { ); } + function OpponentTeam(team) { const constructs = team.constructs.map((c, i) => ); @@ -78,10 +79,44 @@ function Faceoff(props) { ); } + function faceoffText() { + if (!instance.winner) { + const zero = Date.parse(instance.phase_start); + const now = Date.now(); + const end = Date.parse(instance.phase_end); + const timerPct = instance.phase_end + ? ((now - zero) / (end - zero) * 100) + : 100; + const fight = timerPct > 10 ?

FIGHT

: null; + return ( +
+

{otherTeam.name}

+

vs

+

{playerTeam.name}

+ {fight} +
+ ); + } + + if (instance.winner === playerTeam.id) { + return ( +
+

You are the champion

+
+ ) + } + + return ( +
+

You lose

+
+ ) + } return (
{OpponentTeam(otherTeam)} + {faceoffText()} {PlayerTeam(playerTeam)}
);