Преглед на файлове

ChatMessage: get timestamp out of direct view (#3948)

tobitege преди 1 година
родител
ревизия
2842efa0e8
променени са 1 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 6 4
      frontend/src/components/chat/ChatMessage.tsx

+ 6 - 4
frontend/src/components/chat/ChatMessage.tsx

@@ -60,6 +60,10 @@ function ChatMessage({
     }
     }
   };
   };
 
 
+  const copyButtonTitle = message.timestamp
+    ? `${t(I18nKey.CHAT_INTERFACE$TOOLTIP_COPY_MESSAGE)} - ${formatTimestamp(message.timestamp)}`
+    : t(I18nKey.CHAT_INTERFACE$TOOLTIP_COPY_MESSAGE);
+
   return (
   return (
     <article
     <article
       data-testid="article"
       data-testid="article"
@@ -78,7 +82,8 @@ function ChatMessage({
           data-testid="copy-button"
           data-testid="copy-button"
           onClick={copyToClipboard}
           onClick={copyToClipboard}
           className="absolute top-1 right-1 p-1 bg-neutral-600 rounded hover:bg-neutral-700"
           className="absolute top-1 right-1 p-1 bg-neutral-600 rounded hover:bg-neutral-700"
-          aria-label={t(I18nKey.CHAT_INTERFACE$TOOLTIP_COPY_MESSAGE)}
+          aria-label={copyButtonTitle}
+          title={copyButtonTitle}
           type="button"
           type="button"
         >
         >
           {isCopy ? <FaClipboardCheck /> : <FaClipboard />}
           {isCopy ? <FaClipboardCheck /> : <FaClipboard />}
@@ -99,9 +104,6 @@ function ChatMessage({
           ))}
           ))}
         </div>
         </div>
       )}
       )}
-      <div className="text-xs text-neutral-400 mt-2">
-        {formatTimestamp(message.timestamp)}
-      </div>
       {isLastMessage &&
       {isLastMessage &&
         message.sender === "assistant" &&
         message.sender === "assistant" &&
         awaitingUserConfirmation && <ConfirmationButtons />}
         awaitingUserConfirmation && <ConfirmationButtons />}