Skip to content

Commit 6a69acf

Browse files
chore: use @let
Co-authored-by: Copilot <copilot@github.com>
1 parent c09edb1 commit 6a69acf

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

apps/angular/src/app/app.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@ import { WeatherContentComponent } from './components/weather-content.component'
2626
2727
<main class="main">
2828
<div class="container">
29+
@let currentState = state();
30+
2931
<app-search-form
30-
[isLoading]="state().isLoading"
32+
[isLoading]="currentState.isLoading"
3133
(search)="onSearch($event)"
3234
></app-search-form>
3335
3436
<div class="weather-container" data-testid="weather-container">
35-
<app-loading-state [isVisible]="state().isLoading"></app-loading-state>
37+
<app-loading-state [isVisible]="currentState.isLoading"></app-loading-state>
3638
3739
<app-error-state
38-
[isVisible]="!!state().error && !state().isLoading"
39-
[message]="state().error"
40+
[isVisible]="!!currentState.error && !currentState.isLoading"
41+
[message]="currentState.error"
4042
></app-error-state>
4143
4244
<app-weather-content
43-
[isVisible]="!!state().weatherData && !state().isLoading && !state().error"
44-
[weatherData]="state().weatherData"
45+
[isVisible]="!!currentState.weatherData && !currentState.isLoading && !currentState.error"
46+
[weatherData]="currentState.weatherData"
4547
></app-weather-content>
4648
</div>
4749
</div>

apps/angular/src/app/components/weather-content.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import { ForecastComponent } from './forecast.component';
1414
data-testid="weather-content"
1515
[hidden]="!isVisible()"
1616
>
17+
@let currentWeatherData = weatherData();
18+
1719
<div class="weather-layout">
18-
<app-current-weather [weatherData]="weatherData()"></app-current-weather>
19-
<app-forecast [weatherData]="weatherData()"></app-forecast>
20+
<app-current-weather [weatherData]="currentWeatherData"></app-current-weather>
21+
<app-forecast [weatherData]="currentWeatherData"></app-forecast>
2022
</div>
2123
</div>
2224
`

0 commit comments

Comments
 (0)