-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from anrouxel/v3
V3
- Loading branch information
Showing
10 changed files
with
167 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@page "/" | ||
@using anrouxel.Pages.Home.Sections | ||
|
||
<PageTitle>Accueil</PageTitle> | ||
|
||
<Banners Title="Site en construction" /> | ||
|
||
<Home></Home> | ||
<Projects></Projects> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<section class="w-screen h-screen"> | ||
<div class="flex size-full"> | ||
<div class="flex-auto size-full flex"> | ||
<div class="m-auto max-w-md"> | ||
<form class="mx-auto"> | ||
<label for="default-search" | ||
class="mb-2 text-sm font-medium text-EUGrey-80 sr-only">Search</label> | ||
<div class="relative"> | ||
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none"> | ||
<svg class="w-4 h-4 text-EUGrey-80" aria-hidden="true" | ||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"> | ||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" | ||
stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" /> | ||
</svg> | ||
</div> | ||
<input type="search" id="default-search" | ||
class="block w-full p-4 ps-10 text-sm text-EUGrey-80 border border-EUGrey-80 rounded-2xl bg-EUGrey-10 focus:ring-EUPurple-140 focus:border-EUPurple-140" | ||
placeholder="Search Mockups, Logos..." required /> | ||
<button type="submit" | ||
class="text-white absolute w-fit inset-y-0 end-0 bg-EUPurple-100 hover:bg-EUPurple-110 focus:ring-4 focus:outline-none focus:ring-EUPurple-120 font-medium rounded-lg text-sm px-4 py-2 m-2">Search</button> | ||
</div> | ||
</form> | ||
|
||
<div class="mt-5 overflow-y-auto max-h-96"> | ||
@foreach (var repository in repositories) | ||
{ | ||
<div class="flex justify-between gap-x-6 p-5 bg-EUGrey-80 rounded-2xl font-mono"> | ||
<div class="flex min-w-0 gap-x-4"> | ||
<div class="min-w-0 flex-auto"> | ||
<p class="text-sm font-semibold leading-6 text-EUGrey-20">@repository.name</p> | ||
<p class="mt-1 truncate text-xs leading-5 text-EUGrey-40">@repository.description</p> | ||
</div> | ||
</div> | ||
<div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end"> | ||
<p class="text-sm leading-6 text-EUGrey-20">@repository.language</p> | ||
<p class="mt-1 text-xs leading-5 text-EUGrey-40"><time | ||
datetime="@(repository.pushed_at)">@(CalculateTimeDifference(repository.pushed_at))</time> | ||
</p> | ||
</div> | ||
</div> | ||
|
||
@if (repositories.IndexOf(repository) != repositories.Count - 1) | ||
{ | ||
<div class="my-5" /> | ||
} | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="flex-auto size-full flex"> | ||
<div class="m-auto"> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
using System.Net.Http.Json; | ||
using anrouxel.Models; | ||
using anrouxel.Services; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace anrouxel.Pages.Home.Sections | ||
{ | ||
public partial class Projects | ||
{ | ||
[Inject] | ||
private NavigationManager navigationManager { get; set; } = null!; | ||
|
||
[Inject] | ||
private IGithubService _githubService { get; set; } = null!; | ||
|
||
private List<Repository> repositories = new List<Repository>(); | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
repositories = await _githubService.GetRepositoriesAsync(); | ||
StateHasChanged(); | ||
} | ||
} | ||
|
||
private string CalculateTimeDifference(DateTimeOffset time) | ||
{ | ||
DateTimeOffset now = DateTimeOffset.Now; | ||
TimeSpan difference = now - time; | ||
|
||
if (difference.TotalDays >= 365) | ||
{ | ||
return $"{(int)(difference.TotalDays / 365)} année{(difference.TotalDays >= 730 ? "s" : "")}"; | ||
} | ||
else if (difference.TotalDays >= 30) | ||
{ | ||
return $"{(int)(difference.TotalDays / 30)} mois"; | ||
} | ||
else if (difference.TotalDays >= 1) | ||
{ | ||
return $"{(int)difference.TotalDays} jour{(difference.TotalDays >= 2 ? "s" : "")}"; | ||
} | ||
else if (difference.TotalHours >= 1) | ||
{ | ||
return $"{(int)difference.TotalHours} heure{(difference.TotalHours >= 2 ? "s" : "")}"; | ||
} | ||
else if (difference.TotalMinutes >= 1) | ||
{ | ||
return $"{(int)difference.TotalMinutes} minute{(difference.TotalMinutes >= 2 ? "s" : "")}"; | ||
} | ||
else if (difference.TotalSeconds >= 1) | ||
{ | ||
return $"{(int)difference.TotalSeconds} seconde{(difference.TotalSeconds >= 2 ? "s" : "")}"; | ||
} else { | ||
return "à l'instant"; | ||
} | ||
} | ||
|
||
private void navigateTo(string uri) | ||
{ | ||
navigationManager.NavigateTo(uri, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"GithubSettings": { | ||
"GITHUB_API_URL": "https://api.github.com/users/anrouxel" | ||
"GITHUB_API_URL": "https://api.github.com/users/", | ||
"GITHUB_PROFILE_URL": "anrouxel" | ||
} | ||
} |