Skip to content

Added selected connection count#1020

Merged
peterwilsoncc merged 32 commits intodevelopfrom
feature/connection-count
Mar 7, 2023
Merged

Added selected connection count#1020
peterwilsoncc merged 32 commits intodevelopfrom
feature/connection-count

Conversation

@roshniahuja
Copy link
Copy Markdown
Contributor

@roshniahuja roshniahuja commented Feb 21, 2023

Fixes for issue #592

Description of the Change

Issue mentioned URL - #592

Added selected connection count

Closes

How to test the Change

To test this feature - Need to select connection from dropdown and it will increase count in Selected connection

Changelog Entry

Added - Show count of selected connections in Push menu.

Credits

Props @roshniahuja

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@roshniahuja roshniahuja requested a review from a team as a code owner February 21, 2023 10:03
@roshniahuja roshniahuja requested review from Sidsector9 and removed request for a team February 21, 2023 10:03
@roshniahuja
Copy link
Copy Markdown
Contributor Author

@peterwilsoncc,

I have few ESLint errors and I already tried to resolve by installing ESLint and Prettier ESLint extension but still nothing works so If anyone can take a look then it will be appreciated.

@peterwilsoncc
Copy link
Copy Markdown
Collaborator

@roshniahuja I've pushed 22a5031 which fixes the linting errors.

Getting the lints set up in your IDE can be luck as much as anything else. If you use VS Code, I can share my extensions with you if you reach out via Slack.

Copy link
Copy Markdown
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

A couple of inline notes about consistency with layout/spacing within the brackets.

I'm wondering if it would be better to use the string Selected connections (%d) to ensure the strings are translatable in to all language formats.

The HTML could become:

<header class="with-selected">
	<span class="selected-connections-text"><?php esc_html_e( 'Selected connections', 'distributor' ); ?></span>
	<button class="button button-link selectno-connections unavailable"><?php esc_html_e( 'Clear', 'distributor' ); ?></button>
</header>

And the text in selected-connections-text replaced in full via the JavaScript. @ravinderk, do you have an opinion on what would be best?

@jeffpaul jeffpaul linked an issue Feb 23, 2023 that may be closed by this pull request
1 task
@jeffpaul jeffpaul added this to the 2.0.0 milestone Feb 23, 2023
@roshniahuja roshniahuja added needs:code-review This requires code review. and removed help wanted labels Mar 2, 2023
Copy link
Copy Markdown
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

This looks great, thank you!

One minor note about translator comments for _n but otherwise it looks good.

delete selectedConnections[ type + id ];

selectedText = sprintf(
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
/* translators: %d: Number of selected connections. */

For _n translator notes are a little odd, the comment applies to both strings as the placeholders need to be identical.


const element = event.currentTarget.cloneNode( true );
selectedText = sprintf(
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
/* translators: %d: Number of selected connections. */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment Updated.

element.appendChild( removeLink );
element.classList = 'added-connection';
selectedText = sprintf(
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
/* translators: %d: Number of selected connections. */


delete selectedConnections[ type + id ];
selectedText = sprintf(
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
/* translators: %d: Number of selected connections. */

delete selectedConnections[ type + id ];

selectedText = sprintf(
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */
/* translators: %d: Number of selected connections. */

Copy link
Copy Markdown
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

@peterwilsoncc peterwilsoncc merged commit 7744348 into develop Mar 7, 2023
@peterwilsoncc peterwilsoncc deleted the feature/connection-count branch March 7, 2023 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show count of selected connections in Push menu

4 participants