Skip to content

Commit 9b5be5f

Browse files
committed
Add period link tooltip; Release v2.5.2
1 parent 16f5dbd commit 9b5be5f

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "harker-bell",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"private": true,
55
"author": "Bowen Yin",
66
"scripts": {

src/views/Home.vue

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@
5454
<!-- LUNCH PERIOD -->
5555
<v-hover v-if="period.name && period.name.toLowerCase().indexOf('lunch') != -1" :key="pIndex" v-slot:default="{hover}">
5656
<!-- TODO: Find a way to extract id logic somewhere -->
57-
<v-sheet :id="j+'-'+gIndex+'-'+cIndex+'-'+pIndex" class="period border lunch caption text-center d-flex" :elevation="(sheetId == j+'-'+gIndex+'-'+cIndex+'-'+pIndex) ? 4 : (hover ? 2 : 0)" :height="period.duration+1" tile :style="{'z-index': (sheetId == j+'-'+gIndex+'-'+cIndex+'-'+pIndex || hover) ? 2 : 1}" ga-on="click" ga-event-category="lunch menu" ga-event-action="click" @click.stop="showMenu(j+'-'+gIndex+'-'+cIndex+'-'+pIndex, date)">
57+
<v-sheet :id="j+'-'+gIndex+'-'+cIndex+'-'+pIndex" class="period border lunch caption text-center d-flex" :elevation="(sheetId == j+'-'+gIndex+'-'+cIndex+'-'+pIndex) ? 4 : (hover ? 2 : 0)" :height="period.duration+1" tile :style="{'z-index': (sheetId == j+'-'+gIndex+'-'+cIndex+'-'+pIndex || hover) ? 2 : 1}" ga-on="click" ga-event-category="lunch menu" ga-event-action="click" @click.stop="showMenu(j+'-'+gIndex+'-'+cIndex+'-'+pIndex, date)" @mousemove.stop="onMouseMove">
5858
<v-layout :class="['content', {short: period.duration <= 50 || group.length > 1}]" column align-center justify-center>
5959
<div ref="periodNames">{{period.name}}</div>
6060
<!-- Part of v-if for text height: && $refs.periodNames[gIndex+cIndex+pIndex].offsetHeight < 28 -->
6161
<div v-if="period.start && period.duration >= 30" class="text-no-wrap text--secondary">{{period.start|formatTime}}&ndash;{{period.end|formatTime}}</div>
6262
<div v-if="period.duration >= 45 && time.utcNow >= period.start && time.utcNow <= period.end" class="hidden-print-only time-remain overline font-weight-medium">{{Math.ceil((period.end-time.utcNow)/$MS_PER_MIN)}} min. left</div>
63+
<div class="hovercard font-weight-medium">View menu</div>
6364
</v-layout>
6465
</v-sheet>
6566
</v-hover>
6667
<!-- REGULAR PERIOD -->
67-
<v-sheet v-else :key="pIndex" class="period border caption text-center d-flex" :color="getColor(period.name) && getColor(period.name)+' lighten-5'" :height="period.duration+1" tile :tag="settings.links[period.name] ? 'a' : 'div'" :href="settings.links[period.name] || false" target="_blank">
68+
<v-sheet v-else :key="pIndex" class="period regular-period border caption text-center d-flex" :color="getColor(period.name) && getColor(period.name)+' lighten-5'" :height="period.duration+1" tile :tag="settings.links[period.name] ? 'a' : 'div'" :href="settings.links[period.name] || false" target="_blank" @mousemove.stop="onMouseMove">
6869
<v-layout :class="['content', {short: period.duration <= 50 || group.length > 1}, getColor(period.name) && getColor(period.name)+'--text text--darken-4']" column align-center justify-center>
6970
<div ref="periodNames">
7071
{{period.name && settings.periodNames[period.name.substring(1, 2)-1] ? settings.periodNames[period.name.substring(1, 2)-1]+" ("+period.name+")" : period.name}}
@@ -73,6 +74,9 @@
7374
<!-- Part of v-if for text height: && $refs.periodNames[gIndex+cIndex+pIndex].offsetHeight < 28 -->
7475
<div v-if="period.start && period.duration >= 30" :class="['text-no-wrap', {'text--secondary': !getColor(period.name)}]">{{period.start|formatTime}}&ndash;{{period.end|formatTime}}</div>
7576
<div v-if="period.duration >= 50 && time.utcNow >= period.start && time.utcNow <= period.end" class="hidden-print-only time-remain overline font-weight-medium">{{Math.ceil((period.end-time.utcNow)/$MS_PER_MIN)}} min. left</div>
77+
<div class="hovercard font-weight-medium">
78+
Join class <v-icon dark small class="material-icons-outlined hovercard-icon">launch</v-icon>
79+
</div>
7680
</v-layout>
7781
</v-sheet>
7882
</template>
@@ -235,6 +239,13 @@ export default {
235239
return this.settings.periodColors[+period.substring(1, 2)-1];
236240
return undefined;
237241
},
242+
onMouseMove(e) {
243+
const hovercard = e.currentTarget.getElementsByClassName("hovercard")[0];
244+
if (hovercard) {
245+
hovercard.style.top = e.clientY-24+"px";
246+
hovercard.style.left = e.clientX+"px";
247+
}
248+
},
238249
/**
239250
* Shows the lunch menu for the lunch period element at the provided ID
240251
* @param {string} id ID of the lunch period element
@@ -370,6 +381,36 @@ export default {
370381
.v-application .overline.time-remain {
371382
letter-spacing: normal !important;
372383
}
384+
.hovercard {
385+
height: 24px;
386+
display: block;
387+
position: fixed;
388+
overflow: hidden;
389+
padding: 2px 6px 2px 7px;
390+
border-radius: 2px;
391+
z-index: 2;
392+
line-height: 20px !important;
393+
background-color: var(--v-accent-base);
394+
color: #FFFFFF;
395+
transition: visibility 75ms, opacity 75ms linear;
396+
opacity: 0;
397+
visibility: hidden;
398+
}
399+
div.regular-period .hovercard {
400+
display: none;
401+
}
402+
a.regular-period:hover .hovercard, .lunch:hover .hovercard {
403+
opacity: 0.8;
404+
visibility: visible;
405+
}
406+
.hovercard-icon {
407+
vertical-align: sub;
408+
}
409+
@media (hover: none) {
410+
.hovercard {
411+
display: none;
412+
}
413+
}
373414
</style>
374415
<style>
375416
.v-timeline-item__dot {

0 commit comments

Comments
 (0)