diff --git a/Portfolio.Domain/Features/Pokemon/Ingredient.cs b/Portfolio.Domain/Features/Pokemon/Ingredient.cs index b873d7e..5ff7281 100644 --- a/Portfolio.Domain/Features/Pokemon/Ingredient.cs +++ b/Portfolio.Domain/Features/Pokemon/Ingredient.cs @@ -8,7 +8,7 @@ namespace Portfolio.Domain.Features.Pokemon { public class Ingredient { - public string Ing { get; set; } + public string Name { get; set; } public string Description { get; set; } public string ImageURL { get; set; } } diff --git a/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor b/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor index 72a865c..08d1178 100644 --- a/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor +++ b/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor @@ -1,339 +1,375 @@ @inject IPokemonService PokemonService @inject IHttpClientFactory ClientFactory - -@if(formUse == "ADD") +@if(Ingredients == null) { -
- - + +} +else +{ + @if(formUse == "ADD") + { +
+ + -

New Pokemon

+

New Pokemon

- -
-
- # - - +
+
+ # + + +
+
+ + +
+ + Variation? + -
-
- - -
- - Variation? -
- - -
- - -
-
- Pokemon Type - - - @foreach (var pt in PokemonTypes) - { - - } - + class="form-control rounded-end" + hidden="@HideLabel" />
-
+ +
- -
- -
-
- Sleep Type -
-
- + +
+
+ Pokemon Type + - @foreach (var st in SleepTypes) + @foreach (var pt in PokemonTypes) { - + }
+
- -
-
- Specialty + + +
+ +
+
+ Sleep Type +
+
+ + + @foreach (var st in SleepTypes) + { + + } + +
-
- - - @foreach (var sp in Specialities) - { - - } - + +
+
+ Specialty +
+
+ + + @foreach (var sp in Specialities) + { + + } + +
-
- -
- -
-
- Ingredient 1 + +
+ +
+
+ Ingredient 1 +
+
+ + + @foreach (var ingredient in Ingredients) + { + + } + +
-
- - - @foreach (var ingredient in Ingredients) - { - - } - + +
+
+ Ingredient 2 +
+
+ + + @foreach (var ingredient in Ingredients) + { + + } + +
+
+ +
+
+ Ingredient 3 +
+
+ + + @foreach (var ingredient in Ingredients) + { + + } + +
-
- -
+ +
- -
-
- Base Image URL - + +
+
+ Base Image URL + +
-
-
-
- Shiny Image URL - +
+
+ Shiny Image URL + +
-
- -
-
- Flavor Text - + +
+
+ Flavor Text + +
-
- -
+ +
- @if (showErrors && !IsComplete) - { -
- Please complete: @string.Join(", ", MissingFields()) -
- } - -
- - @if (mostRecentForm) + @if (showErrors && !IsComplete) { - +
+ Please complete: @string.Join(", ", MissingFields()) +
} - else - { + +
+ @if (mostRecentForm) + { + + } + else + { + - } -
- -
- -} -else if (formUse == "EDIT") -{ -
- - - -

Edit Pokemon

- - -
-
- # - - + disabled> + + + + + + }
-
+
+
- -
- - Variation? -
+ } + else if (formUse == "EDIT") + { +
+ + - -
+

Edit Pokemon

- -
-
- Pokemon Type - - - @foreach (var pt in PokemonTypes) - { - - } - -
- -
- - -
- -
-
- Sleep Type + +
+
+ # + +
-
- +
+ + +
+ + Variation? +
+ + +
+ + +
+
+ Pokemon Type + - @foreach (var st in SleepTypes) + @foreach (var pt in PokemonTypes) { - + }
+
- -
-
- Specialty + + +
+ +
+
+ Sleep Type +
+
+ + + @foreach (var st in SleepTypes) + { + + } + +
-
- - - @foreach (var sp in Specialities) - { - - } - + +
+
+ Specialty +
+
+ + + @foreach (var sp in Specialities) + { + + } + +
-
- -
+ +
- -
-
- Base Image URL - + +
+
+ Base Image URL + +
-
-
-
- Shiny Image URL - +
+
+ Shiny Image URL + +
-
- -
-
- Flavor Text - + +
+
+ Flavor Text + +
-
- -
+ +
- @if (showErrors && !IsComplete) - { -
- Please complete: @string.Join(", ", MissingFields()) -
- } - -
- @if (mostRecentForm) + @if (showErrors && !IsComplete) { - +
+ Please complete: @string.Join(", ", MissingFields()) +
} -
- -
+ +
+ @if (mostRecentForm) + { + + } +
+ +
+ } } diff --git a/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor.cs b/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor.cs index 8af5e6b..8c76bda 100644 --- a/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor.cs +++ b/Portfolio.WebUI.Server/Components/Component/Pokemon Components/PokemonForm.razor.cs @@ -29,10 +29,7 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components PokemonName = string.Empty, // Required fields cannot be null SleepType = string.Empty, Speciality = string.Empty, - IsVariation = false, - Ingredient1 = "", - Ingredient2 = "", - Ingredient3 = "" + IsVariation = false }; // When Editing @@ -43,8 +40,6 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components // General Form - private List PokemonTypeInfo; - protected static readonly string[] PokemonTypes = new[] { "Grass","Fire","Water","Normal","Flying","Bug","Poison","Electric","Ground","Rock","Ice", @@ -52,8 +47,8 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components }; protected static readonly string[] SleepTypes = new[] { "Dozing", "Snoozing", "Slumbering" }; protected static readonly string[] Specialities = new[] { "Berries", "Ingredients", "Skills", "All" }; - private List Ingredients { get; set; } - + + private List? Ingredients; private bool HideLabel { get; set; } private bool showErrors { get; set; } = false; @@ -126,6 +121,7 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components private async Task SendPokemon() { + Console.WriteLine("onchange"); if(formUse == "ADD") { if (!IsComplete) @@ -147,7 +143,10 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components VariationName = NewPokemon.VariationName, PokemonImageUrl = NewPokemon.PokemonImageUrl, PokemonShinyImageUrl = NewPokemon.PokemonShinyImageUrl, - FlavorText = NewPokemon.FlavorText + FlavorText = NewPokemon.FlavorText, + Ingredient1 = NewPokemon.Ingredient1, + Ingredient2 = NewPokemon.Ingredient2, + Ingredient3 = NewPokemon.Ingredient3 }; await OnPokemonReady.InvokeAsync(copy); @@ -168,7 +167,10 @@ namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components VariationName = PokemonToEdit.VariationName, PokemonImageUrl = PokemonToEdit.PokemonImageUrl, PokemonShinyImageUrl = PokemonToEdit.PokemonShinyImageUrl, - FlavorText = PokemonToEdit.FlavorText + FlavorText = PokemonToEdit.FlavorText, + Ingredient1 = PokemonToEdit.Ingredient1, + Ingredient2 = PokemonToEdit.Ingredient2, + Ingredient3 = PokemonToEdit.Ingredient3 }; await OnPokemonReady.InvokeAsync(edit); diff --git a/Portfolio.WebUI.Server/wwwroot/data/ingredients.json b/Portfolio.WebUI.Server/wwwroot/data/ingredients.json index f83d99f..7bd1c26 100644 --- a/Portfolio.WebUI.Server/wwwroot/data/ingredients.json +++ b/Portfolio.WebUI.Server/wwwroot/data/ingredients.json @@ -1,98 +1,98 @@ [ { - "ingredient": "Large Leek", + "name": "Large Leek", "description": "Whether this is the kind of vegetable stalk that Farfetch'd like is unknown.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/largeleek.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/largeleek.png" }, { - "ingredient": "Tasty Mushroom", + "name": "Tasty Mushroom", "description": "A juicy mushroom with an abundance of umami flavor.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/tastymushroom.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/tastymushroom.png" }, { - "ingredient": "Fancy Egg", - "description": "A nutritious cooking ingredient that goes well with all sorts of seasonings.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/fancyegg.png" + "name": "Fancy Egg", + "description": "A nutritious cooking name that goes well with all sorts of seasonings.", + "imageURL": "https://www.serebii.net/pokemonsleep/names/fancyegg.png" }, { - "ingredient": "Soft Potato", + "name": "Soft Potato", "description": "Its mellow flavor makes both body and spirit feel warm and fuzzy.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/softpotato.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/softpotato.png" }, { - "ingredient": "Fancy Apple", + "name": "Fancy Apple", "description": "An apple chosen above others. It has spectacular form and a brilliant sheen.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/fancyapple.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/fancyapple.png" }, { - "ingredient": "Fiery Herb", + "name": "Fiery Herb", "description": "The fiery taste of this bright-red herb will wake anyone right up.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/fieryherb.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/fieryherb.png" }, { - "ingredient": "Bean Sausage", + "name": "Bean Sausage", "description": "A healthy sausage made from beans that Pok�mon like to eat.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/beansausage.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/beansausage.png" }, { - "ingredient": "Moomoo Milk", + "name": "Moomoo Milk", "description": "Highly nutritious milk. Pok�mon that drink it become full of energy.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/moomoomilk.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/moomoomilk.png" }, { - "ingredient": "Honey", + "name": "Honey", "description": "A sweet honey collected by Pok�mon.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/honey.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/honey.png" }, { - "ingredient": "Pure Oil", + "name": "Pure Oil", "description": "All-purpose oil that can be used in any type of cuisine.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/pureoil.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/pureoil.png" }, { - "ingredient": "Warming Ginger", - "description": "Spicy ginger that warms the body better than any other ingredient.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/warmingginger.png" + "name": "Warming Ginger", + "description": "Spicy ginger that warms the body better than any other name.", + "imageURL": "https://www.serebii.net/pokemonsleep/names/warmingginger.png" }, { - "ingredient": "Snoozy Tomato", + "name": "Snoozy Tomato", "description": "A bright-red tomato. Eat it and you'll sleep like a baby.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/snoozytomato.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/snoozytomato.png" }, { - "ingredient": "Soothing Cacao", + "name": "Soothing Cacao", "description": "This cacao bean is time-consuming to process, but its soothing effects make the effort worthwhile.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/soothingcacao.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/soothingcacao.png" }, { - "ingredient": "Slowpoke Tail", + "name": "Slowpoke Tail", "description": "A very tasty tail of something. When it falls off, it grows back quickly.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/slowpoketail.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/slowpoketail.png" }, { - "ingredient": "Greengrass Soybeans", + "name": "Greengrass Soybeans", "description": "This Greengrass Isle specialty is easy to process into foods that are great for training.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/greengrasssoybeans.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/greengrasssoybeans.png" }, { - "ingredient": "Greengrass Corn", + "name": "Greengrass Corn", "description": "This Greengrass Isle specialty can be eaten raw. It's remarkably sweet.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/greengrasscorn.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/greengrasscorn.png" }, { - "ingredient": "Rousing Coffee", + "name": "Rousing Coffee", "description": "You may have trouble sleeping if you drink too much of this. It may help make you feel more alert.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/rousingcoffee.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/rousingcoffee.png" }, { - "ingredient": "Plump Pumpkin", + "name": "Plump Pumpkin", "description": "A big pumpkin packed full of pulp.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/plumppumpkin.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/plumppumpkin.png" }, { - "ingredient": "Glossy Avocado", + "name": "Glossy Avocado", "description": "The glossy green shine is a sign it' s freshly picked.", - "imageURL": "https://www.serebii.net/pokemonsleep/ingredients/glossyavocado.png" + "imageURL": "https://www.serebii.net/pokemonsleep/names/glossyavocado.png" } ] \ No newline at end of file