Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions app/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ const ssr = useRouteQuery<string, boolean>('ssr', 'false', {
const prod = useRouteQuery<string, boolean>('prod', 'false', {
transform: stringToBooleanTransformer,
})

const toast = useToast()
const { copy } = useClipboard()

function resetVueVersion() {
vueVersion.value = null
}

function resetVueUseVersion() {
vueUseVersion.value = 'latest'
}

async function copyLink(e: MouseEvent) {
if (e.metaKey) {
resetVueVersion()
resetVueUseVersion()
// hidden logic for going to local debug from playground.vueuse.org
window.location.href = `http://localhost:3000/${window.location.hash}`
return
}
copy(location.href)
toast.add({
title: 'Sharable URL has been copied to clipboard.',
icon: 'i-heroicons-check-circle',
color: 'success',
})
}
</script>

<template>
Expand All @@ -71,6 +98,15 @@ const prod = useRouteQuery<string, boolean>('prod', 'false', {
@click="toggleColorMode"
/>

<UTooltip text="Copy sharable URL">
<UButton
color="neutral"
variant="ghost"
icon="i-carbon-share"
@click="copyLink"
/>
</UTooltip>

<UTooltip text="Open on GitHub">
<UButton
color="neutral"
Expand Down