This commit is contained in:
hobby
2025-02-26 08:44:53 +08:00
4 changed files with 216 additions and 204 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
lerna-debug.log* lerna-debug.log*
.pnpm-debug.log* .pnpm-debug.log*
package-lock.json
# Diagnostic reports (https://nodejs.org/api/report.html) # Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

8
package-lock.json generated
View File

@@ -1315,7 +1315,11 @@
}, },
"node_modules/@radix-ui/react-switch": { "node_modules/@radix-ui/react-switch": {
"version": "1.1.3", "version": "1.1.3",
<<<<<<< HEAD
"resolved": "https://registry.npmmirror.com/@radix-ui/react-switch/-/react-switch-1.1.3.tgz", "resolved": "https://registry.npmmirror.com/@radix-ui/react-switch/-/react-switch-1.1.3.tgz",
=======
"resolved": "https://registry.npmjs.org/@radix-ui/react-switch/-/react-switch-1.1.3.tgz",
>>>>>>> develop
"integrity": "sha512-1nc+vjEOQkJVsJtWPSiISGT6OKm4SiOdjMo+/icLxo2G4vxz1GntC5MzfL4v8ey9OEfw787QCD1y3mUv0NiFEQ==", "integrity": "sha512-1nc+vjEOQkJVsJtWPSiISGT6OKm4SiOdjMo+/icLxo2G4vxz1GntC5MzfL4v8ey9OEfw787QCD1y3mUv0NiFEQ==",
"dependencies": { "dependencies": {
"@radix-ui/primitive": "1.1.1", "@radix-ui/primitive": "1.1.1",
@@ -1438,7 +1442,11 @@
}, },
"node_modules/@radix-ui/react-use-previous": { "node_modules/@radix-ui/react-use-previous": {
"version": "1.1.0", "version": "1.1.0",
<<<<<<< HEAD
"resolved": "https://registry.npmmirror.com/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz",
=======
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz",
>>>>>>> develop
"integrity": "sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og==", "integrity": "sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og==",
"peerDependencies": { "peerDependencies": {
"@types/react": "*", "@types/react": "*",

View File

@@ -380,7 +380,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">
@@ -463,7 +464,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) => (
@@ -591,6 +592,7 @@ const ChatUI = () => {
</Button> </Button>
</div> </div>
</div> </div>
</div>
{/* Members Management Dialog */} {/* Members Management Dialog */}
<MembersManagement <MembersManagement

View File

@@ -60,7 +60,7 @@ export function SharePoster({ isOpen, onClose, chatAreaRef }: SharePosterProps)
chatAreaRef.current.scrollTop = 0; chatAreaRef.current.scrollTop = 0;
const viewportWidth = Math.min(window.innerWidth, document.documentElement.clientWidth); const viewportWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
const extraSpace = 20; const extraSpace = 6;
const targetWidth = viewportWidth * 0.95 - (extraSpace * 2); const targetWidth = viewportWidth * 0.95 - (extraSpace * 2);
const currentWidth = messageContainer.getBoundingClientRect().width; const currentWidth = messageContainer.getBoundingClientRect().width;
@@ -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 && (