adjuest poster and mian chat

This commit is contained in:
hobby
2025-02-26 08:07:13 +08:00
parent a049df7147
commit 008165d77b
2 changed files with 273 additions and 270 deletions

View File

@@ -377,7 +377,8 @@ const ChatUI = () => {
return ( return (
<> <>
<KaTeXStyle /> <KaTeXStyle />
<div className="h-[100dvh] flex flex-col bg-gray-100 fixed inset-0 overflow-hidden"> <div className="min-h-screen bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50 flex items-center justify-center">
<div className="h-[100dvh] flex flex-col bg-white max-w-3xl w-full mx-auto relative shadow-xl">
{/* Header */} {/* Header */}
<header className="bg-white shadow flex-none"> <header className="bg-white shadow flex-none">
<div className="flex items-center justify-between px-4 py-3"> <div className="flex items-center justify-between px-4 py-3">
@@ -460,7 +461,7 @@ const ChatUI = () => {
</header> </header>
{/* Main Chat Area */} {/* Main Chat Area */}
<div className="flex-1 overflow-hidden"> <div className="flex-1 overflow-hidden bg-gray-100">
<ScrollArea className="h-full p-2" ref={chatAreaRef}> <ScrollArea className="h-full p-2" ref={chatAreaRef}>
<div className="space-y-4"> <div className="space-y-4">
{messages.map((message) => ( {messages.map((message) => (
@@ -663,6 +664,7 @@ const ChatUI = () => {
</DialogContent> </DialogContent>
</Dialog> </Dialog>
</div> </div>
</div>
{/* 添加 SharePoster 组件 */} {/* 添加 SharePoster 组件 */}
<SharePoster <SharePoster

View File

@@ -72,17 +72,18 @@ export function SharePoster({ isOpen, onClose, chatAreaRef }: SharePosterProps)
const dataUrl = await domtoimage.toSvg(messageContainer as HTMLElement, { const dataUrl = await domtoimage.toSvg(messageContainer as HTMLElement, {
bgcolor: '#f3f4f6', bgcolor: '#f3f4f6',
scale: 1, // 回到较安全的值 scale: 1, // 回到较安全的值
width: targetWidth + (extraSpace * 2), width: targetWidth + (extraSpace * 5),
height: adjustedHeight + (extraSpace * 2), height: adjustedHeight + (extraSpace * 5),
style: { style: {
padding: `${extraSpace}px`, padding: `${extraSpace}px`,
margin: '0', margin: '0 auto',
width: '120%', width: '120%',
height: '110%', height: '110%',
transform: `scale(${scale})`, transform: `scale(${scale})`,
transformOrigin: 'top left', transformOrigin: 'top left',
background: '#f3f4f6', background: '#f3f4f6',
boxSizing: 'border-box' boxSizing: 'border-box'
}, },
quality: 1.0 quality: 1.0
}); });
@@ -168,7 +169,7 @@ export function SharePoster({ isOpen, onClose, chatAreaRef }: SharePosterProps)
onClose(); onClose();
} }
}}> }}>
<DialogContent className="max-w-[100vw] w-full sm:max-w-[100vw] max-h-[90vh] flex flex-col p-0"> <DialogContent className="max-w-[100vw] w-full sm:max-w-[50vw] max-h-[90vh] flex flex-col p-0">
{/* 图片容器 */} {/* 图片容器 */}
<div className="flex-1 overflow-auto "> <div className="flex-1 overflow-auto ">
{posterImage && ( {posterImage && (