Show last updated time on Inventory tab

This commit is contained in:
Liza 2024-08-02 15:51:49 +02:00
parent 9250044c60
commit 3ce9405ada
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup>
<Version>5.6</Version>
<Version>5.7</Version>
<OutputPath>dist</OutputPath>
</PropertyGroup>

View File

@ -22,6 +22,7 @@ internal sealed class InventoryTab : ITab
private readonly IPluginLog _pluginLog;
private List<TreeNode>? _listAsTrees;
private DateTime? _lastUpdate;
public InventoryTab(Configuration configuration, AllaganToolsIpc allaganToolsIpc, GameCache gameCache,
IPluginLog pluginLog)
@ -38,6 +39,7 @@ internal sealed class InventoryTab : ITab
if (!tab)
{
_listAsTrees = null;
_lastUpdate = null;
return;
}
@ -47,6 +49,16 @@ internal sealed class InventoryTab : ITab
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Redo, "Refresh"))
RefreshInventory();
if (_lastUpdate != null)
{
string text = $"Last Update: {_lastUpdate:t}";
ImGui.SameLine();
ImGui.SameLine(ImGui.GetContentRegionAvail().X - ImGui.CalcTextSize(text).X + ImGui.GetCursorPosX());
ImGui.AlignTextToFramePadding();
ImGui.TextColored(ImGuiColors.DalamudGrey, text);
}
ImGui.Separator();
if (_listAsTrees == null || _listAsTrees.Count == 0)
@ -167,6 +179,7 @@ internal sealed class InventoryTab : ITab
}
_listAsTrees = listAsTrees;
_lastUpdate = DateTime.Now;
}
catch (Exception e)
{