fix(ui): only show copy button on https

This commit is contained in:
peaklabs-dev
2025-04-02 19:38:53 +02:00
parent 331693546b
commit 7e0ff9cc3c

View File

@@ -1,8 +1,9 @@
@props(['text']) @props(['text'])
<div class="relative" x-data="{ copied: false }"> <div class="relative" x-data="{ copied: false, isSecure: window.isSecureContext }">
<input type="text" value="{{ $text }}" readonly class="input"> <input type="text" value="{{ $text }}" readonly class="input">
<button <button
x-show="isSecure"
@click.prevent="copied = true; navigator.clipboard.writeText({{ Js::from($text) }}); setTimeout(() => copied = false, 1000)" @click.prevent="copied = true; navigator.clipboard.writeText({{ Js::from($text) }}); setTimeout(() => copied = false, 1000)"
class="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-300 transition-colors" class="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-300 transition-colors"
title="Copy to clipboard"> title="Copy to clipboard">