diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 3bbd21d9f..346739fd8 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -81,10 +81,19 @@ export default defineConfig({ function createOverscrollMessage() { if (!isLandingPage()) return; + var command = 'curl https://cli.sentry.dev/install -fsS | bash'; overscrollEl = document.createElement('div'); overscrollEl.className = 'overscroll-message'; - overscrollEl.innerHTML = 'You made it to the end. Might as well give it a try → npx sentry@latest'; + overscrollEl.innerHTML = 'You made it to the end. Might as well give it a try → ' + command + ''; document.body.appendChild(overscrollEl); + var codeEl = overscrollEl.querySelector('.overscroll-copy-cmd'); + codeEl.addEventListener('click', function() { + if (!navigator.clipboard) return; + navigator.clipboard.writeText(command).then(function() { + codeEl.textContent = 'copied!'; + setTimeout(function() { codeEl.textContent = command; }, 1500); + }).catch(function() {}); + }); } function updateOverscroll(distance) { diff --git a/docs/src/styles/custom.css b/docs/src/styles/custom.css index 383caca16..c37fc339a 100644 --- a/docs/src/styles/custom.css +++ b/docs/src/styles/custom.css @@ -1825,6 +1825,12 @@ summary[id="starlight__on-this-page--mobile"] .caret { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85em; color: #a78bfa; + cursor: pointer; + pointer-events: auto; +} + +.overscroll-message code:hover { + background: rgba(255, 255, 255, 0.18); } @media (max-width: 640px) {