diff --git a/.github/labeler.yml b/.github/labeler.yml index 836631f4..45236aa3 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -15,3 +15,6 @@ "repl": - "repl/**/*" + +"ui": + - "ui/**/*" diff --git a/repl/commands/portfolio.go b/repl/commands/portfolio.go index c0d8adab..64e6b902 100644 --- a/repl/commands/portfolio.go +++ b/repl/commands/portfolio.go @@ -26,9 +26,9 @@ import ( portfoliov1 "github.com/oxisto/money-gopher/gen" "github.com/oxisto/money-gopher/gen/portfoliov1connect" "github.com/oxisto/money-gopher/repl" - "google.golang.org/protobuf/types/known/timestamppb" "github.com/bufbuild/connect-go" + "google.golang.org/protobuf/types/known/timestamppb" ) type portfolioSnapshot struct{} diff --git a/service/portfolio/snapshot.go b/service/portfolio/snapshot.go index 0118f7ce..604d319c 100644 --- a/service/portfolio/snapshot.go +++ b/service/portfolio/snapshot.go @@ -119,6 +119,7 @@ func marketPrice(secmap map[string]*portfoliov1.Security, name string, netPrice } } +// TODO(oxisto): remove once maps.Keys is in the stdlib in Go 1.22 func keys[M ~map[K]V, K comparable, V any](m M) (keys []K) { keys = make([]K, 0, len(m)) diff --git a/ui/src/lib/components/Date.svelte b/ui/src/lib/components/Date.svelte new file mode 100644 index 00000000..69789d14 --- /dev/null +++ b/ui/src/lib/components/Date.svelte @@ -0,0 +1,16 @@ + + +{#if date} + +{:else} + - +{/if} diff --git a/ui/src/lib/components/Performance.svelte b/ui/src/lib/components/Performance.svelte new file mode 100644 index 00000000..affb4487 --- /dev/null +++ b/ui/src/lib/components/Performance.svelte @@ -0,0 +1,31 @@ + + +
+ {#if icon} + 0 ? ArrowTrendingUp : ArrowTrendingDown} + class="{perf < 0 ? 'text-red-400' : 'text-green-400'} + mr-1.5 h-5 w-5 flex-shrink-0" + aria-hidden="true" + /> + {/if} + {Intl.NumberFormat(navigator.language, { maximumFractionDigits: 2 }).format(perf)} % ({currency( + perfAbs, + 'EUR' + )}) +
diff --git a/ui/src/lib/components/PortfolioBreadcrumb.svelte b/ui/src/lib/components/PortfolioBreadcrumb.svelte index 88cc38ae..d55eebb9 100644 --- a/ui/src/lib/components/PortfolioBreadcrumb.svelte +++ b/ui/src/lib/components/PortfolioBreadcrumb.svelte @@ -1,10 +1,10 @@
@@ -55,20 +51,8 @@ {portfolio.displayName}
-
- 0 ? ArrowTrendingUp : ArrowTrendingDown} - class="{perf < 0 ? 'text-red-400' : 'text-green-400'} - mr-1.5 h-5 w-5 flex-shrink-0" - aria-hidden="true" - /> - {Intl.NumberFormat('de', { maximumFractionDigits: 2 }).format(perf)} % ({currency( - perfAbs, - 'EUR' - )}) +
+
diff --git a/ui/src/lib/components/PortfolioCard.svelte b/ui/src/lib/components/PortfolioCard.svelte index e35052ff..57f00f04 100644 --- a/ui/src/lib/components/PortfolioCard.svelte +++ b/ui/src/lib/components/PortfolioCard.svelte @@ -1,8 +1,10 @@ -Hey from there