Skip to content

Commit

Permalink
Merge pull request #6 from learntocloud/addprojectcomponent
Browse files Browse the repository at this point in the history
Add CloudProjectIdea feature and update dependencies
  • Loading branch information
madebygps authored Sep 16, 2024
2 parents dfb861c + 1b97057 commit b4cf70f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
1 change: 1 addition & 0 deletions Client/BlazorBasic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.1" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions Client/CloudProjectIdea.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace BlazorBasic
{
public class CloudProjectIdea
{

public string? Title { get; set; }
public string? Description { get; set; }
public List<string>? Steps { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string> Resources { get; set; } = new List<string>();



}
}
46 changes: 25 additions & 21 deletions Client/Pages/Definition.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,41 @@ else
<MudLink Href="@($"{definition.LearnMoreUrl}")">learn more</MudLink>
</MudText>



<MudText Typo="Typo.h5" Align="Align.Left" Class="ml-0 mt-0">Project Idea</MudText>
<MudText Align="Align.Justify" GutterBottom="true" Class="ml-0 mt-3">@project.Description</MudText>


<MudDivider DividerType="DividerType.FullWidth" Class="mt-5" />
<div class="d-flex justify-left">

<MudText Typo="Typo.h4" Class="ml-1 mt-5" Color="Color.Default"> explore more in the <i>@definition.Tag</i> tag:
</MudText>

</div>

<MudText Typo="Typo.h5" Align="Align.Left" Class="ml-0 mt-0">Project Idea: @cloudProjectIdea.Title </MudText>
<MudText Align="Align.Justify" GutterBottom="true" Class="ml-0 mt-3">@cloudProjectIdea.Description</MudText>



<MudGrid Class="mt-2">


@foreach (var word in words)
@foreach (var step in cloudProjectIdea.Steps)
{
var wordSlug = WebUtility.UrlEncode(word.Word.Replace("-", "__").Replace(" ", "-"));

<MudItem xs="12" sm="12" md="12">

<MudText Class="my-2" Align="Align.Center" Color="Color.Default">
<MudLink Href="@($"/{wordSlug}")" Underline="Underline.Hover" Color="Color.Default" Typo="Typo.h6">
@word.Word.ToLower()</MudLink>
<MudText Class="my-2" Align="Align.Left" Color="Color.Default">
@step
</MudText>

</MudItem>
}
</MudGrid>





<MudItem xs="12" sm="12" md="12">

<MudText Class="my-2" Align="Align.Left" Color="Color.Default">
<MudLink Href="@($"/{cloudProjectIdea.Resources.FirstOrDefault()}")" Underline="Underline.Hover" Color="Color.Default" Typo="Typo.h6">
Resources
</MudLink>
</MudText>

</MudItem>




</MudContainer>
}
Expand All @@ -81,12 +81,15 @@ else
private WordDefinition[] words;
private WordDefinition? definition;
private Project project;
private CloudProjectIdea cloudProjectIdea;

protected override async Task OnParametersSetAsync()
{
var Word = WebUtility.UrlDecode(WordSlug).Replace("-", " ").Replace("__", "-");

var apiBaseUrl = Configuration["ApiSettings:BaseUrl"];
var projectGeneratorBaseUrl = Configuration["ApiSettings:ProjectGeneratorBaseUrl"];
var projectGeneratorApiKey = Configuration["ApiSettings:ProjectGeneratorApiKey"];
var definitionApiKey = Configuration["ApiSettings:DefinitionApiKey"];
var tagApiKey = Configuration["ApiSettings:TagApiKey"];
var projectApiKey = Configuration["ApiSettings:ProjectApiKey"];
Expand All @@ -99,5 +102,6 @@ else
words = datawords.Data.ToArray();

project = await Http.GetFromJsonAsync<Project>($"{apiBaseUrl}/GetProjectByWord?code={projectApiKey}&word={Word}");
cloudProjectIdea = await Http.GetFromJsonAsync<CloudProjectIdea>($"{projectGeneratorBaseUrl}/GenerateProjectFromConcept?code={projectGeneratorApiKey}&concept={Word}");
}
}
2 changes: 0 additions & 2 deletions Client/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
</MudContainer>




@code {
bool disabled = false;
private string _searchTerm;
Expand Down

0 comments on commit b4cf70f

Please sign in to comment.