Skip to content

Commit

Permalink
fix records consoles
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheackraze committed Mar 7, 2024
1 parent 6e2fe0c commit 83e06fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,27 @@ public void UpdateState(GeneralStationRecordConsoleState state)

StationRecordsFilterType.SelectId((int) _currentFilterType);

if (state.JobList != null)
{
JobListing.Visible = true;
PopulateJobsContainer(state.JobList);
}

if (state.RecordListing == null)
{
RecordListingStatus.Visible = true;
RecordListing.Visible = false;
RecordListing.Visible = true;
RecordListingStatus.Text = Loc.GetString("general-station-record-console-empty-state");
RecordContainer.Visible = false;
RecordContainerStatus.Visible = false;
RecordContainer.Visible = true;
RecordContainerStatus.Visible = true;
return;
}

RecordListingStatus.Visible = false;
RecordListing.Visible = true;
RecordContainer.Visible = true;
PopulateRecordListing(state.RecordListing!, state.SelectedKey);
if (state.JobList != null)
{
JobListing.Visible = true;
PopulateJobsContainer(state.JobList);
}

RecordContainerStatus.Visible = state.Record == null;

if (state.Record != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ private void UpdateUserInterface(Entity<GeneralStationRecordConsoleComponent> en
return;
}

var jobList = _stationJobsSystem.GetJobs(owningStation.Value);

var listing = _stationRecords.BuildListing((owningStation.Value, stationRecords), console.Filter);

switch (listing.Count)
{
case 0:
_ui.TrySetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState());
GeneralStationRecordConsoleState emptyState = new(null, null, null, jobList, console.Filter);
_ui.TrySetUiState(uid, GeneralStationRecordConsoleKey.Key, emptyState);
return;
case 1:
console.ActiveKey = listing.Keys.First();
Expand All @@ -89,8 +92,6 @@ private void UpdateUserInterface(Entity<GeneralStationRecordConsoleComponent> en

if (console.ActiveKey is not { } id)
return;
var jobList = _stationJobsSystem.GetJobs(owningStation.Value);


var key = new StationRecordKey(id, owningStation.Value);
_stationRecords.TryGetRecord<GeneralStationRecord>(key, out var record, stationRecords);
Expand Down

0 comments on commit 83e06fc

Please sign in to comment.