Skip to content
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

Add filter to reputation table #1986

Merged

Conversation

HenrikJannsen
Copy link
Contributor

Resolves #1983

Screenshot 2024-04-04 at 20 22 32 Screenshot 2024-04-04 at 20 22 26


private void addFilterMenuItem(ReputationSource reputationSource) {
String title = Res.get("user.reputation.source." + reputationSource.name());
StandardTable.FilterMenuItem<ReputationListView.ListItem> filterMenuItem = new StandardTable.FilterMenuItem<>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using var would be worth it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it but then item -> item.getReputationSources() does not recognize the type.

private final Label label = new Label();
private final ImageView defaultIcon, activeIcon;
private final ContextMenu contextMenu = new ContextMenu();
private ImageView buttonIcon;
@Nullable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were trying to standarize using Optional<> instead of Nullable. Is this still the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the View classes we did not apply that because the JavaFx classes have too much nullables itself.
In that case the field cannot be null as attachListeners is called in the constructor. I will remove the annotation therefore.

Comment on lines 62 to 73
long days = getAgeInDays(date);
long years = days / 365;
long ageInDays = days - years * 365;
String daysPostFix = ageInDays == 1 ? Res.get("temporal.day") : Res.get("temporal.days");
String dayString = ageInDays + " " + daysPostFix;
if (years > 0) {
String yearsPostFix = years == 1 ? Res.get("temporal.year") : Res.get("temporal.years");
String yearString = years + " " + yearsPostFix;
return yearString + ", " + dayString;
} else {
return dayString;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than manually handling plurals, can you use ChoiceFormat here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer to it. I looked into ChoiceFormat but it feels like a cumbersome API to me. Would rather impl. a custom convenience method to the Res class instead... e.g.
Res.maybePlural("temporal.year", years) which maps in the method depending on years to
Res.get("temporal.year.none", years)
Res.get("temporal.year.singular", years)
Res.get("temporal.year.plural", years)

The 0 value (none) case is mostly not needed in our case.
I think such an API would be more convenient to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See d801d1e

Copy link
Contributor

@djing-chan djing-chan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@djing-chan djing-chan merged commit f9be365 into bisq-network:main Apr 7, 2024
16 checks passed
@HenrikJannsen HenrikJannsen deleted the Add-filter-to-reputation-table branch April 7, 2024 13:37
@djing-chan djing-chan added this to the 2.0.3 milestone Apr 11, 2024
@djing-chan djing-chan added the ui label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add filter and meta data info to reputation table
3 participants