|
|
|
@ -5,8 +5,12 @@ import Block from "components/services/widget/block";
|
|
|
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
|
|
|
|
|
|
|
|
function getPerformancePercent(t, performanceRange) {
|
|
|
|
|
return `${performanceRange.performance.currentGrossPerformancePercent > 0 ? "+" : ""}${t("common.percent", {
|
|
|
|
|
value: performanceRange.performance.currentGrossPerformancePercent * 100,
|
|
|
|
|
// ghostfolio v2.79.0 changed to grossPerformancePercentage
|
|
|
|
|
const percent =
|
|
|
|
|
performanceRange.performance.grossPerformancePercentage ??
|
|
|
|
|
performanceRange.performance.currentGrossPerformancePercent;
|
|
|
|
|
return `${percent > 0 ? "+" : ""}${t("common.percent", {
|
|
|
|
|
value: percent * 100,
|
|
|
|
|
maximumFractionDigits: 2,
|
|
|
|
|
})}`;
|
|
|
|
|
}
|
|
|
|
@ -24,6 +28,10 @@ export default function Component({ service }) {
|
|
|
|
|
return <Container service={service} error={finalError} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (performanceToday?.statusCode === 401) {
|
|
|
|
|
return <Container service={service} error={performanceToday} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!performanceToday || !performanceYear || !performanceMax) {
|
|
|
|
|
return (
|
|
|
|
|
<Container service={service}>
|
|
|
|
|