PokemonCard component visible in PokemonView now. Also added the search feature in PokemonSelector into the PokemonTable. Made other changes too but minor.

This commit is contained in:
Kira Jiroux 2025-06-09 16:55:52 -04:00
parent 17607b663b
commit 1955a210aa
15 changed files with 129 additions and 79 deletions

View File

@ -13,7 +13,7 @@
<HeadOutlet /> <HeadOutlet />
</head> </head>
<body class=""> <body class="bg-primary-subtle">
<Routes /> <Routes />
<script src="_framework/blazor.web.js"></script> <script src="_framework/blazor.web.js"></script>
<script src="js/site.js"></script> <script src="js/site.js"></script>

View File

@ -32,12 +32,12 @@
<div class="z-3 pokemon-flavor-text @(GetTypeCssClass(_pokemon.PokemonType))"> <div class="z-3 pokemon-flavor-text @(GetTypeCssClass(_pokemon.PokemonType))">
@if (string.IsNullOrEmpty(_pokemon.FlavorText)) @if (string.IsNullOrEmpty(_pokemon.FlavorText))
{ {
<p class="">[ Pokemon Flavor Text Placeholder ]</p> <p class="fw-light">[ Pokemon Flavor Text Placeholder ]</p>
} }
else else
{ {
<p class="fw-light ">@_pokemon.FlavorText</p> <p class="fw-light">@_pokemon.FlavorText</p>
} }
</div> </div>
@ -51,3 +51,10 @@
</div> </div>
</div> </div>
<div class="mt-5 position-relative">
<div class="position-absolute top-50 start-50 translate-middle">
<PokemonEditButton PokemonId="@_pokemon.Id" />
</div>
</div>

View File

@ -71,7 +71,6 @@
justify-content: center; /* Horizontally centers text */ justify-content: center; /* Horizontally centers text */
overflow: hidden; /* Ensures no scrollbar */ overflow: hidden; /* Ensures no scrollbar */
border-width: 2px; border-width: 2px;
border-radius: 5% / 13%; border-radius: 5% / 13%;
border-style: solid; border-style: solid;
@ -83,7 +82,7 @@
margin: 0; margin: 0;
width: 100%; width: 100%;
text-align: start; text-align: start;
font-size: min(13px, 1.5vw); /* Scales font but won't exceed 13px */ font-size: min(12.5px, 1.5vw); /* Scales font but won't exceed 12.5px */
line-height: 1.2; /* Adjust spacing for readability */ line-height: 1.2; /* Adjust spacing for readability */
white-space: normal; /* Ensures wrapping */ white-space: normal; /* Ensures wrapping */
word-wrap: break-word; word-wrap: break-word;

View File

@ -13,7 +13,7 @@
<!-- Home --> <!-- Home -->
<button class="btn btn-primary mx-1 align-content-center" style="border-radius: 50px 15px; max-width: 60px;"> <button class="btn btn-primary mx-1 align-content-center" style="border-radius: 50px 15px; max-width: 60px;">
<NavLink href="/pokemonsleep"> <NavLink href="/pokemonsleep">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-fill mb-1" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFF" class="bi bi-house-fill mb-1" viewBox="0 0 16 16">
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L8 2.207l6.646 6.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293z" /> <path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L8 2.207l6.646 6.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293z" />
<path d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293z" /> <path d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293z" />
</svg> </svg>
@ -23,7 +23,7 @@
<!-- Pokemon Table--> <!-- Pokemon Table-->
<button class="btn btn-info mx-1" style="border-radius: 50px 15px; max-width: 60px;"> <button class="btn btn-info mx-1" style="border-radius: 50px 15px; max-width: 60px;">
<NavLink href="/pokemon"> <NavLink href="/pokemon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-table mb-1" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFF" class="bi bi-table mb-1" viewBox="0 0 16 16">
<path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z" /> <path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z" />
</svg> </svg>
</NavLink> </NavLink>
@ -32,7 +32,7 @@
<!-- Rate Pokemon --> <!-- Rate Pokemon -->
<button class="btn btn-success mx-1" style="border-radius: 50px 15px; max-width: 60px;"> <button class="btn btn-success mx-1" style="border-radius: 50px 15px; max-width: 60px;">
<NavLink href="/rate-pokemon"> <NavLink href="/rate-pokemon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-award-fill mb-1" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFF" class="bi bi-award-fill mb-1" viewBox="0 0 16 16">
<path d="m8 0 1.669.864 1.858.282.842 1.68 1.337 1.32L13.4 6l.306 1.854-1.337 1.32-.842 1.68-1.858.282L8 12l-1.669-.864-1.858-.282-.842-1.68-1.337-1.32L2.6 6l-.306-1.854 1.337-1.32.842-1.68L6.331.864z" /> <path d="m8 0 1.669.864 1.858.282.842 1.68 1.337 1.32L13.4 6l.306 1.854-1.337 1.32-.842 1.68-1.858.282L8 12l-1.669-.864-1.858-.282-.842-1.68-1.337-1.32L2.6 6l-.306-1.854 1.337-1.32.842-1.68L6.331.864z" />
<path d="M4 11.794V16l4-1 4 1v-4.206l-2.018.306L8 13.126 6.018 12.1z" /> <path d="M4 11.794V16l4-1 4 1v-4.206l-2.018.306L8 13.126 6.018 12.1z" />
</svg> </svg>
@ -42,7 +42,7 @@
<!-- Add Pokemon (Wrap in Auth) --> <!-- Add Pokemon (Wrap in Auth) -->
<button class="btn btn-warning mx-1" style="border-radius: 50px 15px; max-width: 60px;"> <button class="btn btn-warning mx-1" style="border-radius: 50px 15px; max-width: 60px;">
<NavLink href="/pokemonsleep/add-new-pokemon"> <NavLink href="/pokemonsleep/add-new-pokemon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle-fill mb-1" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFF" class="bi bi-plus-circle-fill mb-1" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3z" /> <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3z" />
</svg> </svg>
</NavLink> </NavLink>

