-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor UI and State Management for Checkbox and Button Handling #130
Conversation
Updated the Claim Coins button to be enabled only if at least one checkbox for the specified stage is selected.
|
} | ||
@foreach (var project in projects) | ||
{ | ||
Stats.TryGetValue(project.ProjectInfo.ProjectIdentifier, out var stats); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice your IDE will align lines incorrectly, this line of code should be pushed one tab to the right, I think its an IDE issue
@@ -653,4 +688,31 @@ | |||
await _clipboardService.WriteTextAsync(trxData); | |||
StateHasChanged(); | |||
} | |||
|
|||
public struct UtxoKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already such a type its called Outpoint
use that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check it out 👍
@@ -85,7 +85,7 @@ | |||
@if (stageisActive) | |||
{ | |||
|
|||
<button class="btn @((noCoinsToClaim) ? "btn-light" : "btn-success")" disabled="@noCoinsToClaim" @onclick="() => ClaimCoinsCheckPassword(stage.StageIndex)"> | |||
<button class="btn @((noCoinsToClaim) ? "btn-light" : "btn-success")" disabled="@((noCoinsToClaim || !IsCheckboxSelectedForStage(stage.StageIndex)))" @onclick="() => ClaimCoinsCheckPassword(stage.StageIndex)"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be much simplified, when we expand another stage we clear the dictionary so there will only be items for a particular stage right? so you just need to check if the dictionary selectedUtxos
has items in it, correct me if I am wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noCoinsToClaim
is determined by investedCount == 0
or stage.StagePinner == true
.
there might be a scenario where selectedUtxos
has values for stage 2. In this case, the claimCoins
option for stage 1 won't be disabled.
providing the stageIndex
and the relevant method, we can handle the logic for each stage appropriately.
} | ||
else | ||
{ | ||
selected.Add(trxId, null); | ||
selectedUtxos[key] = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always be true, we wont have a case that the value is false right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the key means it no longer exists in the dictionary, so there isn't a false value associated with it?
if so then i think you're right
return Trxid == key.Trxid && Outputindex == key.Outputindex; | ||
} | ||
|
||
public override int GetHashCode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see you need to compile a hashcode for the dictionary unique key.
instead of using a new type it would be simpler to use a string of "trxid-index", but keep this as it is.
No description provided.