import React from "react"; import { ActionButton, Depths, FontSizes, FontWeights, ITheme, MotionAnimations, PrimaryButton, Stack, Text } from "@fluentui/react"; import { Bar, BarChart, ResponsiveContainer, XAxis, YAxis } from "recharts"; import { GetCurrentTheme } from "../Services/ThemeService"; import { Strings } from "../Services/LocalizationService"; interface IResultRecord { Name : string; Value : number; } export default class Result extends React.Component<{ records : number[] }> { public render() : JSX.Element { let theme : ITheme = GetCurrentTheme(); let data : IResultRecord[] = this.props.records.map((value, index) => ({ Name: `${Strings.scenario} ${index + 1}`, Value: Number.parseFloat(value.toFixed(2)) })); return ( { Strings.resultsTitle } { Strings.resultsHeader } { Strings.resultsSubheader } { Strings.resultsUserHeader } { Strings.resultsDevHeader } window.location.reload() } /> { Strings.results } { data[0].Value > data[1].Value ? { Strings.resultsUserHeader2 } { Strings.userResultP1 } { Math.round(100 - data[1].Value / data[0].Value * 100) }% { Strings.userResultP2 } { Strings.userResultP3 } : <> { Strings.userResultAlt1 } { Strings.userResultAlt2 } } { data[0].Value > data[2].Value && { Strings.resultsDevHeader2 } { Strings.devResultP1 } { Math.round(100 - data[2].Value / data[0].Value * 100) }% { Strings.devResultP2 } { Strings.devResultP3 } } ); } }