Skip to content

Commit e16069c

Browse files
Show group events on group page
1 parent 28da67d commit e16069c

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

SyncUp.Web/src/components/PageImageBanner.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
<v-chip v-if="badge1Text" class="mr-1" size="small" color="primary">
2222
{{ badge1Text }}
2323
</v-chip>
24-
<v-chip v-if="badge2Text" size="small" color="primary">
24+
<v-chip v-if="badge2Text" class="mr-1" size="small" color="primary">
2525
{{ badge2Text }}
2626
</v-chip>
27+
<v-chip v-if="badge3Text" size="small" color="primary">
28+
{{ badge3Text }}
29+
</v-chip>
2730
</v-col>
2831
<v-col align="right">
2932
<JoinButton
@@ -46,11 +49,13 @@ const props = withDefaults(
4649
isMember: boolean;
4750
badge1Text?: string | null;
4851
badge2Text?: string | null;
52+
badge3Text?: string | null;
4953
minHeight?: string;
5054
}>(),
5155
{
5256
badge1Text: null,
5357
badge2Text: null,
58+
badge3Text: null,
5459
minHeight: "300",
5560
},
5661
);

SyncUp.Web/src/services/GroupService.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { GroupUser, Post } from "@/models.g";
1+
import { Event, GroupUser, Post } from "@/models.g";
22
import {
3+
EventListViewModel,
34
GroupUserListViewModel,
45
GroupViewModel,
56
PostListViewModel,
@@ -10,12 +11,15 @@ export default class GroupService {
1011
public group: GroupViewModel;
1112
public isMember = ref(false);
1213

14+
public events = new EventListViewModel();
15+
private eventsDataSource = new Event.DataSources.EventsByDate();
16+
1317
public posts = new PostListViewModel();
1418
private postsDataSource = new Post.DataSources.PostsForGroup();
1519

1620
public groupUser = new GroupUserListViewModel();
1721
private groupUserDataSource = new GroupUser.DataSources.UsersForGroup();
18-
22+
1923
constructor(group: GroupViewModel) {
2024
this.group = group;
2125

@@ -28,10 +32,22 @@ export default class GroupService {
2832

2933
this.groupUserDataSource.groupId = this.group.groupId;
3034
this.groupUser.$dataSource = this.groupUserDataSource;
35+
36+
this.events.$params.filter = { groupId: this.group.groupId };
37+
this.events.$dataSource = this.eventsDataSource;
3138
},
3239
);
3340
}
3441

42+
public numberOfEvents = computed(() => {
43+
let postfix = "-- ";
44+
if (!this.events.$count.isLoading) {
45+
postfix = (this.events.$count.result ?? 0).toString();
46+
}
47+
48+
return postfix + " events";
49+
});
50+
3551
public numberOfPosts = computed(() => {
3652
let postfix = "-- ";
3753
if (!this.posts.$count.isLoading) {

SyncUp.Web/src/views/Group.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
:title="groupService.group.name!"
66
:description="groupService.group.description!"
77
:badge1-text="groupService.numberOfPosts.value"
8-
:badge2-text="groupService.numberOfUsers.value"
8+
:badge2-text="groupService.numberOfEvents.value"
9+
:badge3-text="groupService.numberOfUsers.value"
910
:is-member="groupService.isMember.value"
1011
@toggle-membership="groupService.toggleMembership()"
1112
/>
@@ -46,6 +47,9 @@
4647
<v-card-text> {{ truncateText(post.body) }} </v-card-text>
4748
</v-card>
4849
</c-loader-status>
50+
51+
<v-divider class="mt-5 mb-2" />
52+
<EventList :group-id="groupId" />
4953
</v-container>
5054
</template>
5155

@@ -70,6 +74,8 @@ groupService.group.$load(props.groupId).then(async () => {
7074
groupService.posts.$load();
7175
groupService.posts.$count();
7276
77+
groupService.events.$count();
78+
7379
groupService.groupUser.$count();
7480
});
7581

0 commit comments

Comments
 (0)