Favorites (#4)

* Added favorites page
* Refactor table to a reusable component

Reviewed-on: #4
Co-authored-by: Berack96 <giacomobertolazzi7@gmail.com>
Co-committed-by: Berack96 <giacomobertolazzi7@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
2026-01-20 15:24:26 +01:00
committed by Giacomo Bertolazzi
parent ae2c3c6855
commit 1b2ec9a1eb
7 changed files with 76 additions and 85 deletions

View File

@@ -12,42 +12,14 @@
</div>
</form>
<table class="table table-striped" id="moviesTable">
<thead class="table-primary">
<tr>
<th></th>
<th style="width: 100%;">Title</th>
<th>Year</th>
</tr>
</thead>
<tbody>
@if (movies?.Search != null)
{
@foreach (var movie in movies.Search)
{
<tr>
<td><button class="btn btn-secondary" @onclick="() => OnMovieSelected(movie.IdIMDB)">Details</button></td>
<td>@movie.Title</td>
<td>@movie.Year</td>
</tr>
}
}
</tbody>
</table>
<MovieTable Movies="movies" />
@inject OmdbService OmdbService
@inject NavigationManager NavigationManager
@code {
private string searchTitle = "";
private MovieSearch? movies = null;
private async Task OnMovieSelected(string imdbID)
{
NavigationManager.NavigateTo($"/movie/{imdbID}");
}
private async Task OnSearch()
{
movies = await OmdbService.FetchMovies(searchTitle);