fix(chat): constrain image viewer width

This commit is contained in:
2026-06-30 10:58:57 +08:00
parent caf77efb32
commit f352dbdffa
3 changed files with 25 additions and 16 deletions
@@ -1,7 +1,7 @@
/* FullscreenImageViewer 全屏图片查看器样式 */
.viewer {
position: fixed;
position: absolute;
inset: 0;
z-index: 100;
background: #000;
@@ -51,7 +51,7 @@ export function FullscreenImageViewer({
src={src}
alt=""
fill
sizes="100vw"
sizes="(max-width: 540px) 100vw, 540px"
className={styles.paywallImage}
/>
<div className={styles.paywallScrim} aria-hidden="true" />
@@ -2,6 +2,7 @@
import { useRouter } from "next/navigation";
import { MobileShell } from "@/app/_components/core";
import { ROUTE_BUILDERS, ROUTES } from "@/router/routes";
import { useAuthState } from "@/stores/auth/auth-context";
import { useChatDispatch, useChatState } from "@/stores/chat/chat-context";
@@ -40,25 +41,33 @@ export function ChatImageViewerScreen({
if (!message) {
return (
<main className={styles.emptyScreen}>
<button type="button" className={styles.backButton} onClick={handleClose}>
Back to chat
</button>
<p className={styles.emptyText}>
{chatState.historyLoaded ? "Image not found." : "Loading image..."}
</p>
</main>
<MobileShell background="#0d0b14">
<main className={styles.emptyScreen}>
<button
type="button"
className={styles.backButton}
onClick={handleClose}
>
Back to chat
</button>
<p className={styles.emptyText}>
{chatState.historyLoaded ? "Image not found." : "Loading image..."}
</p>
</main>
</MobileShell>
);
}
return (
<>
<FullscreenImageViewer
imageUrl={message.imageUrl ?? ""}
imagePaywalled={message.imagePaywalled === true}
onUnlockImagePaywall={handleUnlockImagePaywall}
onClose={handleClose}
/>
<MobileShell background="#000000">
<FullscreenImageViewer
imageUrl={message.imageUrl ?? ""}
imagePaywalled={message.imagePaywalled === true}
onUnlockImagePaywall={handleUnlockImagePaywall}
onClose={handleClose}
/>
</MobileShell>
<HistoryUnlockDialog
open={chatState.unlockHistoryPromptVisible}
lockedCount={chatState.lockedHistoryCount}