-
Notifications
You must be signed in to change notification settings - Fork 2
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 Entry Total Count Component #36
Conversation
Just wanted to add a note about localization: Since the count component relies on the translation string for proper pluralization of "entries", we should probably document how users can publish and customize the language files. We could add this to the
And then add a section in the documentation about customizing translations: Customizing TranslationsYou can publish the language files to customize the translations:
This will publish the language files to What do you think about adding this? |
Thank you for this! I've run Laravel Pint in the default settings in order to keep consistent formatting. I would like to add some tests before merging this and check if there is a more efficient way of doing this without requiring an extra Livewire component. Any specific reason you chose this implementation (eg. templating) instead of just using a public variable in the LivewireCollection component? |
Thank you that makes sense! I'll check over the weekend why the tests are failing and add some more, if you want to try you're welcome. If you do, remember to run Laravel Pint before you commit. |
I've made a few changes:
I've also added the language file as you suggested, will update the docs soon. Thanks for the help! |
Thanks for the update! Great to hear everything is working and that you've addressed the pagination edge case. The entries-updated event placement makes sense for future metadata extensibility. Glad I could help with this addition. If I think of any future additions or improvements, I'll submit them as pull requests. I'll be happy to assist with any future updates to the package. |
This PR adds a new entry count component to display the total number of entries matching the current filters in the Statamic Livewire Filters package. This feature improves user experience by providing immediate feedback about how many entries match their filter criteria.
I'd love to hear if this is something you're interested in adding to the package. If the approach and code look good to you, I'm happy to refactor anything needed and add proper documentation.
Overview
The component displays the total number of entries with proper pluralization support through Laravel's translation system. It updates reactively whenever filters are changed or search terms are modified.
Changes
LfCount
for displaying entry countsImplementation Details
New Components
LfCount.php
Livewire Component:count.blade.php
View:Translations
Added new translation key in
resources/lang/en/ui.php
:Event System
The count is updated through Livewire's event system:
Usage
Add the count component to your template:
The component will automatically receive updates whenever the entry count changes due to filtering or search operations.
Example Output
Examples of how the component displays different counts: