Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simon draggable saved courses #952

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions src/components/Modals/CollectionsSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,26 @@
:key="index2"
class="dropdown-item-content"
>
<course
:courseObj="course"
:isReqCourse="false"
:compact="false"
:active="false"
:isSemesterCourseCard="false"
@delete-course-from-collection="deleteCourseFromCollection(collection, course)"
/>
<draggable
:group="{ name: 'draggable-semester-courses', pull: 'clone', put: false }"
:modelValue="[course]"
:clone="cloneCourse"
item-key="code"
>
<template #item="{ element: templatedCourse }">
<course
:courseObj="templatedCourse"
:isReqCourse="false"
:compact="false"
:active="false"
:isSemesterCourseCard="false"
class="collection-course"
@delete-course-from-collection="
deleteCourseFromCollection(collection, templatedCourse)
"
/>
</template>
</draggable>
</div>
</div>
<div class="separator"></div>
Expand All @@ -56,15 +68,16 @@

<script lang="ts">
import { defineComponent } from 'vue';
// import draggable from 'vuedraggable'; // implement later with backend
import draggable from 'vuedraggable';
import Course from '@/components/Course/Course.vue';
import DropDownArrow from '@/components/DropDownArrow.vue';
import { isPlaceholderCourse, isFirestoreSemesterCourse } from '@/utilities';
import store from '@/store';
import { incrementUniqueID } from '@/global-firestore-data';

export default defineComponent({
components: {
// draggable, // implement later with backend
draggable,
Course,
DropDownArrow,
},
Expand Down Expand Up @@ -129,6 +142,9 @@ export default defineComponent({
deleteCourseFromCollection(collection: string, course: FirestoreSemesterCourse) {
this.$emit('delete-course-from-collection', collection, course.code);
},
cloneCourse(courseWithDummyUniqueID: FirestoreSemesterCourse): FirestoreSemesterCourse {
return { ...courseWithDummyUniqueID, uniqueID: incrementUniqueID() };
},
},
});
</script>
Expand Down Expand Up @@ -233,4 +249,14 @@ export default defineComponent({
:deep(.arrow-up) {
margin-top: 3px;
}

.collection-course {
touch-action: none;
cursor: grab;

&:active:hover {
touch-action: none;
cursor: grabbing;
}
}
</style>
Loading
Loading