diff --git a/src/pages/webapp/Dashboard.tsx b/src/pages/webapp/Dashboard.tsx
index daeb3cc..d38fa43 100644
--- a/src/pages/webapp/Dashboard.tsx
+++ b/src/pages/webapp/Dashboard.tsx
@@ -36,7 +36,7 @@ import {DecisionHttpService} from "@/services/decision-http-service.ts";
import {UsersHttpService} from "@/services/users-http-service.ts";
import {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from "@/components/ui/tooltip.tsx";
import {Badge} from "@/components/ui/badge.tsx";
-import {Card, CardDescription, CardHeader, CardTitle} from "@/components/ui/card.tsx";
+import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "@/components/ui/card.tsx";
import {NewsItem} from "@/model/NewsItem.ts";
import {Alert} from "@/model/Alert.ts";
import {NewsHttpService} from "@/services/news-http-service.ts";
@@ -75,6 +75,7 @@ function Summary() {
const alerts = await alertsHttpService.getAlerts();
setAlerts(alerts);
}
+
fetchInitialData().then();
}, []);
@@ -97,7 +98,8 @@ function Summary() {
return (
-
navigate("/news")} className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}>
+ navigate("/news")}
+ className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}>
@@ -109,10 +111,11 @@ function Summary() {
- navigate("/alerts")} className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}>
+ navigate("/alerts")}
+ className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}>
-
+
Title
@@ -187,6 +190,7 @@ function Portfolio() {
const holdings = await portfolioHttpService.getPortfolioHoldings();
setHoldings(holdings);
}
+
fetchInitialData().then();
}, []);
@@ -211,91 +215,103 @@ function Portfolio() {
}));
setAssetHoldings(assets);
}
+
fetchInitialData().then();
}, [holdings]);
return (
-
-
-
-
-
- Ticker
- Shares
- Value per share
- Total value
- Last decision
- Change (%)
-
-
-
-
- {assetHoldings.map(holding => {
- const difference = percentageChange(holding.valueShare, holding.buyPrice);
- return (
-
-
- {holding.mic}
- {holding.ticker}
-
- {holding.shares}
- {toUSD(holding.valueShare)}
- {toUSD(holding.valueShare * holding.shares)}
-
-
-
-
-
- {holding.lastDecision}
-
-
-
- {holding.lastDecisionDate.toLocaleString('en-US', {
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- hour: 'numeric',
- minute: '2-digit',
- second: '2-digit',
- hour12: true,
- })}
-
-
-
-
- {difference}
-
-
-
-
-
+ <>
+
+
+
+
+
+ Ticker
+ Shares
+ Value per share
+ Total value
+ Last decision
+ Change (%)
+
- )
- })}
-
-
-
- Total
- {
- toUSD(assetHoldings
- .map(holding => holding.shares * holding.valueShare)
- .reduce((previous, current) => previous + current, 0))
- }
-
-
-
-
-
+
+
+ {assetHoldings.map(holding => {
+ const difference = percentageChange(holding.valueShare, holding.buyPrice);
+ return (
+
+
+ {holding.mic}
+ {holding.ticker}
+
+ {holding.shares}
+ {toUSD(holding.valueShare)}
+ {toUSD(holding.valueShare * holding.shares)}
+
+
+
+
+
+ {holding.lastDecision}
+
+
+
+ {holding.lastDecisionDate.toLocaleString('en-US', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ hour: 'numeric',
+ minute: '2-digit',
+ second: '2-digit',
+ hour12: true,
+ })}
+
+
+
+
+ {difference}
+
+
+
+
+
+
+ )
+ })}
+
+
+
+ Total
+ {
+ toUSD(assetHoldings
+ .map(holding => holding.shares * holding.valueShare)
+ .reduce((previous, current) => previous + current, 0))
+ }
+
+
+
+
+
+
+
+
+ Add new asset to portfolio
+
+
+
+
+
+ >
)
}
@@ -323,7 +339,7 @@ function HoldingCreator({onSubmit}: {
}, []);
return (
-
+
- {asset ?
-
- : ""}
+ {asset &&
+
+ }
+ {!asset &&
}
)
}
diff --git a/src/pages/webapp/Profile.tsx b/src/pages/webapp/Profile.tsx
index 6a2682d..3bb6eb6 100644
--- a/src/pages/webapp/Profile.tsx
+++ b/src/pages/webapp/Profile.tsx
@@ -23,10 +23,10 @@ export default function Profile() {
@@ -37,9 +37,9 @@ export default function Profile() {
variant="outline" value={user.riskLevel.toString()}
onValueChange={newValue => {
if (newValue) {
- setUser(user => ({...user, riskLevel: parseInt(newValue)} as User))}
- }
- }
+ setUser(user => ({...user, riskLevel: parseInt(newValue)} as User))
+ }
+ }}
>
{/* TODO: Fetch risk levels from back */}
{[1, 2, 3, 4].map((riskLevelItem, index) => (
@@ -53,10 +53,10 @@ export default function Profile() {
))}
- { user.riskLevel === 1 && "Conservative" }
- { user.riskLevel === 2 && "Moderate" }
- { user.riskLevel === 3 && "Aggressive" }
- { user.riskLevel === 4 && "Very aggressive" }
+ {user.riskLevel === 1 && "Conservative"}
+ {user.riskLevel === 2 && "Moderate"}
+ {user.riskLevel === 3 && "Aggressive"}
+ {user.riskLevel === 4 && "Very aggressive"}
diff --git a/src/pages/webapp/Simulation.tsx b/src/pages/webapp/Simulation.tsx
index 682bd58..0732dd1 100644
--- a/src/pages/webapp/Simulation.tsx
+++ b/src/pages/webapp/Simulation.tsx
@@ -57,12 +57,14 @@ function Simulation() {
const [simulationConfig, setSimulationConfig] = useState
();
return (
- <>
-
+
)
}
@@ -89,70 +91,80 @@ function SimulationConfig({setSimulationConfig}: {
}
return (
- <>
-
-
Time period
-
-
-
-
Risk profile
- setRiskLevel(parseInt(newValue))}
- >
- {/* TODO: Fetch risk levels from back */}
- {[1, 2, 3, 4].map((riskLevelItem, index) => (
-
- {riskLevelItem}
-
- ))}
-
-
-
-
Assets selection
-
-
-
-
-
-
-
Current portfolio
-
All assets in your current portfolio
-
-
-
event ? addPortfolioHoldings() : removePortfolioHoldings()}/>
+
+
+
+
+
Risk profile
+
{
+ if (newValue) setRiskLevel(parseInt(newValue))
+ }}
+ >
+ {/* TODO: Fetch risk levels from back */}
+ {[1, 2, 3, 4].map((riskLevelItem, index) => (
+
+ {riskLevelItem}
+
+ ))}
+
+
+ {riskLevel === 1 && "Conservative"}
+ {riskLevel === 2 && "Moderate"}
+ {riskLevel === 3 && "Aggressive"}
+ {riskLevel === 4 && "Very aggressive"}
+
+
+
+
Assets selection
+
+
+
+
+
+
+
Current portfolio
+
All assets in your current portfolio
+
+
+ event ? addPortfolioHoldings() : removePortfolioHoldings()}/>
+
+
+
+ {simulationItems.length > 0 && (
+
+ {simulationItems.length} assets selected
+
+ )}
+
-
-
- {simulationItems.length > 0 && (
-
- {simulationItems.length} assets selected
-
- )}
-
- >
+
)
}
@@ -280,8 +292,8 @@ function SimulationResults({simulationConfig}: {
return (
<>
- {isLoading && }
- {simulationConfig &&
+ {isLoading &&
}
+ {simulationConfig &&
{
@@ -346,7 +358,7 @@ function DataChart
}, [data, selectedData, filterBy]);
return (
-
+
Simulation result