Skip to content

Commit 080080e

Browse files
committed
Building out sync status
1 parent 595b86c commit 080080e

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@using PocketDDD.BlazorClient.Features.Sync.Store
2+
3+
@inject IState<SyncState> State
4+
@inject IDispatcher Dispatcher
5+
6+
<h3>SyncStatus</h3>
7+
8+
@code {
9+
protected override void OnInitialized()
10+
{
11+
Dispatcher.Dispatch(new SyncAction());
12+
base.OnInitialized();
13+
}
14+
15+
}

PocketDDD.BlazorClient/PocketDDD.BlazorClient/Features/Sync/Store/SyncReducer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using Fluxor;
2+
using PocketDDD.BlazorClient.Features.EventScore.Store;
3+
using PocketDDD.BlazorClient.Features.Security.Store;
24

35
namespace PocketDDD.BlazorClient.Features.Sync.Store;
46

@@ -15,4 +17,13 @@ public static SyncState OnSyncCompleted(SyncState state, SyncCompletedAction act
1517
[ReducerMethod]
1618
public static SyncState OnSetEventDataVersion(SyncState state, SetEventDataVersionAction action) =>
1719
state with { EventDataVersion = action.Version };
20+
21+
[ReducerMethod]
22+
public static SyncState OnSetEventScore(SyncState state, SetEventScoreAction action) =>
23+
state with { EventScore = action.Score };
24+
25+
[ReducerMethod]
26+
public static SyncState OnSetCurrentUser(SyncState state, SetCurrentUserAction action) =>
27+
state with { LoggedInUser = action.User };
28+
1829
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
using Fluxor;
2+
using PocketDDD.Shared.API.ResponseDTOs;
23

34
namespace PocketDDD.BlazorClient.Features.Sync.Store;
45

56
[FeatureState]
67
public record SyncState
78
{
9+
public LoginResultDTO LoggedInUser { get; init; } = default!;
10+
public int EventScore { get; set; }
811
public int EventDataVersion { get; init; } = 0;
12+
13+
public int OutstandingEventFeedbackSyncCount { get; init; } = 0;
14+
public int OutstandingSessionFeedbackSyncCount { get; init; } = 0;
15+
public int OutstandingSyncItems =>
16+
OutstandingEventFeedbackSyncCount + OutstandingSessionFeedbackSyncCount;
17+
918
public bool IsSyncing { get; init; } = false;
19+
1020
}

0 commit comments

Comments
 (0)