View File

@ -8,11 +8,13 @@
<!-- Table A: Desktop View--> <!-- Table A: Desktop View-->
<div class="container d-none d-md-block"> <div class="container d-none d-md-block">
<!-- Main UI --> <!-- Main UI -->
<div class="card shadow-sm border-0 mt-4 mx-auto col-12 col-md-10 col-lg-8"> <div class="card shadow-sm border-0 mt-4 mx-auto col-12 col-md-10 col-lg-8 pokemontable">
<!-- Table Header --> <!-- Table Header -->
<div class="row card-header bg-secondary bg-gradient ml-0 py-3 border-0"> <div class="row card-header bg-secondary bg-gradient ml-0 py-3 border-0">
<div class="flex-row justify-content-between"> <div class="flex-row justify-content-between">
<div class="text-center position-relative"> <div class="text-center position-relative">
<input class="form-control position-absolute top-0 start-0 border-0 w-25" placeholder="Search Pokémon..." @bind="SearchTerm" @oninput="HandleSearch" />
<h2 class="text-info text-decoration-underline">Available Pokémon</h2> <h2 class="text-info text-decoration-underline">Available Pokémon</h2>
<div class="m-1 badge bg-info position-absolute top-0 end-0 border-0"><p class="statText">@(pokemons.Count()) Pokemon</p></div> <div class="m-1 badge bg-info position-absolute top-0 end-0 border-0"><p class="statText">@(pokemons.Count()) Pokemon</p></div>
</div> </div>
@ -45,7 +47,7 @@
{ {
<!-- Table Body --> <!-- Table Body -->
<tbody> <tbody>
@foreach (var pokemon in pokemons) @foreach (var pokemon in FilteredPokemon)
{ {
<tr class="flex-row"> <tr class="flex-row">
<!-- Section: Pokemon Image --> <!-- Section: Pokemon Image -->

View File

@ -25,7 +25,18 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
} }
} }
} }
private string SearchTerm { get; set; } = string.Empty;
private List<Pokemon> FilteredPokemon =>
string.IsNullOrWhiteSpace(SearchTerm)
? AllPokemon
: AllPokemon.Where(p =>
p.PokemonName.Contains(SearchTerm, StringComparison.OrdinalIgnoreCase)).ToList();
private async Task HandleSearch(ChangeEventArgs e)
{
SearchTerm = e?.Value?.ToString() ?? "";
}
private void ToggleImage(int Id) private void ToggleImage(int Id)
{ {
if (isShiny.ContainsKey(Id)) if (isShiny.ContainsKey(Id))

View File

@ -5,6 +5,10 @@
width: 10%; width: 10%;
} }
.pokemontable {
height: 69vh;
}
.tableFixHead { .tableFixHead {
overflow: auto; overflow: auto;
height: 600px; height: 600px;

View File

@ -112,11 +112,18 @@ else
<label for="ImageUrl" class="form-label">Base Image URL</label> <label for="ImageUrl" class="form-label">Base Image URL</label>
<InputText id="ImageUrl" @bind-Value="NewPokemon.PokemonImageUrl" class="form-control" /> <InputText id="ImageUrl" @bind-Value="NewPokemon.PokemonImageUrl" class="form-control" />
</div> </div>
<!-- Shiny Image URL Input -->
<div class="row mb-3 m-auto"> <div class="row mb-3 m-auto">
<label for="ImageUrl" class="form-label">Shiny Image URL</label> <label for="ImageUrl" class="form-label">Shiny Image URL</label>
<InputText id="ImageUrl" @bind-Value="NewPokemon.PokemonShinyImageUrl" class="form-control" /> <InputText id="ImageUrl" @bind-Value="NewPokemon.PokemonShinyImageUrl" class="form-control" />
</div> </div>
<!-- Flavor Text Input -->
<div class="row mb-3 m-auto">
<label for="FlavorText" class="form-label">Flavor Text</label>
<InputText id="FlavorText" @bind-Value="NewPokemon.FlavorText" class="form-control" />
</div>
<!-- Form Buttons --> <!-- Form Buttons -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<button type="button" class="btn btn-secondary mb-3" @onclick="Cancel">Cancel</button> <button type="button" class="btn btn-secondary mb-3" @onclick="Cancel">Cancel</button>

View File

@ -32,13 +32,13 @@ namespace Portfolio.WebUI.Server.Components.Pages.Pokemon_Pages
isSubmitting = true; isSubmitting = true;
await PokemonService.AddPokemonAsync(NewPokemon); await PokemonService.AddPokemonAsync(NewPokemon);
isSubmitting = false; isSubmitting = false;
Navigation.NavigateTo("/pokemonsleep"); Navigation.NavigateTo("/pokemon");
} }
protected void Cancel(MouseEventArgs e) protected void Cancel(MouseEventArgs e)
{ {
Console.WriteLine("Testing in Cancel"); Console.WriteLine("Testing in Cancel");
Navigation.NavigateTo("/pokemonsleep"); Navigation.NavigateTo("/pokemon");
} }
} }

