feat: batch notifications
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
"chart.js": "^4.4.1",
|
||||
"dayjs": "^1.11.6",
|
||||
"feather-icons": "^4.28.0",
|
||||
"frappe-ui": "^0.1.54",
|
||||
"frappe-ui": "^0.1.56",
|
||||
"lucide-vue-next": "^0.309.0",
|
||||
"markdown-it": "^14.0.0",
|
||||
"pinia": "^2.0.33",
|
||||
|
||||
@@ -141,7 +141,6 @@ function enrollStudent() {
|
||||
const enrollStudentResource = createResource({
|
||||
url: 'lms.lms.doctype.lms_enrollment.lms_enrollment.create_membership',
|
||||
})
|
||||
console.log(props.course)
|
||||
enrollStudentResource
|
||||
.submit({
|
||||
course: props.course.data.name,
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
|
||||
<TextEditor
|
||||
class="mt-5"
|
||||
class="mt-5 reply-editor"
|
||||
:content="newReply"
|
||||
:mentions="mentionUsers"
|
||||
@change="(val) => (newReply = val)"
|
||||
@@ -151,7 +151,6 @@ const newReplyResource = createResource({
|
||||
})
|
||||
|
||||
const mentionUsers = computed(() => {
|
||||
console.log(allUsers.data['jannat@frappe.io'])
|
||||
let users = Object.values(allUsers.data).map((user) => {
|
||||
return {
|
||||
value: user.name,
|
||||
|
||||
@@ -63,13 +63,14 @@
|
||||
/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { createResource, Button, TextEditor } from 'frappe-ui'
|
||||
import { createResource, Button } from 'frappe-ui'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
import { timeAgo } from '../utils'
|
||||
import { ref, onMounted, inject } from 'vue'
|
||||
import DiscussionReplies from '@/components/DiscussionReplies.vue'
|
||||
import DiscussionModal from '@/components/Modals/DiscussionModal.vue'
|
||||
import { MessageSquareText } from 'lucide-vue-next'
|
||||
import { getScrollContainer } from '@/utils/scrollContainer'
|
||||
|
||||
const showTopics = ref(true)
|
||||
const currentTopic = ref(null)
|
||||
@@ -102,6 +103,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
scrollToBottom: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -110,8 +115,19 @@ onMounted(() => {
|
||||
socket.on('new_discussion_topic', (data) => {
|
||||
topics.refresh()
|
||||
})
|
||||
|
||||
if (props.scrollToBottom) {
|
||||
setTimeout(() => {
|
||||
scrollToEnd()
|
||||
}, 0)
|
||||
}
|
||||
})
|
||||
|
||||
const scrollToEnd = () => {
|
||||
let scrollContainer = getScrollContainer()
|
||||
scrollContainer.scrollTop = scrollContainer.scrollHeight
|
||||
}
|
||||
|
||||
const topics = createResource({
|
||||
url: 'lms.lms.utils.get_discussion_topics',
|
||||
cache: ['topics', props.doctype, props.docname],
|
||||
|
||||
@@ -34,9 +34,7 @@ const props = defineProps({
|
||||
default: 'Tags',
|
||||
},
|
||||
})
|
||||
console.log(props.modelValue)
|
||||
let tags = ref(props.modelValue)
|
||||
console.log(tags.value)
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
let newTag = ref('')
|
||||
|
||||
|
||||
@@ -66,9 +66,10 @@
|
||||
<Discussions
|
||||
doctype="LMS Batch"
|
||||
:docname="batch.data.name"
|
||||
title="Discussions"
|
||||
:title="__('Discussions')"
|
||||
:key="batch.data.name"
|
||||
:singleThread="true"
|
||||
:scrollToBottom="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<script setup>
|
||||
import { computed, inject } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { BookOpen, Calendar, Clock } from 'lucide-vue-next'
|
||||
import { BookOpen, Clock } from 'lucide-vue-next'
|
||||
import { formatTime } from '@/utils'
|
||||
import { Breadcrumbs, createResource } from 'frappe-ui'
|
||||
import CourseCard from '@/components/CourseCard.vue'
|
||||
|
||||
@@ -115,10 +115,10 @@ const readNotifications = createListResource({
|
||||
})
|
||||
|
||||
const markAsRead = createResource({
|
||||
url: 'frappe.desk.doctype.notification_log.notification_log.mark_as_read',
|
||||
url: 'lms.lms.api.mark_as_read',
|
||||
makeParams(values) {
|
||||
return {
|
||||
docname: values.name,
|
||||
name: values.name,
|
||||
}
|
||||
},
|
||||
onSuccess(data) {
|
||||
@@ -128,7 +128,7 @@ const markAsRead = createResource({
|
||||
})
|
||||
|
||||
const markAllAsRead = createResource({
|
||||
url: 'frappe.desk.doctype.notification_log.notification_log.mark_all_as_read',
|
||||
url: 'lms.lms.api.mark_all_as_read',
|
||||
onSuccess(data) {
|
||||
unReadNotifications.reload()
|
||||
readNotifications.reload()
|
||||
|
||||
@@ -43,7 +43,6 @@ export class Quiz {
|
||||
}
|
||||
|
||||
save(blockContent) {
|
||||
console.log(blockContent)
|
||||
return {
|
||||
quiz: this.data.quiz,
|
||||
}
|
||||
|
||||
11
frontend/src/utils/scrollContainer.js
Normal file
11
frontend/src/utils/scrollContainer.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export function scrollTo(...options) {
|
||||
if (!options || options.length === 0) return
|
||||
const container = getScrollContainer()
|
||||
if (!container) return
|
||||
container.scrollTo(...options)
|
||||
}
|
||||
|
||||
export function getScrollContainer() {
|
||||
// window.scrollContainer is reference to the scroll container in DesktopLayout.vue and MobileLayout.vue
|
||||
return window.scrollContainer
|
||||
}
|
||||
Reference in New Issue
Block a user