diff --git a/resources/js/app.js b/resources/js/app.js index f9cf3da..1b356f8 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,7 +1,9 @@ import Alpine from 'alpinejs'; import collapse from '@alpinejs/collapse'; +import { registerLadillClipboard } from './ladill-clipboard'; Alpine.plugin(collapse); +registerLadillClipboard(Alpine); // In-app notification bell + dropdown. Alpine.data('notificationDropdown', (config = {}) => ({ diff --git a/resources/js/ladill-clipboard.js b/resources/js/ladill-clipboard.js new file mode 100644 index 0000000..ac19b3c --- /dev/null +++ b/resources/js/ladill-clipboard.js @@ -0,0 +1,57 @@ +const COPY_FEEDBACK_MS = 2000; + +export async function writeClipboardText(text) { + const value = String(text ?? ''); + if (!value) { + return false; + } + + try { + if (navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(value); + + return true; + } + } catch { + // fall through to legacy copy + } + + try { + const textarea = document.createElement('textarea'); + textarea.value = value; + textarea.style.position = 'fixed'; + textarea.style.opacity = '0'; + document.body.appendChild(textarea); + textarea.select(); + const ok = document.execCommand('copy'); + document.body.removeChild(textarea); + + return ok; + } catch { + return false; + } +} + +export function registerLadillClipboard(Alpine) { + Alpine.data('copyButton', (text = '') => ({ + copied: false, + text: text ?? '', + resetTimer: null, + async copy() { + const ok = await writeClipboardText(this.text); + if (!ok) { + return; + } + + this.copied = true; + + if (this.resetTimer) { + clearTimeout(this.resetTimer); + } + + this.resetTimer = setTimeout(() => { + this.copied = false; + }, COPY_FEEDBACK_MS); + }, + })); +} diff --git a/resources/views/components/copy-button.blade.php b/resources/views/components/copy-button.blade.php new file mode 100644 index 0000000..06279be --- /dev/null +++ b/resources/views/components/copy-button.blade.php @@ -0,0 +1,29 @@ +@props([ + 'text' => '', + 'label' => 'Copy', + 'copiedLabel' => 'Copied!', + 'icon' => false, + 'copiedClass' => '', +]) + + diff --git a/resources/views/meet/room/show.blade.php b/resources/views/meet/room/show.blade.php index 7658b61..ff33f09 100644 --- a/resources/views/meet/room/show.blade.php +++ b/resources/views/meet/room/show.blade.php @@ -205,11 +205,10 @@ @include('meet.room.partials.meet-icon', ['icon' => 'screen-share']) @@ -254,102 +253,6 @@ - -
-
-
-

More options

-

Meeting tools and extras

-
- -
- -
-
- - - - -
-
- - - - @if ($participant->isHost()) - - - - - - - - @endif -
- - @if ($isWebinar ?? false) -
-

Q&A

- -
- - -
-
- @endif - -

-
No participants yet.

+ + + +

Meeting tools and extras

+
+ +
+
+
+ + + + +
+
+ + + + @if ($participant->isHost()) + + + + + + + + @endif +
+ + @if ($isWebinar ?? false) +
+

Q&A

+
    + +
  • No questions yet.
  • +
+
+ + +
+
+ @endif + +

+
+
diff --git a/resources/views/meet/rooms/show.blade.php b/resources/views/meet/rooms/show.blade.php index 2280ba3..34aaa1b 100644 --- a/resources/views/meet/rooms/show.blade.php +++ b/resources/views/meet/rooms/show.blade.php @@ -23,7 +23,7 @@

Join link

- +