Skip to content

Commit 712abe1

Browse files
committed
feat: render pagination component
1 parent 8c60753 commit 712abe1

File tree

7 files changed

+743
-28
lines changed

7 files changed

+743
-28
lines changed

app/controllers/me/pending-invites.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Controller from '@ember/controller';
2+
import { tracked } from '@glimmer/tracking';
3+
4+
import { reads } from 'macro-decorators';
5+
6+
import { pagination } from '../../utils/pagination';
7+
8+
export default class PendingInvitesController extends Controller {
9+
queryParams = ['page', 'per_page', 'sort'];
10+
@tracked page = '1';
11+
@tracked per_page = 50;
12+
@tracked sort = 'alpha';
13+
14+
@reads('model.meta.total') totalItems;
15+
@pagination() pagination;
16+
17+
get currentSortBy() {
18+
if (this.sort === 'downloads') {
19+
return 'All-Time Downloads';
20+
} else if (this.sort === 'recent-downloads') {
21+
return 'Recent Downloads';
22+
} else if (this.sort === 'recent-updates') {
23+
return 'Recent Updates';
24+
} else if (this.sort === 'new') {
25+
return 'Newly Added';
26+
} else {
27+
return 'Alphabetical';
28+
}
29+
}
30+
}

app/routes/me/pending-invites.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import AuthenticatedRoute from '../-authenticated-route';
55
export default class PendingInvitesRoute extends AuthenticatedRoute {
66
@service store;
77

8+
queryParams = {
9+
page: { refreshModel: true },
10+
sort: { refreshModel: true },
11+
};
12+
813
model() {
914
return this.store.findAll('crate-owner-invite');
1015
}

app/styles/me/pending-invites.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.list {
22
background: white;
3+
margin-bottom: 2rem;
34
}
45

56
.row {

app/templates/me/pending-invites.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
<p local-class="row" data-test-empty-state>You don't seem to have any pending invitations.</p>
1010
{{/each}}
1111
</div>
12+
13+
<Pagination @pagination={{this.pagination}} />

0 commit comments

Comments
 (0)