-
Notifications
You must be signed in to change notification settings - Fork 11
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
Notes Basic Frontend #960
Notes Basic Frontend #960
Changes from all commits
4cfb81b
d05304d
1d2e4a3
ff34593
dd90cba
bec8497
6ed0d7c
d73a1fc
03dd540
7f398e6
ba9c44d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,109 @@ | ||
<template> | ||
<div | ||
:class="{ | ||
'course--min': compact, | ||
conflict: isCourseConflict(courseObj.uniqueID), | ||
active: active, | ||
}" | ||
class="course" | ||
> | ||
<save-course-modal | ||
:courseCode="courseCode" | ||
@close-save-course-modal="closeSaveCourseModal" | ||
@save-course="saveCourse" | ||
@add-collection="addCollection" | ||
v-if="isSaveCourseOpen" | ||
/> | ||
<edit-color | ||
:editedColor="editedColor" | ||
@color-course="colorCourse" | ||
@color-subject="colorSubject" | ||
@close-edit-color="closeEditColorModal" | ||
v-if="isEditColorOpen" | ||
/> | ||
<div class="course-container"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it was my suggestion to rearrange, but I would just be careful with the class names here post-reshuffling. It looks like the CSS logic for some of the z-indices gets in a kerfuffle on account of this change, causing the modal to be hidden under the next course card. An easy fix would be to reduce the |
||
<div | ||
class="course-color" | ||
:style="cssVars" | ||
:class="{ | ||
'course-color--active': active, | ||
'course--min': compact, | ||
conflict: isCourseConflict(courseObj.uniqueID), | ||
active: active, | ||
}" | ||
class="course" | ||
> | ||
<img src="@/assets/images/dots/sixDots.svg" alt="" /> | ||
</div> | ||
<div class="course-content" @click="courseOnClick()"> | ||
<div class="course-main"> | ||
<div class="course-top"> | ||
<div class="course-left"> | ||
<div | ||
class="course-code" | ||
data-cyId="courseCode" | ||
:style="{ | ||
color: compact ? '#3d3d3d' : '#858585', | ||
}" | ||
> | ||
{{ courseObj.code }} | ||
<save-course-modal | ||
:courseCode="courseCode" | ||
@close-save-course-modal="closeSaveCourseModal" | ||
@save-course="saveCourse" | ||
@add-collection="addCollection" | ||
v-if="isSaveCourseOpen" | ||
/> | ||
<edit-color | ||
:editedColor="editedColor" | ||
@color-course="colorCourse" | ||
@color-subject="colorSubject" | ||
@close-edit-color="closeEditColorModal" | ||
v-if="isEditColorOpen" | ||
/> | ||
<div | ||
class="course-color" | ||
:style="cssVars" | ||
:class="{ | ||
'course-color--active': active, | ||
}" | ||
> | ||
<img src="@/assets/images/dots/sixDots.svg" alt="" /> | ||
</div> | ||
<div class="course-content" @click="courseOnClick()"> | ||
<div class="course-main"> | ||
<div class="course-top"> | ||
<div class="course-left"> | ||
<div | ||
class="course-code" | ||
data-cyId="courseCode" | ||
:style="{ | ||
color: compact ? '#3d3d3d' : '#858585', | ||
}" | ||
> | ||
{{ courseObj.code }} | ||
</div> | ||
<course-caution | ||
v-if="!isReqCourse && compact" | ||
:course="courseObj" | ||
:isCompactView="true" | ||
/> | ||
</div> | ||
<button | ||
v-if="!isReqCourse && isSemesterCourseCard" | ||
class="course-dotRow" | ||
@click="openMenu" | ||
> | ||
<img src="@/assets/images/dots/threeDots.svg" alt="open menu for course card" /> | ||
</button> | ||
<button | ||
v-else-if="!isReqCourse && !isSemesterCourseCard" | ||
class="course-trash" | ||
@click.stop="deleteCourseFromCollection" | ||
@mouseover="hoverTrashIcon" | ||
@mouseleave="unhoverTrashIcon" | ||
> | ||
<img :src="trashIcon" alt="delete course from collection" /> | ||
</button> | ||
</div> | ||
<div v-if="!compact" class="course-name">{{ courseObj.name }}</div> | ||
<div v-if="!compact" class="course-info"> | ||
<span class="course-credits">{{ creditString }}</span> | ||
<span v-if="semesterString" class="course-semesters">{{ semesterString }}</span> | ||
<course-caution | ||
v-if="!isReqCourse && compact" | ||
v-if="!isReqCourse && !isSchedGenCourse" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for reference could you explain what this change was motivated by? Doesn't look immediately relevant to the notes feature. |
||
:course="courseObj" | ||
:isCompactView="true" | ||
:isCompactView="false" | ||
/> | ||
</div> | ||
<button | ||
v-if="!isReqCourse && isSemesterCourseCard" | ||
class="course-dotRow" | ||
@click="openMenu" | ||
> | ||
<img src="@/assets/images/dots/threeDots.svg" alt="open menu for course card" /> | ||
</button> | ||
<button | ||
v-else-if="!isReqCourse && !isSemesterCourseCard" | ||
class="course-trash" | ||
@click.stop="deleteCourseFromCollection" | ||
@mouseover="hoverTrashIcon" | ||
@mouseleave="unhoverTrashIcon" | ||
> | ||
<img :src="trashIcon" alt="delete course from collection" /> | ||
</button> | ||
</div> | ||
<div v-if="!compact" class="course-name">{{ courseObj.name }}</div> | ||
<div v-if="!compact" class="course-info"> | ||
<span class="course-credits">{{ creditString }}</span> | ||
<span v-if="semesterString" class="course-semesters">{{ semesterString }}</span> | ||
<course-caution | ||
v-if="!isReqCourse && !isSchedGenCourse" | ||
:course="courseObj" | ||
:isCompactView="false" | ||
/> | ||
</div> | ||
</div> | ||
<course-menu | ||
v-if="menuOpen" | ||
:courseObj="courseObj" | ||
:semesterIndex="semesterIndex" | ||
:isCompact="compact" | ||
:courseColor="courseObj.color" | ||
:courseCode="courseObj.code" | ||
@open-note-modal="openNoteModal" | ||
@open-edit-color-modal="openEditColorModal" | ||
@delete-course="deleteCourscoe" | ||
@edit-course-credit="editCourseCredit" | ||
@open-save-course-modal="openSaveCourseModal" | ||
:getCreditRange="getCreditRange || []" | ||
v-click-outside="closeMenuIfOpen" | ||
/> | ||
</div> | ||
<course-menu | ||
v-if="menuOpen" | ||
:courseObj="courseObj" | ||
:semesterIndex="semesterIndex" | ||
:isCompact="compact" | ||
:courseColor="courseObj.color" | ||
:courseCode="courseObj.code" | ||
@open-edit-color-modal="openEditColorModal" | ||
@delete-course="deleteCourse" | ||
@edit-course-credit="editCourseCredit" | ||
@open-save-course-modal="openSaveCourseModal" | ||
:getCreditRange="getCreditRange || []" | ||
v-click-outside="closeMenuIfOpen" | ||
<Note | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow great work figuring out all of this tricky CSS stuff! |
||
v-if="isNoteVisible" | ||
class="note" | ||
:initialTranslateY="'-67px'" | ||
:expandedTranslateY="'-35px'" | ||
:width="'calc(102.8% - 10px)'" | ||
:color="cssVars['--bg-color']" | ||
:expand="expandNote" | ||
@toggle="handleToggleNote" | ||
/> | ||
</div> | ||
</template> | ||
|
@@ -110,9 +123,11 @@ import { clickOutside } from '@/utilities'; | |
import EditColor from '../Modals/EditColor.vue'; | ||
import trashGrayIcon from '@/assets/images/trash-gray.svg'; | ||
import trashRedIcon from '@/assets/images/trash.svg'; | ||
import Note from '../Notes/Note.vue'; | ||
|
||
export default defineComponent({ | ||
components: { CourseCaution, CourseMenu, EditColor, SaveCourseModal }, | ||
name: 'Course', | ||
components: { CourseCaution, CourseMenu, EditColor, SaveCourseModal, Note }, | ||
props: { | ||
courseObj: { type: Object as PropType<FirestoreSemesterCourse>, required: true }, | ||
compact: { type: Boolean, required: true }, | ||
|
@@ -156,6 +171,9 @@ export default defineComponent({ | |
deletingCourse: false, | ||
trashIcon: trashGrayIcon, // Default icon | ||
courseCode: '', | ||
isExpanded: false, | ||
isNoteVisible: false, | ||
expandNote: false, | ||
}; | ||
}, | ||
computed: { | ||
|
@@ -252,6 +270,17 @@ export default defineComponent({ | |
unhoverTrashIcon() { | ||
this.trashIcon = trashGrayIcon; | ||
}, | ||
handleToggleNote() { | ||
this.expandNote = !this.expandNote; | ||
}, | ||
openNoteModal() { | ||
this.isNoteVisible = true; | ||
this.menuOpen = false; | ||
this.expandNote = true; | ||
}, | ||
closeNote() { | ||
this.isNoteVisible = false; | ||
}, | ||
}, | ||
directives: { | ||
'click-outside': clickOutside, | ||
|
@@ -262,27 +291,31 @@ export default defineComponent({ | |
<style scoped lang="scss"> | ||
@import '@/assets/scss/_variables.scss'; | ||
|
||
.course-container { | ||
position: relative; | ||
padding-bottom: 20px; | ||
} | ||
|
||
.course { | ||
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.055); | ||
position: relative; | ||
z-index: 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the |
||
box-sizing: border-box; | ||
border-radius: 0.5rem; | ||
display: flex; | ||
flex-direction: row; | ||
background-color: $white; | ||
box-shadow: 0px 0px 10px 4px $boxShadowGray; | ||
position: relative; | ||
height: 5.625rem; | ||
touch-action: none; | ||
cursor: grab; | ||
|
||
&:hover { | ||
background: rgba(255, 255, 255, 0.15); | ||
background: $white; | ||
} | ||
|
||
&:active:hover { | ||
touch-action: none; | ||
cursor: grabbing; | ||
} | ||
|
||
&--min { | ||
height: 2.125rem; | ||
|
||
|
@@ -407,4 +440,20 @@ export default defineComponent({ | |
.active { | ||
border: 1px solid $yuxuanBlue; | ||
} | ||
.rectangle { | ||
position: absolute; | ||
left: 50%; | ||
transform: translateX(-50%) translateY(-65px); | ||
width: calc(106% - #{$colored-grabber-width}); | ||
height: 80px; | ||
background-color: #a8e6cf; | ||
border-radius: 12.49px; | ||
cursor: pointer; | ||
z-index: 0; | ||
transition: transform 0.3s ease; | ||
} | ||
|
||
.rectangle.expanded { | ||
transform: translateX(-50%) translateY(0px); | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
<template> | ||
<div class="courseMenu"> | ||
<div class="courseMenu-content"> | ||
<div class="courseMenu-section" @click="openNoteModal(courseObj.code)"> | ||
<div class="courseMenu-left"> | ||
<img | ||
class="courseMenu-icon" | ||
src="@/assets/images/noteIconSmall.svg" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we might change the image, but I believe the icon is a bit bigger than the other icons so it looks unaligned There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that is the case, we'd have to rearrange all the icons sidebar style to be centered not right-aligned and have a grid or dynamic offset calculation otherwise — I'd just find a new icon honestly. |
||
alt="note course icon" | ||
/> | ||
<span class="courseMenu-text">Note</span> | ||
</div> | ||
</div> | ||
<div | ||
class="courseMenu-section" | ||
v-if="saveCourseIconVisible" | ||
|
@@ -250,6 +260,9 @@ | |
} | ||
return creditArray; | ||
}, | ||
openNoteModal(courseCode: string) { | ||
Check failure on line 263 in src/components/Modals/CourseMenu.vue GitHub Actions / check
|
||
this.$emit('open-note-modal'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB: checks not relevant as this will be used in later PRs. |
||
}, | ||
}, | ||
}); | ||
</script> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to make a transparent version of this SVG that then gets filled with the color appropriate for that course note color, as otherwise would need a set of half-a-dozen-plus various arrow SVG icons for all the possible course colors.