0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Further tweaks and refactoring to engagement bar

- Made a new function that checks if stubs are needed per tab
- Renamed the check for pagination to be a little more clear
- Made sure the pagination block is always to the right
- Made sure the pagination buttons don't show when there is no pagination

refs https://github.com/TryGhost/Team/issues/2149
This commit is contained in:
James Morris 2022-10-25 16:59:29 +01:00
parent 66e42c8b29
commit d4e336dc2a
2 changed files with 32 additions and 25 deletions

View file

@ -76,7 +76,7 @@
{{/let}}
{{/each}}
{{#if (not (compute (fn this.isPaginationNeeded eventsFetcher)))}}
{{#if (compute (fn this.areStubsNeeded eventsFetcher))}}
{{#let (compute (fn this.getAmountOfStubs eventsFetcher)) as |stubs|}}
{{#each stubs}}
<div class="gh-dashboard-list-item"></div>
@ -94,36 +94,38 @@
{{svg-jar "filter"}}
See members
</LinkTo>
{{else}}
<div></div>
{{/if}}
<div class="gh-post-activity-feed-pagination">
{{#if (compute (fn this.isPaginationNeeded eventsFetcher))}}
{{#if (compute (fn this.isPaginationNotNeeded eventsFetcher))}}
Showing {{eventsFetcher.totalEvents}} in total
{{else}}
Showing {{eventsFetcher.previousEvents}}-{{eventsFetcher.shownEvents}} of {{eventsFetcher.totalEvents}}
<div class="gh-post-activity-feed-pagination-group">
<button
class="gh-post-activity-feed-pagination-button gh-post-activity-feed-prev-button"
type="button"
title="Previous page"
disabled={{compute (fn this.isPreviousButtonDisabled eventsFetcher)}}
{{on "click" eventsFetcher.loadPreviousPage}}
>
{{svg-jar "arrow-left-pagination"}}
</button>
<button
class="gh-post-activity-feed-pagination-button gh-post-activity-feed-next-button"
type="button"
title="Next page"
disabled={{compute (fn this.isNextButtonDisabled eventsFetcher)}}
{{on "click" eventsFetcher.loadNextPage}}
>
{{svg-jar "arrow-right-pagination"}}
</button>
</div>
{{/if}}
<div class="gh-post-activity-feed-pagination-group">
<button
class="gh-post-activity-feed-pagination-button gh-post-activity-feed-prev-button"
type="button"
title="Previous page"
disabled={{compute (fn this.isPreviousButtonDisabled eventsFetcher)}}
{{on "click" eventsFetcher.loadPreviousPage}}
>
{{svg-jar "arrow-left-pagination"}}
</button>
<button
class="gh-post-activity-feed-pagination-button gh-post-activity-feed-next-button"
type="button"
title="Next page"
disabled={{compute (fn this.isNextButtonDisabled eventsFetcher)}}
{{on "click" eventsFetcher.loadNextPage}}
>
{{svg-jar "arrow-right-pagination"}}
</button>
</div>
</div>
</div>
</div>

View file

@ -69,7 +69,12 @@ export default class PostActivityFeed extends Component {
}
@action
isPaginationNeeded({totalEvents}) {
isPaginationNotNeeded({totalEvents}) {
return (totalEvents <= this._pageSize);
}
@action
areStubsNeeded({totalEvents}) {
return totalEvents > this._pageSize || this.args.eventType === 'feedback';
}
}