diff --git a/src/components/WinnerStat.js b/src/components/WinnerStat.js index e5152b1..25be180 100644 --- a/src/components/WinnerStat.js +++ b/src/components/WinnerStat.js @@ -1,8 +1,11 @@ import React, { useState, useEffect } from 'react' import Address from '../components/OrchAddressViewer'; +import { Popover } from '@mantine/core'; +import ScoreView from './scoreViewer'; const Winner = (obj) => { const [thisScore, setThisScore] = useState(0); + const [opened, setOpened] = useState(false); useEffect(() => { // Get score of this Orch @@ -22,14 +25,26 @@ const Winner = (obj) => { let scoreObj = null; if (thisScore) { - scoreObj =
-
-

Global Score

-
-
- {(thisScore * 10).toFixed(1)} -
-
+ scoreObj = + setOpened(false)} + target={ +
setOpened((o) => !o)} > +
+

Global Score

+
+
+ {(thisScore * 10).toFixed(1)} +
+
+ } + width={260} + position="bottom" + withArrow + > + +
} return ( diff --git a/src/components/scoreViewer.js b/src/components/scoreViewer.js new file mode 100644 index 0000000..9522dd4 --- /dev/null +++ b/src/components/scoreViewer.js @@ -0,0 +1,116 @@ +import React from "react"; + +const ScoreView = (obj) => { + + console.log(obj.score); + return ( +
+
+
+

x

+
+
+

FRA

+
+
+

LAX

+
+
+

LON

+
+
+

MDW

+
+
+

NYC

+
+
+

PRG

+
+
+

SIN

+
+
+
+
+

Success

+
+
+ {(obj.score["FRA"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["LAX"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["LON"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["MDW"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["NYC"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["PRG"].success_rate * 10).toFixed(1)} +
+
+ {(obj.score["SIN"].success_rate * 10).toFixed(1)} +
+
+
+
+

Speed

+
+
+ {(obj.score["FRA"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["LAX"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["LON"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["MDW"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["NYC"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["PRG"].round_trip_score * 10).toFixed(1)} +
+
+ {(obj.score["SIN"].round_trip_score * 10).toFixed(1)} +
+
+
+
+

Score

+
+
+ {(obj.score["FRA"].score * 10).toFixed(1)} +
+
+ {(obj.score["LAX"].score * 10).toFixed(1)} +
+
+ {(obj.score["LON"].score * 10).toFixed(1)} +
+
+ {(obj.score["MDW"].score * 10).toFixed(1)} +
+
+ {(obj.score["NYC"].score * 10).toFixed(1)} +
+
+ {(obj.score["PRG"].score * 10).toFixed(1)} +
+
+ {(obj.score["SIN"].score * 10).toFixed(1)} +
+
+
+ ) +} + +export default ScoreView; \ No newline at end of file