Code Smells from Pages/Acceuil
continuous-integration/drone/push Build is passing Details

master
tomivt 2 months ago
parent 0bead3de61
commit 04110bc503

@ -3,7 +3,7 @@
<PageTitle>Accueil</PageTitle>
<h2><strong>@Localizer["AccueilWelcome"]</strong></h2>
<h2><strong>@Localizer["AccueilWelcome"] ?? "Bienvenue"</strong></h2>
<h4>@Localizer["AccueilTitle"]</h4>

@ -31,23 +31,56 @@ namespace WF_WebAdmin.Pages
/// </summary>
protected override async Task OnInitializedAsync()
{
Dailyquote = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-dataDailyQuote.json");
var url = $"{NavigationManager.BaseUri}fake-dataDailyQuote.json";
try
{
var response = await Http.GetFromJsonAsync<Quote[]>(url);
Dailyquote = response ?? Array.Empty<Quote>(); // Assurer qu'on ne stocke pas null
}
catch (Exception ex)
{
Console.WriteLine($"Erreur lors du chargement des citations : {ex.Message}");
Dailyquote = Array.Empty<Quote>(); // Éviter une exception en cas d'erreur réseau
}
}
private async void RandomDailyquote()
private async Task RandomDailyquote()
{
try
{
string _jsonFilePath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "fake-dataDailyQuote.json");
Random random = new Random();
Quote[] quotes = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-dataQuote.json");
var response = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-dataQuote.json");
Quote[] quotes = response ?? Array.Empty<Quote>(); // Empêche null
if (quotes.Length > 0)
{
Dailyquote = new Quote[] { quotes.OrderBy(x => random.Next()).First() };
}
else
{
Console.WriteLine("Aucune citation disponible dans le fichier JSON.");
return;
}
var json = JsonSerializer.Serialize(Dailyquote, new JsonSerializerOptions { WriteIndented = true });
await File.WriteAllTextAsync(_jsonFilePath, json);
if (Logger != null)
{
LoggerSaveStub.Log(Logger, LogLevel.Information, "Random change of quote of the day");
}
else
{
Console.WriteLine("Logger non initialisé.");
}
}
catch (Exception ex)
{
Console.WriteLine($"Erreur dans RandomDailyquote: {ex.Message}");
}
}
}
}

@ -16,7 +16,6 @@ namespace WF_WebAdmin.Pages
private List<User> users;
private bool showDeletePopup = false;
private bool showModifyPopup = false;
private User userToDelete = null;
private User selectedUser;
@ -164,7 +163,6 @@ namespace WF_WebAdmin.Pages
private void ClosePopup()
{
// Set all popup visibility flags to false to hide the popups
showDeletePopup = false; // Close the delete confirmation popup
showModifyPopup = false; // Close the modify confirmation popup
showPopupDelete = false; // Close any additional delete popups
showPopupAdmin = false; // Close the admin-related popup (if any)

@ -1,4 +1,13 @@
@page "/"
@*
File: _Host.cshtml
Project: WF_WebAdmin
Description: ...
Author: What The Fantasy
Created: 10/02/2025
Last Modified: 10/02/2025
*@
@page "/"
@namespace WF_WebAdmin.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
@ -8,5 +17,5 @@
<component type="typeof(App)" render-mode="ServerPrerendered" />
<body>
<script src=https://cdn.syncfusion.com/blazor/22.1.38/syncfusion-blazor.min.js type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/blazor/22.1.38/syncfusion-blazor.min.js" type="text/javascript"></script>
</body>

@ -1,4 +1,13 @@
@using Microsoft.AspNetCore.Components.Web
@*
File: _Layout.cshtml
Project: WF_WebAdmin
Description: ...
Author: What The Fantasy
Created: 10/02/2025
Last Modified: 10/02/2025
*@
@using Microsoft.AspNetCore.Components.Web
@namespace WF_WebAdmin.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@ -8,8 +8,10 @@
"IsAdmin": false,
"Comments": [
{
"Text": "Premier test effectu\u00E9, tout semble OK.",
"DateCreation": "2024-08-02T00:00:00"
"Id": 0,
"IdUser": 0,
"DateCreation": "2024-08-02T00:00:00",
"Text": "Premier test effectu\u00E9, tout semble OK."
}
]
},
@ -31,8 +33,10 @@
"IsAdmin": false,
"Comments": [
{
"Text": "Utilisateur tr\u00E8s actif, peut \u00EAtre un peu trop intrusif.",
"DateCreation": "2024-06-25T00:00:00"
"Id": 0,
"IdUser": 0,
"DateCreation": "2024-06-25T00:00:00",
"Text": "Utilisateur tr\u00E8s actif, peut \u00EAtre un peu trop intrusif."
}
]
},
@ -45,29 +49,6 @@
"IsAdmin": false,
"Comments": null
},
{
"Id": 8,
"Image": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137\u0026h=195\u0026c=7\u0026r=0\u0026o=5\u0026pid=1.7",
"Name": "dev_anna",
"Email": "dev.anna@gmail.com",
"DateCreation": "2024-09-05T00:00:00",
"IsAdmin": false,
"Comments": null
},
{
"Id": 9,
"Image": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137\u0026h=195\u0026c=7\u0026r=0\u0026o=5\u0026pid=1.7",
"Name": "support_mark",
"Email": "support.mark@gmail.com",
"DateCreation": "2024-11-20T00:00:00",
"IsAdmin": false,
"Comments": [
{
"Text": "Support rapide et efficace, mais manquant un peu de d\u00E9tails.",
"DateCreation": "2024-11-20T00:00:00"
}
]
},
{
"Id": 10,
"Image": "https://th.bing.com/th/id/OIP.24T00MDK-RUhFnm1Do5PFwHaFj?w=229\u0026h=180\u0026c=7\u0026r=0\u0026o=5\u0026pid=1.7",
@ -85,14 +66,5 @@
"DateCreation": "2024-09-22T00:00:00",
"IsAdmin": false,
"Comments": null
},
{
"Id": 14,
"Image": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137\u0026h=195\u0026c=7\u0026r=0\u0026o=5\u0026pid=1.7",
"Name": "developer_mike",
"Email": "developer.mike@gmail.com",
"DateCreation": "2024-11-02T00:00:00",
"IsAdmin": false,
"Comments": null
}
]
Loading…
Cancel
Save