-
Persistance
-
Profil du site stocke en MySQL
+
Temps reel
+
Presence et invitations synchronisees
- Username et email restent lies au compte authentifie, pendant que
- le profil ChessCubing ajoute les donnees utiles au site.
+ Les amis connectes apparaissent en direct, et les invitations de
+ partie peuvent etre confirmees depuis un autre device.
@@ -55,11 +55,12 @@
Connexion requise
-
Connecte-toi pour gerer ton profil
+
Connecte-toi pour gerer ton profil et tes amis
Utilise les boutons Se connecter ou Creer un compte dans le menu
- en haut de page, puis reviens ici pour enregistrer tes informations.
+ en haut de page, puis reviens ici pour enregistrer tes informations
+ et inviter d'autres joueurs.
@@ -86,15 +87,15 @@
{
Chargement
- Recuperation du profil utilisateur
- Le serveur recharge les donnees enregistrees pour ce compte.
+ Recuperation de l'espace utilisateur
+ Le serveur recharge le profil, les amis et les invitations de ce compte.
}
else if (!string.IsNullOrWhiteSpace(LoadError))
{
Serveur
- Impossible de charger le profil
+ Impossible de charger l'espace utilisateur
@LoadError
@@ -217,6 +218,235 @@
+
+
+
+
+
Reseau joueur
+
Amis et invitations
+
+
+
+
+
+
+
+ Invite des joueurs du site, suis les invitations en cours et retrouve rapidement les amis connectes.
+
+ @if (!string.IsNullOrWhiteSpace(SocialLoadError))
+ {
+ @SocialLoadError
+ }
+
+ @if (!string.IsNullOrWhiteSpace(SocialActionError))
+ {
+ @SocialActionError
+ }
+
+ @if (!string.IsNullOrWhiteSpace(SocialActionMessage))
+ {
+ @SocialActionMessage
+ }
+
+
+
+ @if (!string.IsNullOrWhiteSpace(SearchError))
+ {
+ @SearchError
+ }
+
+ @if (SearchResults.Length > 0)
+ {
+
+ @foreach (var result in SearchResults)
+ {
+
+
+
+
+ @if (result.IsFriend)
+ {
+ Deja ami
+ }
+ else if (FindReceivedInvitation(result.Subject) is { } receivedInvitation)
+ {
+
+
+ }
+ else if (FindSentInvitation(result.Subject) is { } sentInvitation)
+ {
+ Invitation envoyee
+
+ }
+ else
+ {
+
+ }
+
+
+ }
+
+ }
+
+
+
+
+ Amis
+ @FriendCountLabel
+
+
+ @if (IsSocialLoading)
+ {
+ Chargement des amis...
+ }
+ else if (SocialOverview?.Friends.Length > 0)
+ {
+
+ @foreach (var friend in SocialOverview.Friends.OrderByDescending(friend => ResolveOnlineStatus(friend.Subject, friend.IsOnline)).ThenBy(friend => friend.DisplayName, StringComparer.OrdinalIgnoreCase))
+ {
+
+
+
+
+
+
+
+ }
+
+ }
+ else
+ {
+ Aucun ami pour le moment. Utilise la recherche ci-dessus pour commencer.
+ }
+
+
+
+
+ Invitations recues
+ @ReceivedCountLabel
+
+
+ @if (IsSocialLoading)
+ {
+ Chargement des invitations...
+ }
+ else if (SocialOverview?.ReceivedInvitations.Length > 0)
+ {
+
+ @foreach (var invitation in SocialOverview.ReceivedInvitations.OrderByDescending(invitation => invitation.CreatedUtc))
+ {
+
+
+
+
+
+
+
+
+ }
+
+ }
+ else
+ {
+ Aucune invitation recue pour l'instant.
+ }
+
+
+
+
+ Invitations envoyees
+ @SentCountLabel
+
+
+ @if (IsSocialLoading)
+ {
+ Chargement des invitations...
+ }
+ else if (SocialOverview?.SentInvitations.Length > 0)
+ {
+
+ @foreach (var invitation in SocialOverview.SentInvitations.OrderByDescending(invitation => invitation.CreatedUtc))
+ {
+
+
+
+
+
+
+
+ }
+
+ }
+ else
+ {
+ Aucune invitation envoyee pour l'instant.
+ }
+
+
+
}
@@ -225,12 +455,22 @@
private readonly UserProfileFormModel Form = new();
private UserProfileResponse? Profile;
+ private SocialOverviewResponse? SocialOverview;
+ private SocialSearchUserResponse[] SearchResults = [];
private bool IsAuthenticated;
private bool IsLoading = true;
private bool IsSaving;
+ private bool IsSocialLoading;
+ private bool IsSearching;
+ private int _knownSocialVersion;
private string? LoadError;
private string? SaveError;
private string? SaveMessage;
+ private string? SocialLoadError;
+ private string? SocialActionError;
+ private string? SocialActionMessage;
+ private string? SearchError;
+ private string SearchQuery = string.Empty;
private string HeroStatusTitle
=> !IsAuthenticated
@@ -241,20 +481,55 @@
private string HeroStatusDescription
=> !IsAuthenticated
- ? "Le profil du site apparait des qu'un compte joueur est connecte."
+ ? "Le profil du site et le reseau d'amis apparaissent des qu'un compte joueur est connecte."
: IsLoading
- ? "Le serveur verifie la fiche utilisateur associee a ce compte."
- : $"Compte lie a {Profile?.Username ?? "l'utilisateur connecte"} et stocke en base MySQL.";
+ ? "Le serveur verifie la fiche utilisateur et les relations sociales associees a ce compte."
+ : $"Compte lie a {Profile?.Username ?? "l'utilisateur connecte"} avec synchronisation sociale en direct.";
+
+ private string FriendCountLabel => $"{SocialOverview?.Friends.Length ?? 0} ami(s)";
+
+ private string ReceivedCountLabel => $"{SocialOverview?.ReceivedInvitations.Length ?? 0} recue(s)";
+
+ private string SentCountLabel => $"{SocialOverview?.SentInvitations.Length ?? 0} envoyee(s)";
protected override async Task OnInitializedAsync()
{
AuthenticationStateProvider.AuthenticationStateChanged += HandleAuthenticationStateChanged;
+ Realtime.Changed += HandleRealtimeChanged;
+ await Realtime.EnsureStartedAsync();
await LoadProfileAsync();
}
private void HandleAuthenticationStateChanged(Task