View File

@ -8,6 +8,9 @@
<PageTitle>Edit Pokémon</PageTitle> <PageTitle>Edit Pokémon</PageTitle>
<PokemonHeader /> <PokemonHeader />
<head>
<link rel="stylesheet" href="bootstrap/bootstrap-lumen.css" /> <!-- app.css -->
</head>
@if (pokemon == null) @if (pokemon == null)
{ {

View File

@ -8,28 +8,33 @@
@attribute [StreamRendering] @attribute [StreamRendering]
@rendermode InteractiveServer @rendermode InteractiveServer
<head>
<link rel="stylesheet" href="bootstrap/bootstrap-lumen.css" /> <!-- app.css -->
</head>
<PageTitle>Rate Pokémon</PageTitle> <PageTitle>Rate Pokémon</PageTitle>
<PokemonHeader /> <PokemonHeader />
@if (PokemonList == null || NatureList == null || SubskillList == null) <div class="mt-4">
{ <div class="row">
<Loading /> @if (PokemonList != null || NatureList == null || SubskillList == null)
} {
else <div class="mt-5">
{ <Loading />
<div class="mt-4"> </div>
<div class="row"> }
else
{
<!-- Left Panel: Selector -->
<div class="col-4">
<PokemonSelector
PokemonList="PokemonList"
SelectedPokemon="SelectedPokemon"
OnPokemonSelected="SelectPokemon" />
</div>
<!-- Left Panel: Selector --> <!-- Center Panel: Pokemon View -->
<div class="col-4">
<PokemonSelector
PokemonList="PokemonList"
SelectedPokemon="SelectedPokemon"
OnPokemonSelected="SelectPokemon" />
</div>
<!-- Center Panel: Pokemon View -->
<div class="col-4"> <div class="col-4">
<div class="d-flex justify-content-center align-items-center h-100"> <div class="d-flex justify-content-center align-items-center h-100">
@ -46,15 +51,15 @@ else
</div> </div>
<!-- Right Panel: Rating View --> <!-- Right Panel: Rating View -->
<div class="col-4"> <div class="col-4">
<PokemonRatingPanel <PokemonRatingPanel
PokemonToRate="SelectedPokemon" PokemonToRate="SelectedPokemon"
NatureList="NatureList" NatureList="NatureList"
SubskillList="SubskillList" SubskillList="SubskillList"
/> />
</div>
</div> </div>
</div>
} }
</div>
</div>

View File

@ -9,6 +9,10 @@
<PageTitle>Pokémon Sleep</PageTitle> <PageTitle>Pokémon Sleep</PageTitle>
<head>
<link rel="stylesheet" href="bootstrap/bootstrap-lumen.css" /> <!-- app.css -->
</head>
<div class="w-100"> <div class="w-100">
<!-- <PokemonBackground PokemonImages="pokemonImageUrls" ShinyPokemonImages="pokemonShinyImageUrls" /> --> <!-- <PokemonBackground PokemonImages="pokemonImageUrls" ShinyPokemonImages="pokemonShinyImageUrls" /> -->

View File

@ -7,15 +7,7 @@
<PageTitle>Pokémon Sleep</PageTitle> <PageTitle>Pokémon Sleep</PageTitle>
<head> <head>
@* <meta charset="utf-8" /> <link rel="stylesheet" href="bootstrap/bootstrap-lumen.css" /> <!-- app.css -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
*@
<link rel="stylesheet" href="bootstrap/bootstrap-brite.css" /> <!-- app.css -->
@* <link rel="stylesheet" href="Portfolio.WebUI.Server.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet /> *@
</head> </head>
<div class=""> <div class="">

View File

@ -8,6 +8,10 @@
<PokemonHeader /> <PokemonHeader />
<head>
<link rel="stylesheet" href="bootstrap/bootstrap-lumen.css" /> <!-- app.css -->
</head>
@if (_pokemon == null) @if (_pokemon == null)
{ {
<Loading /> <Loading />
@ -17,14 +21,20 @@ else
<PageTitle>@_pokemon.PokemonName</PageTitle> <PageTitle>@_pokemon.PokemonName</PageTitle>
<!-- Total Componenet--> <!-- Total Componenet-->
<div class="w-100"> <div class="container">
<div class="d-flex justify-content-center mt-4"> <div class="w-75 row mt-4 m-auto">
<button class="mt-1 p-2 btn btn-danger rounded-5 align-self-start text-white" disabled="@(!_previousPokemonId.HasValue)" @onclick="NavigateToPrevious">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-arrow-left-circle-fill" viewBox="0 0 16 16"> <!-- Previous Pokemon Button -->
<path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.5 7.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z" /> <div class="col-auto">
</svg> <button class="mt-1 p-2 btn btn-danger rounded-5 align-self-start text-white" disabled="@(!_previousPokemonId.HasValue)" @onclick="NavigateToPrevious">
</button> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-arrow-left-circle-fill" viewBox="0 0 16 16">
<div class="mt-5 mx-5 d-flex justify-content-center"> <path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.5 7.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z" />
</svg>
</button>
</div>
<!-- Pokemon Presentation -->
<div class="mt-5 mx-5 col justify-content-center">
@if (_variationPokemonId != null) @if (_variationPokemonId != null)
{ {
@if (_variationPokemonId != null && _pokemonVariant == null){ @if (_variationPokemonId != null && _pokemonVariant == null){
@ -32,50 +42,54 @@ else
} }
else else
{ {
<!-- If Variation Pokemon have same PokemonId -->
@if(_pokemon.Id != _pokemonVariant.Id) @if(_pokemon.Id != _pokemonVariant.Id)
{ {
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center align-items-center h-100">
<div class="position-relative"> <div class="pokemoncard m-1">
<PokemonCard Pokemon="_pokemon" /> <PokemonCard Pokemon="_pokemon" />
<div class="position-absolute top-100 start-50 translate-middle mt-5">
<PokemonEditButton PokemonId="_pokemon.Id" />
</div> </div>
</div>
<div class="position-relative"> <div class="pokemoncard m-1">
<PokemonCard Pokemon="_pokemonVariant" /> <PokemonCard Pokemon="_pokemonVariant" />
<div class="position-absolute top-100 start-50 translate-middle mt-5">
<PokemonEditButton PokemonId="_pokemonVariant.Id" />
</div> </div>
</div>
</div> </div>
} }
<!-- If Variation Pokemon has diff PokemonId -->
else else
{ {
<div class="position-relative"> <div class="d-flex justify-content-center align-items-center h-100">
<PokemonCard Pokemon="_pokemonVariant" /> <div class="pokemoncard">
<div class="position-absolute top-100 start-50 translate-middle mt-5"> <PokemonCard Pokemon="_pokemonVariant" />
<PokemonEditButton PokemonId="_pokemonVariant.Id" />
</div> </div>
</div> </div>
} }
} }
} }
else{ else{
<div class="position-relative"> <!-- Standard Pokemon Display -->
<PokemonCard Pokemon="_pokemon" /> <div class="d-flex justify-content-center align-items-center h-100">
<div class="position-absolute top-100 start-50 translate-middle mt-5"> <div class="pokemoncard m-1">
<PokemonEditButton PokemonId="_pokemon.Id" /> <PokemonCard Pokemon="_pokemon" />
</div> </div>
</div> </div>
} }
</div> </div>
<!-- Next Pokemon Button -->
<div class="col-auto">
<button class="mt-1 p-2 btn btn-danger rounded rounded-5 align-self-start text-white" disabled="@(!_nextPokemonId.HasValue)" @onclick="NavigateToNext"> <button class="mt-1 p-2 btn btn-danger rounded rounded-5 align-self-start text-white" disabled="@(!_nextPokemonId.HasValue)" @onclick="NavigateToNext">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16">
<path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z" /> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z" />
</svg> </svg>
</button> </button>
</div>
</div> </div>
</div> </div>
} }

View File

@ -1,2 +1,4 @@
body { .pokemoncard {
width: 100%;
max-width: 350px;
} }