Ver Fonte

feat: copy text button added to user message

Timothy J. Baek há 1 ano atrás
pai
commit
3feffadfea
1 ficheiros alterados com 25 adições e 3 exclusões
  1. 25 3
      src/lib/components/chat/Messages.svelte

+ 25 - 3
src/lib/components/chat/Messages.svelte

@@ -387,9 +387,9 @@
 												}}
 											/>
 
-											<div class=" flex justify-end space-x-2 text-sm font-medium">
+											<div class=" mt-2 flex justify-center space-x-2 text-sm font-medium">
 												<button
-													class="px-4 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded-lg"
+													class="px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded-lg"
 													on:click={() => {
 														confirmEditMessage(message.id);
 													}}
@@ -398,7 +398,7 @@
 												</button>
 
 												<button
-													class=" px-4 py-2.5 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-100 transition outline outline-1 outline-gray-200 dark:outline-gray-600 rounded-lg"
+													class=" px-4 py-2 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-100 transition outline outline-1 outline-gray-200 dark:outline-gray-600 rounded-lg"
 													on:click={() => {
 														cancelEditMessage(message.id);
 													}}
@@ -533,6 +533,28 @@
 														/>
 													</svg>
 												</button>
+
+												<button
+													class="invisible group-hover:visible p-1 rounded dark:hover:bg-gray-800 transition"
+													on:click={() => {
+														copyToClipboard(message.content);
+													}}
+												>
+													<svg
+														xmlns="http://www.w3.org/2000/svg"
+														fill="none"
+														viewBox="0 0 24 24"
+														stroke-width="1.5"
+														stroke="currentColor"
+														class="w-4 h-4"
+													>
+														<path
+															stroke-linecap="round"
+															stroke-linejoin="round"
+															d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"
+														/>
+													</svg>
+												</button>
 											</div>
 										</div>
 									{/if}