add sharepost
This commit is contained in:
BIN
public/img/qr.png
Normal file
BIN
public/img/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
@@ -525,13 +525,18 @@ const ChatUI = () => {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div ref={messagesEndRef} />
|
<div ref={messagesEndRef} />
|
||||||
|
{/* 添加一个二维码 */}
|
||||||
|
<div id="qrcode" className="flex flex-col items-center hidden">
|
||||||
|
<img src="/img/qr.png" alt="QR Code" className="w-24 h-24" />
|
||||||
|
<p className="text-sm text-gray-500 mt-2 font-medium tracking-tight bg-gray-50 px-3 py-1 rounded-full">扫码体验AI群聊</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Input Area */}
|
{/* Input Area */}
|
||||||
<div className="bg-white border-t pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 px-4">
|
<div className="bg-white border-t pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 px-4">
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-1">
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
@@ -563,9 +568,8 @@ const ChatUI = () => {
|
|||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="w-4 h-4 mr-2 animate-spin rounded-full border-2 border-white border-t-transparent" />
|
<div className="w-4 h-4 mr-2 animate-spin rounded-full border-2 border-white border-t-transparent" />
|
||||||
) : (
|
) : (
|
||||||
<Send className="w-4 h-4 mr-2" />
|
<Send className="w-4 h-4" />
|
||||||
)}
|
)}
|
||||||
发送
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ export function SharePoster({ isOpen, onClose, chatAreaRef }: SharePosterProps)
|
|||||||
try {
|
try {
|
||||||
const messageContainer = chatAreaRef.current.querySelector('.space-y-4');
|
const messageContainer = chatAreaRef.current.querySelector('.space-y-4');
|
||||||
if (!messageContainer) return;
|
if (!messageContainer) return;
|
||||||
|
const qrCode = messageContainer.querySelector('#qrcode');
|
||||||
|
if (qrCode) {
|
||||||
|
qrCode.classList.remove('hidden');
|
||||||
|
}
|
||||||
// 预处理所有图片
|
// 预处理所有图片
|
||||||
const preloadImages = async () => {
|
const preloadImages = async () => {
|
||||||
const images = Array.from(messageContainer.getElementsByTagName('img'));
|
const images = Array.from(messageContainer.getElementsByTagName('img'));
|
||||||
@@ -141,7 +144,16 @@ export function SharePoster({ isOpen, onClose, chatAreaRef }: SharePosterProps)
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={isOpen} onOpenChange={onClose}>
|
<Dialog open={isOpen} onOpenChange={(open) => {
|
||||||
|
if (!open) {
|
||||||
|
// Hide QR code when dialog closes
|
||||||
|
const qrCode = chatAreaRef.current?.querySelector('#qrcode');
|
||||||
|
if (qrCode) {
|
||||||
|
qrCode.classList.add('hidden');
|
||||||
|
}
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
}}>
|
||||||
<DialogContent className="max-w-[95vw] w-full sm:max-w-[90vw] max-h-[90vh] flex flex-col p-0">
|
<DialogContent className="max-w-[95vw] w-full sm:max-w-[90vw] max-h-[90vh] flex flex-col p-0">
|
||||||
{/* 图片容器 */}
|
{/* 图片容器 */}
|
||||||
<div className="flex-1 overflow-auto p-1">
|
<div className="flex-1 overflow-auto p-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user