From fd4a6982f100c774779866e266ea3239e73d52e2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 11 Feb 2024 18:31:07 +0100 Subject: [PATCH] Migrate to control flow --- .../account-balances.component.html | 19 +- .../activities-filter.component.html | 45 ++- .../activities-table.component.html | 365 +++++++++--------- .../activity-type.component.html | 22 +- .../lib/benchmark/benchmark.component.html | 54 +-- .../src/lib/carousel/carousel.component.html | 46 +-- .../currency-selector.component.html | 12 +- .../fire-calculator.component.html | 17 +- .../holdings-table.component.html | 55 ++- .../lib/line-chart/line-chart.component.html | 17 +- libs/ui/src/lib/logo/logo.component.html | 6 +- .../membership-card.component.html | 12 +- .../portfolio-proportion-chart.component.html | 17 +- .../symbol-autocomplete.component.html | 46 ++- .../trend-indicator.component.html | 90 ++--- libs/ui/src/lib/value/value.component.html | 140 ++++--- 16 files changed, 499 insertions(+), 464 deletions(-) diff --git a/libs/ui/src/lib/account-balances/account-balances.component.html b/libs/ui/src/lib/account-balances/account-balances.component.html index 3fb557211..0d1a79f41 100644 --- a/libs/ui/src/lib/account-balances/account-balances.component.html +++ b/libs/ui/src/lib/account-balances/account-balances.component.html @@ -34,15 +34,16 @@ - + @if (showActions) { + + } - - {{ filter.label | gfSymbol }} - - + @for (filter of selectedFilters; track filter) { + + {{ filter.label | gfSymbol }} + + + } - - - {{ filter.label | gfSymbol }} - - + @for (filterGroup of filterGroups$ | async; track filterGroup) { + + @for (filter of filterGroup.filters; track filter) { + + {{ filter.label | gfSymbol }} + + } + + } - - - +@if (hasPermissionToCreateActivity) { +
- - - -
+ @if (hasPermissionToExportActivities) { + + } + + + @if (hasPermissionToExportActivities) { + + } + @if (hasPermissionToExportActivities) { + + } + + + +}
@@ -133,19 +139,18 @@
{{ element.SymbolProfile?.name }} - Draft + @if (element.isDraft) { + Draft + }
-
- {{ - element.SymbolProfile?.symbol | gfSymbol - }} -
+ @if (!isUUID(element.SymbolProfile?.symbol)) { +
+ {{ + element.SymbolProfile?.symbol | gfSymbol + }} +
+ } @@ -302,12 +307,13 @@ @@ -324,90 +330,97 @@ class="d-none d-lg-table-cell px-1" mat-cell > - + @if (element.comment) { + + }
-
- -
+ @if (element.error) { +
+ +
+ }
- + @if (element.Account?.Platform?.url) { + + } {{ element.Account?.name }}
- - - - - + @if ( + !hasPermissionToCreateActivity && hasPermissionToExportActivities + ) { + } + + @if (hasPermissionToCreateActivity) { + + } + @if (hasPermissionToCreateActivity) { + + } + @if (hasPermissionToExportActivities) { + + } + @if (hasPermissionToExportActivities) { + + } - + @if (showActions) { + + }
- +@if (isLoading) { + +} -
- -
+@if ( + dataSource?.data.length === 0 && hasPermissionToCreateActivity && !isLoading +) { +
+ +
+} diff --git a/libs/ui/src/lib/activity-type/activity-type.component.html b/libs/ui/src/lib/activity-type/activity-type.component.html index bcf338eb1..78eb2f17b 100644 --- a/libs/ui/src/lib/activity-type/activity-type.component.html +++ b/libs/ui/src/lib/activity-type/activity-type.component.html @@ -10,14 +10,18 @@ sell: activityType === 'SELL' }" > - - - - - - + @if (activityType === 'BUY') { + + } @else if (activityType === 'DIVIDEND' || activityType === 'INTEREST') { + + } @else if (activityType === 'FEE') { + + } @else if (activityType === 'ITEM') { + + } @else if (activityType === 'LIABILITY') { + + } @else if (activityType === 'SELL') { + + } {{ activityTypeLabel }} diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index c0fdbf956..2e5c819e7 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -16,16 +16,17 @@
- + @if (element?.trend50d !== 'UNKNOWN') { + + }
@@ -40,16 +41,17 @@
- + @if (element?.trend200d !== 'UNKNOWN') { + + }
@@ -99,13 +101,11 @@ -
- {{ resolveMarketCondition(element.marketCondition).emoji }} -
+ @if (element?.marketCondition) { +
+ {{ resolveMarketCondition(element.marketCondition).emoji }} +
+ }
diff --git a/libs/ui/src/lib/carousel/carousel.component.html b/libs/ui/src/lib/carousel/carousel.component.html index cafab3107..27d94dfd5 100644 --- a/libs/ui/src/lib/carousel/carousel.component.html +++ b/libs/ui/src/lib/carousel/carousel.component.html @@ -1,14 +1,15 @@ - +@if (this.showPrevArrow) { + +}
- +@if (this.showNextArrow) { + +} diff --git a/libs/ui/src/lib/currency-selector/currency-selector.component.html b/libs/ui/src/lib/currency-selector/currency-selector.component.html index 38fc6c43e..76fe8fef0 100644 --- a/libs/ui/src/lib/currency-selector/currency-selector.component.html +++ b/libs/ui/src/lib/currency-selector/currency-selector.component.html @@ -11,11 +11,9 @@ [displayWith]="displayFn" (optionSelected)="onUpdateCurrency($event)" > - - {{ currencyItem.label }} - + @for (currencyItem of filteredCurrencies; track currencyItem) { + + {{ currencyItem.label }} + + } diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.component.html b/libs/ui/src/lib/fire-calculator/fire-calculator.component.html index 148c8e817..46cd0999f 100644 --- a/libs/ui/src/lib/fire-calculator/fire-calculator.component.html +++ b/libs/ui/src/lib/fire-calculator/fire-calculator.component.html @@ -70,14 +70,15 @@
- + @if (isLoading) { + + }
{{ element.name }} - ({{ element.assetSubClassLabel }}) + @if (element.name === element.symbol) { + ({{ element.assetSubClassLabel }}) + }
{{ element.symbol }} @@ -154,30 +154,29 @@ - +@if (isLoading) { + +} -
- -
+@if (dataSource.data.length > pageSize && !isLoading) { +
+ +
+} -
- -
+@if ( + dataSource.data.length === 0 && hasPermissionToCreateActivity && !isLoading +) { +
+ +
+} diff --git a/libs/ui/src/lib/line-chart/line-chart.component.html b/libs/ui/src/lib/line-chart/line-chart.component.html index e60f964b7..e9a5bbbe0 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.html +++ b/libs/ui/src/lib/line-chart/line-chart.component.html @@ -1,11 +1,12 @@ - +@if (isLoading && showLoader) { + +} - {{ label ?? 'Ghostfolio' }} + @if (showLabel) { + {{ label ?? 'Ghostfolio' }} + } + diff --git a/libs/ui/src/lib/membership-card/membership-card.component.html b/libs/ui/src/lib/membership-card/membership-card.component.html index d069274ca..02a4a03f7 100644 --- a/libs/ui/src/lib/membership-card/membership-card.component.html +++ b/libs/ui/src/lib/membership-card/membership-card.component.html @@ -18,12 +18,14 @@
Membership
{{ name }}
-
-
Valid until
-
- {{ expiresAt }} + @if (expiresAt) { +
+
Valid until
+
+ {{ expiresAt }} +
-
+ }
diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html index 67e4798f7..c7de5ef4d 100644 --- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html +++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html @@ -1,11 +1,12 @@ - +@if (isLoading) { + +} - - - {{ lookupItem.name }} - @if (lookupItem.dataProviderInfo.isPremium) { - - } - - {{ lookupItem.symbol | gfSymbol }} · {{ lookupItem.currency - }} - · {{ lookupItem.assetSubClassString }} - - + {{ lookupItem.name }} + @if (lookupItem.dataProviderInfo.isPremium) { + + } + + {{ lookupItem.symbol | gfSymbol }} · {{ lookupItem.currency }} + @if (lookupItem.assetSubClass) { + · {{ lookupItem.assetSubClassString }} + } + + + } + } - + +@if (isLoading) { + +} diff --git a/libs/ui/src/lib/trend-indicator/trend-indicator.component.html b/libs/ui/src/lib/trend-indicator/trend-indicator.component.html index 81ce57bfc..a86a40beb 100644 --- a/libs/ui/src/lib/trend-indicator/trend-indicator.component.html +++ b/libs/ui/src/lib/trend-indicator/trend-indicator.component.html @@ -1,50 +1,42 @@ - - - - - - - - - - - - - - - +} @else { + @if (marketState === 'closed' && range === '1d') { + + } @else { + @if (marketState === 'delayed' && range === '1d') { + + } @else { + + @if (value <= -0.0005) { + + } @else if (value > -0.0005 && value < 0.0005) { + + } @else { + + } + + } + } +} diff --git a/libs/ui/src/lib/value/value.component.html b/libs/ui/src/lib/value/value.component.html index 07c4616df..f35ac86b4 100644 --- a/libs/ui/src/lib/value/value.component.html +++ b/libs/ui/src/lib/value/value.component.html @@ -1,51 +1,61 @@ -
- -
+@if (icon) { +
+ +
+}
- + @if (value || value === 0 || value === null) {
- - -
+
-
-
-
-
- {{ formattedValue }}% -
-
- - ***** - - - {{ formattedValue }} - -
- - {{ unit }} - -
- {{ unit }} -
-
- + @if (isNumber || value === null) { + @if (colorizeSign && !useAbsoluteValue) { + @if (value > 0) { +
+
+ } @else if (value < 0) { +
-
+ } + } + @if (isPercent) { +
+ {{ formattedValue }}% +
+ } @else { +
+ @if (value === null) { + ***** + } @else { + {{ formattedValue }} + } +
+ } + @if (unit) { + @if (size === 'medium') { + + {{ unit }} + + } @else { +
+ {{ unit }} +
+ } + } + } + @if (isString) {
+ @if (value === undefined) { + + } -
- - {{ subLabel }} -
- - - + @if (size === 'large') { +
+ + @if (subLabel) { + {{ subLabel }} + } +
+ } @else { + + + + }