Making button red when already joined syncshell

This commit is contained in:
cake
2025-11-21 14:23:44 +01:00
parent b45c1a3aba
commit 1586a1d7cc

View File

@@ -87,7 +87,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
float availWidth = ImGui.GetContentRegionAvail().X; float availWidth = ImGui.GetContentRegionAvail().X;
float checkboxWidth = ImGui.CalcTextSize(checkboxLabel).X + ImGui.GetFrameHeight(); float checkboxWidth = ImGui.CalcTextSize(checkboxLabel).X + ImGui.GetFrameHeight();
float rightX = ImGui.GetCursorPosX() + availWidth - checkboxWidth; float rightX = ImGui.GetCursorPosX() + availWidth - checkboxWidth - 2.0f;
ImGui.SetCursorPosX(rightX); ImGui.SetCursorPosX(rightX);
ImGui.Checkbox(checkboxLabel, ref _compactView); ImGui.Checkbox(checkboxLabel, ref _compactView);
ImGui.EndGroup(); ImGui.EndGroup();
@@ -403,11 +403,14 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
} }
} }
else else
{
using (ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("DimRed")))
{ {
using (ImRaii.Disabled()) using (ImRaii.Disabled())
{ {
ImGui.Button(label, buttonSize); ImGui.Button(label, buttonSize);
} }
}
UiSharedService.AttachToolTip("Already a member or owner of this Syncshell."); UiSharedService.AttachToolTip("Already a member or owner of this Syncshell.");
} }
@@ -473,7 +476,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
ImGui.NewLine(); ImGui.NewLine();
} }
private async Task RefreshSyncshellsAsync(string gid = null) private async Task RefreshSyncshellsAsync(string? gid = null)
{ {
var syncshellBroadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts(); var syncshellBroadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts();
_currentSyncshells = [.. _pairManager.GroupPairs.Select(g => g.Key)]; _currentSyncshells = [.. _pairManager.GroupPairs.Select(g => g.Key)];
@@ -516,7 +519,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
if (gid != null && _recentlyJoined.Contains(gid)) if (gid != null && _recentlyJoined.Contains(gid))
{ {
_recentlyJoined.Remove(gid); _recentlyJoined.Clear();
} }
var previousGid = GetSelectedGid(); var previousGid = GetSelectedGid();