|
54 | 54 | <!-- LUNCH PERIOD --> |
55 | 55 | <v-hover v-if="period.name && period.name.toLowerCase().indexOf('lunch') != -1" :key="pIndex" v-slot:default="{hover}"> |
56 | 56 | <!-- 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"> |
58 | 58 | <v-layout :class="['content', {short: period.duration <= 50 || group.length > 1}]" column align-center justify-center> |
59 | 59 | <div ref="periodNames">{{period.name}}</div> |
60 | 60 | <!-- Part of v-if for text height: && $refs.periodNames[gIndex+cIndex+pIndex].offsetHeight < 28 --> |
61 | 61 | <div v-if="period.start && period.duration >= 30" class="text-no-wrap text--secondary">{{period.start|formatTime}}–{{period.end|formatTime}}</div> |
62 | 62 | <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> |
63 | 64 | </v-layout> |
64 | 65 | </v-sheet> |
65 | 66 | </v-hover> |
66 | 67 | <!-- 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"> |
68 | 69 | <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> |
69 | 70 | <div ref="periodNames"> |
70 | 71 | {{period.name && settings.periodNames[period.name.substring(1, 2)-1] ? settings.periodNames[period.name.substring(1, 2)-1]+" ("+period.name+")" : period.name}} |
|
73 | 74 | <!-- Part of v-if for text height: && $refs.periodNames[gIndex+cIndex+pIndex].offsetHeight < 28 --> |
74 | 75 | <div v-if="period.start && period.duration >= 30" :class="['text-no-wrap', {'text--secondary': !getColor(period.name)}]">{{period.start|formatTime}}–{{period.end|formatTime}}</div> |
75 | 76 | <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> |
76 | 80 | </v-layout> |
77 | 81 | </v-sheet> |
78 | 82 | </template> |
@@ -235,6 +239,13 @@ export default { |
235 | 239 | return this.settings.periodColors[+period.substring(1, 2)-1]; |
236 | 240 | return undefined; |
237 | 241 | }, |
| 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 | + }, |
238 | 249 | /** |
239 | 250 | * Shows the lunch menu for the lunch period element at the provided ID |
240 | 251 | * @param {string} id ID of the lunch period element |
@@ -370,6 +381,36 @@ export default { |
370 | 381 | .v-application .overline.time-remain { |
371 | 382 | letter-spacing: normal !important; |
372 | 383 | } |
| 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 | +} |
373 | 414 | </style> |
374 | 415 | <style> |
375 | 416 | .v-timeline-item__dot { |
|
0 commit comments