Update Groups components

This commit is contained in:
Daniel Supernault 2024-10-05 23:57:48 -06:00
parent b89896052c
commit 3c09a6ed2a
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
5 changed files with 83 additions and 69 deletions

View file

@ -209,8 +209,8 @@
permissionChecked: false, permissionChecked: false,
membershipCategories: [ membershipCategories: [
{ key: 'Public', value: 'public' }, { key: 'Public', value: 'public' },
{ key: 'Private', value: 'private' }, // { key: 'Private', value: 'private' },
{ key: 'Local', value: 'local' }, // { key: 'Local', value: 'local' },
], ],
} }
}, },

View file

@ -343,7 +343,8 @@
childReplyContent: null, childReplyContent: null,
postingChildComment: false, postingChildComment: false,
loadingChildComments: false, loadingChildComments: false,
replyChildMinId: undefined replyChildMinId: undefined,
replyCursorId: null
} }
}, },
@ -584,6 +585,7 @@
} }
this.replyChildId = status.id; this.replyChildId = status.id;
this.replyCursorId = status.id
this.replyChildIndex = index; this.replyChildIndex = index;
if(!status.hasOwnProperty('replies_loaded') || !status.replies_loaded) { if(!status.hasOwnProperty('replies_loaded') || !status.replies_loaded) {
@ -591,7 +593,9 @@
this.fetchChildReplies(status, index); this.fetchChildReplies(status, index);
}); });
} else { } else {
this.$nextTick(() => {
this.fetchChildReplies(status, index);
});
} }
}, },
@ -600,7 +604,7 @@
params: { params: {
gid: this.groupId, gid: this.groupId,
sid: status.id, sid: status.id,
cid: 1, cid: this.replyCursorId,
limit: 3 limit: 3
} }
}).then(res => { }).then(res => {

View file

@ -17,6 +17,7 @@
:profile="profile" :profile="profile"
:showGroupHeader="showGroupHeader" :showGroupHeader="showGroupHeader"
:showGroupChevron="showGroupChevron" :showGroupChevron="showGroupChevron"
v-on:delete="statusDeleted"
/> />
<div> <div>

View file

@ -1,32 +1,28 @@
<template> <template>
<div class="col-12 col-md-9" style="overflow:hidden"> <div class="col-12 col-md-9" style="overflow:hidden">
<div class="row h-100 bg-light justify-content-center"> <div class="row bg-light justify-content-center">
<div class="col-12 col-md-10 col-lg-7"> <div class="col-12 flex-shrink-1">
<div v-if="!initalLoad"> <div class="my-4 px-3">
<p class="text-center mt-5 pt-5 font-weight-bold">Loading...</p> <p class="h1 font-weight-bold mb-1">Groups Feed</p>
<p class="lead text-muted mb-0">Recent posts from your groups</p>
</div> </div>
<div v-else class="px-5"> </div>
<div v-if="emptyFeed"> </div>
<div class="jumbotron mt-5"> <div class="row h-100 bg-light justify-content-center">
<h1 class="display-4">Hello 👋</h1> <div class="col-12 col-md-10 col-lg-6">
<h3 class="font-weight-light">Welcome to Pixelfed Groups!</h3> <div v-if="emptyFeed" class="mt-5">
<h1 class="font-weight-bold">Welcome to Pixelfed Groups!</h1>
<p class="lead">Groups are a way to participate in like minded communities and topics.</p> <p class="lead">Groups are a way to participate in like minded communities and topics.</p>
<hr class="my-4"> <hr class="my-4">
<p>Anyone can create and manage their own group as long as it abides by our <a href="#">community guidelines</a>.</p> <p>Anyone can create and manage their own group as long as it abides by our <a href="/site/kb/community-guidelines" target="_blank">community guidelines</a>.</p>
<p class="text-center mb-0"> <p class="text-center mb-0">
<router-link to="/groups/discover" class="btn btn-primary btn-lg rounded-pill"> <router-link to="/groups/discover" class="btn btn-primary btn-lg rounded-pill">
Discover Groups Discover Groups
</router-link> </router-link>
</p> </p>
</div> </div>
</div>
<div v-else> <div v-else>
<div class="my-4">
<p class="h1 font-weight-bold mb-1">Groups Feed</p>
<p class="lead text-muted mb-0">Recent posts from your groups</p>
</div>
<div class="my-3"> <div class="my-3">
<group-status <group-status
v-for="(status, index) in feed" v-for="(status, index) in feed"
@ -50,15 +46,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="col-12 col-md-4">
<div class="mt-5 media align-items-center">
<div class="mr-3">
<i class="fas fa-info-circle fa-2x text-lighter"></i>
</div>
<p class="media-body text-muted mb-0 font-weight-light">Groups are in beta, some <a href="#" class="font-weight-bold">limitations</a> apply.</p>
</div>
</div> -->
</div>
</div> </div>
</template> </template>

View file

@ -110,12 +110,12 @@
<span class="fas fa-ellipsis-h text-lighter"></span> <span class="fas fa-ellipsis-h text-lighter"></span>
</button> </button>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">View Post</a> <a class="dropdown-item" :href="statusUrl()">View Post</a>
<a class="dropdown-item" href="#">View Profile</a> <a class="dropdown-item" :href="profileUrl()">View Profile</a>
<a class="dropdown-item" href="#">Copy Link</a> <!-- <a class="dropdown-item" href="#">Copy Link</a> -->
<a class="dropdown-item" href="#" @click.prevent="sendReport()">Report</a> <a class="dropdown-item" href="#" @click.prevent="sendReport()">Report</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="#">Delete</a> <a class="dropdown-item text-danger" href="#" @click.prevent="onDelete()">Delete</a>
</div> </div>
</div> </div>
<!-- <button class="btn btn-link text-dark py-0" type="button" @click="ctxMenu()"> <!-- <button class="btn btn-link text-dark py-0" type="button" @click="ctxMenu()">
@ -171,12 +171,12 @@
return App.util.format.count(count); return App.util.format.count(count);
}, },
statusUrl(status) { statusUrl() {
return '/groups/' + status.gid + '/p/' + status.id; return '/groups/' + this.status.gid + '/p/' + this.status.id;
}, },
profileUrl(status) { profileUrl() {
return '/groups/' + status.gid + '/user/' + status.account.id; return '/groups/' + this.status.gid + '/user/' + this.status.account.id;
}, },
timestampFormat(timestamp) { timestampFormat(timestamp) {
@ -268,6 +268,28 @@
swal("Cancelled", "Your report was not submitted.", "error"); swal("Cancelled", "Your report was not submitted.", "error");
} }
}); });
},
onDelete() {
swal({
title: "Delete Post Confirmation",
text: 'Are you sure you want to delete this post?',
icon: "warning",
dangerMode: true,
buttons: true
}).then((confirm) => {
if(confirm) {
axios.post('/api/v0/groups/status/delete', {
id: this.status.id,
gid: this.status.gid,
})
.then(res => {
this.$emit('delete', this.status)
})
.catch(err => {
console.log(err)
})
}
});
} }
} }
} }