fix: misc issues

This commit is contained in:
Jannat Patel
2024-07-10 16:13:28 +05:30
parent 2ecc07ee58
commit 8164526763
17 changed files with 180 additions and 57 deletions

View File

@@ -18,20 +18,28 @@
</div>
<div
v-if="sidebarSettings.data?.web_pages?.length || isModerator"
class="mt-4 pt-1 border-t border-gray-200"
class="pt-1"
>
<div
v-if="isModerator"
class="flex items-center justify-between pr-2"
:class="isSidebarCollapsed ? 'pl-3' : 'pl-5'"
class="flex items-center justify-between pr-2 cursor-pointer"
:class="isSidebarCollapsed ? 'pl-3' : 'pl-4'"
@click="showWebPages = !showWebPages"
>
<span
<div
v-if="!isSidebarCollapsed"
class="text-sm font-medium text-gray-600"
class="flex items-center text-sm font-medium text-gray-600"
>
{{ __('Web Pages') }}
</span>
<Button variant="ghost" @click="openPageModal()">
<span class="grid h-5 w-6 flex-shrink-0 place-items-center">
<ChevronRight
class="h-4 w-4 stroke-1.5 text-gray-900 transition-all duration-300 ease-in-out"
:class="{ 'rotate-90': showWebPages }"
/>
</span>
<span class="ml-2">
{{ __('Web Pages') }}
</span>
</div>
<Button v-if="isModerator" variant="ghost" @click="openPageModal()">
<template #icon>
<Plus class="h-4 w-4 text-gray-700 stroke-1.5" />
</template>
@@ -39,7 +47,8 @@
</div>
<div
v-if="sidebarSettings.data?.web_pages?.length"
class="flex flex-col"
class="flex flex-col transition-all duration-300 ease-in-out"
:class="showWebPages ? 'block' : 'hidden'"
>
<SidebarLink
v-for="link in sidebarSettings.data.web_pages"
@@ -87,7 +96,7 @@ import { ref, onMounted, inject, watch } from 'vue'
import { getSidebarLinks } from '../utils'
import { usersStore } from '@/stores/user'
import { sessionStore } from '@/stores/session'
import { Plus } from 'lucide-vue-next'
import { ChevronRight, Plus } from 'lucide-vue-next'
import { createResource, Button } from 'frappe-ui'
import PageModal from '@/components/Modals/PageModal.vue'
@@ -99,6 +108,7 @@ const sidebarLinks = ref(getSidebarLinks())
const showPageModal = ref(false)
const isModerator = ref(false)
const pageToEdit = ref(null)
const showWebPages = ref(false)
onMounted(() => {
socket.on('publish_lms_notifications', (data) => {

View File

@@ -41,7 +41,7 @@
</span>
</div>
<router-link
v-if="user?.data?.is_moderator"
v-if="isModerator || isStudent"
:to="{
name: 'Batch',
params: {
@@ -51,7 +51,7 @@
>
<Button variant="solid" class="w-full mt-4">
<span>
{{ __('Manage Batch') }}
{{ isModerator ? __('Manage Batch') : __('Visit Batch') }}
</span>
</Button>
</router-link>
@@ -65,7 +65,7 @@
}"
v-else-if="batch.data.paid_batch && batch.data.seats_left"
>
<Button class="w-full mt-4" variant="solid">
<Button v-if="!isStudent" class="w-full mt-4" variant="solid">
<span>
{{ __('Register Now') }}
</span>
@@ -79,7 +79,7 @@
{{ __('Enroll Now') }}
</Button>
<router-link
v-if="user?.data?.is_moderator"
v-if="isModerator"
:to="{
name: 'BatchCreation',
params: {
@@ -117,4 +117,12 @@ const seats_left = computed(() => {
}
return null
})
const isStudent = computed(() => {
return props.batch.data?.students?.includes(user.data?.name)
})
const isModerator = computed(() => {
return user.data?.is_moderator
})
</script>

View File

@@ -190,7 +190,8 @@ const updateLessonIndex = createResource({
makeParams(values) {
return {
lesson: values.lesson,
chapter: values.chapter,
sourceChapter: values.sourceChapter,
targetChapter: values.targetChapter,
idx: values.idx,
}
},
@@ -217,13 +218,10 @@ const getCurrentChapter = () => {
}
const updateOutline = (e) => {
console.log(e)
const sourceChapter = e.from.dataset.chapter
const targetChapter = e.to.dataset.chapter
const lesson = e.item.__draggable_context.element.name
updateLessonIndex.submit({
lesson: lesson,
chapter: sourceChapter,
lesson: e.item.__draggable_context.element.name,
sourceChapter: e.from.dataset.chapter,
targetChapter: e.to.dataset.chapter,
idx: e.newIndex,
})
}

View File

@@ -20,7 +20,7 @@
</slot>
</Tooltip>
<span
class="flex-shrink-0 text-base duration-300 ease-in-out"
class="flex-shrink-0 text-sm duration-300 ease-in-out"
:class="
isCollapsed
? 'ml-0 w-0 overflow-hidden opacity-0'
@@ -38,12 +38,12 @@
>
<component
:is="icons['Edit']"
class="h-3 w-3 stroke-1.5 text-gray-800"
class="h-3 w-3 stroke-1.5 text-gray-700"
@click.stop="openModal(link)"
/>
<component
:is="icons['X']"
class="h-3 w-3 stroke-1.5 text-gray-800"
class="h-3 w-3 stroke-1.5 text-gray-700"
@click.stop="deletePage(link)"
/>
</div>