Global search overlay (Cmd+K), copy button on messages, fix Turbopack ESM
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Wrench, ChevronDown, ChevronRight, Lightbulb } from "lucide-react";
|
||||
import { Wrench, ChevronDown, ChevronRight, Lightbulb, Copy, Check } from "lucide-react";
|
||||
import type { Message, ToolCall } from "@/lib/types";
|
||||
|
||||
type Verbosity = "compact" | "normal" | "full";
|
||||
@@ -85,10 +85,18 @@ export function MessageBubble({ message, toolResults, verbosity = "normal", show
|
||||
|
||||
if (!content && toolCalls.length === 0 && !reasoning) return null;
|
||||
|
||||
const [copied, setCopied] = useState(false);
|
||||
const showTools = verbosity !== "compact" && toolCalls.length > 0;
|
||||
const showReasoning = verbosity === "full" && reasoning;
|
||||
const expandTools = verbosity === "full";
|
||||
|
||||
const copyContent = () => {
|
||||
navigator.clipboard.writeText(content).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 1500);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`flex ${isUser ? "justify-end" : "justify-start"}`}>
|
||||
<div
|
||||
@@ -134,6 +142,17 @@ export function MessageBubble({ message, toolResults, verbosity = "normal", show
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Copy button - long press or tap area */}
|
||||
{content && !isUser && (
|
||||
<button
|
||||
onClick={copyContent}
|
||||
className="mt-1 p-0.5 rounded active:bg-white/[0.04]"
|
||||
style={{ color: "var(--text-3)" }}
|
||||
>
|
||||
{copied ? <Check size={12} /> : <Copy size={12} />}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Timestamp */}
|
||||
{showTimestamp && message.timestamp && (
|
||||
<div className="text-[10px] mt-1" style={{ color: isUser ? "rgba(255,255,255,0.5)" : "var(--text-3)" }}>
|
||||
|
||||
Reference in New Issue
Block a user