exciting-aftermath/Portfolio.WebUI.Server/Components/Pages/Home.razor.cs

54 lines
1.7 KiB
C#

using Portfolio.Domain.Features.Portfolio;
using static System.Net.WebRequestMethods;
namespace Portfolio.WebUI.Server.Components.Pages
{
partial class Home
{
private List<string> skills;
private List<string> tools;
private List<string> courses;
private List<WorkExperience> experiences;
private List<ProjectEntry> projects;
private bool isExperience = true;
private bool isProjects = false;
protected override async Task OnInitializedAsync()
{
var http = ClientFactory.CreateClient("LocalClient");
skills = await http.GetFromJsonAsync<List<string>>("data/skills.json");
tools = await http.GetFromJsonAsync<List<string>>("data/tools.json");
courses = await http.GetFromJsonAsync<List<string>>("data/courses.json");
experiences = await http.GetFromJsonAsync<List<WorkExperience>>("data/workexperiences.json");
projects = await http.GetFromJsonAsync<List<ProjectEntry>>("data/projects.json");
}
private void ToggleExperience()
{
if (!isExperience)
{
isExperience = true;
isProjects = false;
StateHasChanged();
}
}
private void ToggleProjects()
{
if (!isProjects)
{
isProjects = true;
isExperience = false;
StateHasChanged();
}
}
private string FormatDescription(string desc)
{
// Simple replacement for [text](url) markdown-style links
return System.Text.RegularExpressions.Regex.Replace(desc, @"\[(.+?)\]\((.+?)\)", "<a href=\"$2\">$1</a>");
}
}
}