Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 61x 61x 61x 61x 61x 61x 1x 1x 61x 61x 61x 61x 1x 1x 1x 1x 3x 3x 3x 1x 1x 1x 1x 1x 3x 2x 2x 3x | <template>
<span class="support-email">
<a
:href="mailtoHref"
class="support-email-link"
data-testid="support-email-link"
>
{{ displayText || address }}
</a>
<!-- SB-1461: a bare mailto: does nothing on a desktop browser with no mail
client configured. Give desktop users a webmail compose link and the
address on the clipboard. Hidden on touch devices, where mailto: opens
the phone's mail app. -->
<span class="support-email-fallbacks">
<a
:href="gmailHref"
target="_blank"
rel="noopener noreferrer"
class="support-email-action"
data-testid="support-email-gmail"
>
Gmail
</a>
<button
type="button"
class="support-email-action"
data-testid="support-email-copy"
@click="copyAddress"
>
{{ copyLabel }}
</button>
</span>
<!-- Clipboard unavailable (insecure context, permission denied): show the
address so it can be selected by hand. -->
<span
v-if="copyFailed"
class="support-email-address"
data-testid="support-email-address"
>
{{ address }}
</span>
</span>
</template>
<script setup>
import { computed, ref } from 'vue';
const props = defineProps({
subject: {
type: String,
default: '',
},
body: {
type: String,
default: '',
},
displayText: {
type: String,
default: '',
},
});
const SUPPORT_USER = 'support';
const SUPPORT_DOMAIN = 'contact.missingtable.com';
const address = `${SUPPORT_USER}@${SUPPORT_DOMAIN}`;
const COPIED_RESET_MS = 2000;
const mailtoHref = computed(() => {
const params = [];
if (props.subject)
params.push(`subject=${encodeURIComponent(props.subject)}`);
if (props.body) params.push(`body=${encodeURIComponent(props.body)}`);
const query = params.length ? `?${params.join('&')}` : '';
return `mailto:${address}${query}`;
});
const gmailHref = computed(() => {
const params = ['view=cm', 'fs=1', `to=${encodeURIComponent(address)}`];
if (props.subject) params.push(`su=${encodeURIComponent(props.subject)}`);
if (props.body) params.push(`body=${encodeURIComponent(props.body)}`);
return `https://mail.google.com/mail/?${params.join('&')}`;
});
const copied = ref(false);
const copyFailed = ref(false);
const copyLabel = computed(() => (copied.value ? 'Copied' : 'Copy address'));
async function copyAddress() {
try {
await navigator.clipboard.writeText(address);
copied.value = true;
copyFailed.value = false;
setTimeout(() => {
copied.value = false;
}, COPIED_RESET_MS);
} catch {
copyFailed.value = true;
}
}
</script>
<style scoped>
.support-email-link {
color: #2563eb;
text-decoration: underline;
font-weight: 500;
}
.support-email-link:hover {
color: #1d4ed8;
}
.support-email-fallbacks {
display: inline-flex;
gap: 0.5rem;
margin-left: 0.5rem;
}
.support-email-action {
background: none;
border: none;
padding: 0;
font: inherit;
font-size: 0.85em;
color: inherit;
opacity: 0.8;
text-decoration: underline;
cursor: pointer;
}
.support-email-action:hover {
opacity: 1;
}
.support-email-address {
margin-left: 0.5rem;
user-select: all;
}
@media (hover: none) and (pointer: coarse) {
.support-email-fallbacks {
display: none;
}
}
</style>
|