feat(sprint-3): apply Survey Teal field UI
This commit is contained in:
@@ -40,6 +40,16 @@ public sealed partial class HomeViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _syncStatus = "";
|
||||
|
||||
public bool HasNoActiveJob => !HasActiveJob;
|
||||
|
||||
public string ActiveJobPointSummary => PointCount == 1
|
||||
? "1 point saved locally"
|
||||
: $"{PointCount} points saved locally";
|
||||
|
||||
public string CaptureReadinessText => HasActiveJob
|
||||
? "READY · Press LOG on the locating receiver"
|
||||
: "BLOCKED · Choose or create an active job first";
|
||||
|
||||
public ObservableCollection<LoggedPoint> RecentPoints { get; } = new();
|
||||
|
||||
public HomeViewModel(DeviceConnectionManager manager, MaglinkService gps,
|
||||
@@ -149,6 +159,15 @@ public sealed partial class HomeViewModel : ObservableObject
|
||||
PointCount++;
|
||||
}
|
||||
|
||||
partial void OnHasActiveJobChanged(bool value)
|
||||
{
|
||||
OnPropertyChanged(nameof(HasNoActiveJob));
|
||||
OnPropertyChanged(nameof(CaptureReadinessText));
|
||||
}
|
||||
|
||||
partial void OnPointCountChanged(int value) =>
|
||||
OnPropertyChanged(nameof(ActiveJobPointSummary));
|
||||
|
||||
private async void OnPacketIgnoredNoJob(object? sender, EventArgs e)
|
||||
{
|
||||
await Shell.Current.DisplayAlert("No Active Job",
|
||||
|
||||
@@ -12,13 +12,28 @@ public sealed partial class JobListItem : ObservableObject
|
||||
public required Job Job { get; init; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(JobSummary))]
|
||||
[NotifyPropertyChangedFor(nameof(DeleteDescription))]
|
||||
[NotifyPropertyChangedFor(nameof(AccessibilityDescription))]
|
||||
private int _pointCount;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(ActiveStatusLabel))]
|
||||
[NotifyPropertyChangedFor(nameof(ActiveActionLabel))]
|
||||
[NotifyPropertyChangedFor(nameof(ActiveActionDescription))]
|
||||
[NotifyPropertyChangedFor(nameof(AccessibilityDescription))]
|
||||
private bool _isActive;
|
||||
|
||||
public string Name => Job.Name;
|
||||
public string CreatedLabel => Job.CreatedUtc.ToLocalTime().ToString("g");
|
||||
public string ActiveStatusLabel => IsActive ? "ACTIVE JOB" : "NOT ACTIVE";
|
||||
public string ActiveActionLabel => IsActive ? "Active" : "Set active";
|
||||
public string JobSummary => $"Created {CreatedLabel} · {PointCount} {(PointCount == 1 ? "point" : "points")}";
|
||||
public string ActiveActionDescription => IsActive
|
||||
? $"{Name} is already the active job"
|
||||
: $"Make {Name} the active capture job";
|
||||
public string DeleteDescription => $"Delete {Name} and its {PointCount} saved points";
|
||||
public string AccessibilityDescription => $"{Name}. {ActiveStatusLabel}. {JobSummary}.";
|
||||
}
|
||||
|
||||
public sealed partial class JobsViewModel : ObservableObject
|
||||
@@ -37,6 +52,7 @@ public sealed partial class JobsViewModel : ObservableObject
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task RefreshAsync()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
@@ -16,10 +16,10 @@ public sealed partial class MapViewModel : ObservableObject
|
||||
private int _jobId;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _jobName = "";
|
||||
private string _jobName = "Active job map";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _statusText = "";
|
||||
private string _statusText = "Loading locally saved points…";
|
||||
|
||||
public SettingsService Settings => _settings;
|
||||
|
||||
@@ -35,7 +35,7 @@ public sealed partial class MapViewModel : ObservableObject
|
||||
var jobId = JobId > 0 ? JobId : _settings.ActiveJobId;
|
||||
if (jobId is null)
|
||||
{
|
||||
JobName = "";
|
||||
JobName = "No active job";
|
||||
StatusText = "No job selected. Create or activate a job to see its points.";
|
||||
return new List<LoggedPoint>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user