Skip to content

Commit

Permalink
URL copy (router prep)
Browse files Browse the repository at this point in the history
  • Loading branch information
Acumane committed Apr 14, 2024
1 parent 39b2b42 commit 386d7bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/assets/icons/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 29 additions & 6 deletions src/components/home/PopUpItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
import moment from 'moment-timezone'
import { average } from 'color.js'
import InfoIcon from '@/assets/icons/info.svg?component'
import CopyIcon from '@/assets/icons/copy.svg?component'
import tinycolor from "tinycolor2"
</script>

<template>
<!-- HTML for the popup -->
<div id="popup">
<CopyIcon id="copy" @click="copyURL"/>
<div id="breadcrumbs">
{{ global.bldg.replace(/_/g, ' ') }}
<span v-if="global.bldg"> > Floor {{ global.floor }}</span>
<span v-if="!noneSelected()"> > Room {{ global.room }}</span>
<span v-if="global.bldg"> <span id="slash">/</span> Floor {{ global.floor }}</span>
<span v-if="!noneSelected()"> <span id="slash"> /</span> Room {{ global.room }}</span>
</div>
<div id="fadeout"></div>
<div v-if="global.bldg && getBldg()" class="body">
Expand Down Expand Up @@ -247,6 +248,10 @@ export default {
let hist = this.getBldg().meta.hist
if (hist === "") hist = this.getBldg().meta.name.toLowerCase().replace(/ /g, "-")
return hist // for case: false
},
copyURL() {
navigator.clipboard.writeText(window.location.href)
this.$showToast({type: 'info', title: 'Link to location copied', lasts: 1000})
}
}
}
Expand Down Expand Up @@ -277,14 +282,18 @@ export default {
#breadcrumbs {
padding: 10px 0px 0px 20px;
color: rgb(0, 0, 0);
font-size: x-large;
font-weight: 600;
height: 50px;
height: 45px;
border-radius: 12px 12px 0 0;
background-color: white;
}
#slash {
font-weight: 500;
color: #000000a0;
}
#fadeout {
background-image: linear-gradient(white, transparent);
position:relative;
Expand All @@ -305,7 +314,7 @@ export default {
.body {
position: absolute;
top: 50px;
top: 45px;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
Expand Down Expand Up @@ -409,6 +418,20 @@ tr:nth-child(even) {
height: 25px;
}
#copy {
fill: black;
width: 28px;
z-index: 2;
position: absolute;
top: 12px;
right: 22px;
transition: all 0.2s;
}
#copy:hover {
fill: #000000b0;
}
li {
line-height: 1.5;
}
Expand Down

0 comments on commit 386d7bd

Please sign in to comment.