enzostvs HF staff commited on
Commit
96eeadd
·
1 Parent(s): c30fef9

copy prompt to clipboard

Browse files
src/lib/components/community/Card.svelte CHANGED
@@ -7,6 +7,7 @@
7
  import { galleryStore } from "$lib/stores/use-gallery";
8
  import Loading from "$lib/components/Loading.svelte";
9
  import Reactions from "./reactions/Reactions.svelte";
 
10
 
11
  export let card: CommunityCard;
12
  export let form: Record<string, string> | undefined = undefined;
@@ -54,9 +55,20 @@
54
  <div class="bg-gradient-to-b from-transparent via-black/50 to-black/70 absolute h-[100px] bottom-0 left-0 w-full"></div>
55
  </div>
56
  <div class="group-hover:opacity-100 opacity-0 translate-y-full group-hover:translate-y-0 transition-all duration-200 flex flex-col gap-4 w-full">
57
- <div class="bg-black/40 backdrop-blur-sm border border-white/30 rounded-lg px-6 py-3 text-white transition-all duration-200 w-full">
58
  <p class="text-white font-semibold text-lg">{card.prompt}</p>
59
  <p class="text-white/75 font-regular text-base">{card.model.id}</p>
 
 
 
 
 
 
 
 
 
 
 
60
  </div>
61
  </div>
62
  {#if displayReactions}
 
7
  import { galleryStore } from "$lib/stores/use-gallery";
8
  import Loading from "$lib/components/Loading.svelte";
9
  import Reactions from "./reactions/Reactions.svelte";
10
+ import { success } from "$lib/utils/toaster";
11
 
12
  export let card: CommunityCard;
13
  export let form: Record<string, string> | undefined = undefined;
 
55
  <div class="bg-gradient-to-b from-transparent via-black/50 to-black/70 absolute h-[100px] bottom-0 left-0 w-full"></div>
56
  </div>
57
  <div class="group-hover:opacity-100 opacity-0 translate-y-full group-hover:translate-y-0 transition-all duration-200 flex flex-col gap-4 w-full">
58
+ <div class="bg-black/40 backdrop-blur-sm border border-white/30 rounded-lg px-6 py-3 text-white transition-all duration-200 w-full relative">
59
  <p class="text-white font-semibold text-lg">{card.prompt}</p>
60
  <p class="text-white/75 font-regular text-base">{card.model.id}</p>
61
+ <button
62
+ class="absolute bottom-3 right-3"
63
+ on:click={(e) => {
64
+ e.stopPropagation();
65
+ e.preventDefault();
66
+ navigator.clipboard.writeText(card.prompt);
67
+ success("Prompt copied to clipboard");
68
+ }}
69
+ >
70
+ <Icon icon="solar:copy-bold-duotone" class="w-5 h-5 text-white/75 hover:text-white" />
71
+ </button>
72
  </div>
73
  </div>
74
  {#if displayReactions}