From dc283658db0529f4a234e793b8cdc65ecded3373 Mon Sep 17 00:00:00 2001
From: Luna
Date: Sun, 29 Nov 2026 10:31:53 -0500
Subject: [PATCH] fix(shiso): refine flagship image preview and conversation
layout
- Preserve the full image aspect ratio with a responsive 280-340px cap.\n- Keep Save, Regenerate, and Cancel visible by revealing the approval panel within the conversation thread.\n- Refine the conversation sidebar proportions, panel framing, and composer clearance.\n- Preserve the existing authorization, confirmation, preview, save, and cancel behavior.
---
src/components/ShisoModal.tsx | 40 +++++++++++++++++++++++++----------
src/index.css | 6 +++---
2 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/src/components/ShisoModal.tsx b/src/components/ShisoModal.tsx
index 3003fc8..1a91495 100644
--- a/src/components/ShisoModal.tsx
+++ b/src/components/ShisoModal.tsx
@@ -355,6 +355,7 @@ export function ShisoModal({
const sessionIdentity = shiso.snapshot?.sessionIdentity ?? null;
const scrollRef = useRef(null);
+ const imagePanelRef = useRef(null);
useEffect(() => {
if (isOpen) {
@@ -561,6 +562,16 @@ export function ShisoModal({
};
}, [isOpen, network, previewToken]);
+ // R2-V1: when a confirmation or preview appears, bring the WHOLE approval
+ // panel into view so the fixed composer can never hide Save / Regenerate /
+ // Cancel. This only scrolls the conversation thread, never the page.
+ useEffect(() => {
+ if (!isOpen || imageState.phase === 'idle') return;
+ const panel = imagePanelRef.current;
+ if (!panel || typeof panel.scrollIntoView !== 'function') return;
+ panel.scrollIntoView({ block: 'end', inline: 'nearest' });
+ }, [isOpen, imageState.phase, securePreviewUrl]);
+
const recipeContext = useShisoRecipeContext(recipe);
const nutritionRowsMatchRecipe = recipeContext !== null &&
recipeContext.ingredients.length === nutritionRows.length &&
@@ -1872,12 +1883,13 @@ export function ShisoModal({
{(imageState.phase !== 'idle' || imageState.message !== undefined) && (
-
Recipe image
-
+ Recipe image
+
{imageState.phase === 'confirming' ? 'Awaiting confirmation'
: imageState.phase === 'saved' ? 'Saved'
: imageState.phase === 'preview' ? 'Preview — not saved'
@@ -1885,7 +1897,7 @@ export function ShisoModal({
: 'Generating'}
-
+
{imageRecipe?.title ?? 'Current recipe'} · Nothing is saved until you press Save Image.
@@ -1902,7 +1914,13 @@ export function ShisoModal({
data-testid="shiso-image-preview"
src={securePreviewUrl}
alt={`Generated image preview for ${imageRecipe?.title ?? 'the current recipe'}`}
- className="max-h-72 w-full rounded-lg object-cover border border-white/10"
+ className="mx-auto block h-auto w-auto max-w-full max-h-[clamp(280px,38vh,340px)] rounded-xl border border-white/10 bg-black/20 object-contain"
+ onLoad={(event) => {
+ if (typeof event.currentTarget.scrollIntoView !== 'function') return;
+ event.currentTarget
+ .closest('[data-testid="shiso-image-panel"]')
+ ?.scrollIntoView({ block: 'end', inline: 'nearest' });
+ }}
/>
)}
{imageState.preview !== undefined && securePreviewUrl === null && imageState.phase !== 'saving' && (
@@ -1924,14 +1942,14 @@ export function ShisoModal({
)}
-
+
{imageState.phase === 'confirming' && (
@@ -1942,7 +1960,7 @@ export function ShisoModal({
data-testid="shiso-image-save"
disabled={imageBusy}
onClick={saveGeneratedImage}
- className="rounded-lg bg-emerald-500/20 px-2.5 py-1 text-[11px] font-semibold text-emerald-100 border border-emerald-500/40 hover:bg-emerald-500/30 disabled:opacity-40"
+ className="rounded-lg bg-amber-500 px-3 py-1.5 text-[11px] font-semibold text-black hover:bg-amber-400 disabled:opacity-40"
>
Save Image
@@ -1953,7 +1971,7 @@ export function ShisoModal({
data-testid="shiso-image-regenerate"
disabled={imageBusy}
onClick={regenerateImage}
- className="rounded-lg border border-white/15 px-2.5 py-1 text-[11px] text-gray-200 hover:bg-white/5 disabled:opacity-40"
+ className="rounded-lg border border-white/15 px-3 py-1.5 text-[11px] text-gray-200 hover:bg-white/5 disabled:opacity-40"
>
Regenerate
@@ -1964,7 +1982,7 @@ export function ShisoModal({
data-testid="shiso-image-cancel"
disabled={false}
onClick={cancelImage}
- className="rounded-lg border border-white/15 px-2.5 py-1 text-[11px] text-gray-300 hover:bg-white/5"
+ className="rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-gray-400 hover:bg-white/5 hover:text-gray-200"
>
Cancel
@@ -1974,7 +1992,7 @@ export function ShisoModal({
type="button"
data-testid="shiso-image-done"
onClick={cancelImage}
- className="rounded-lg border border-white/15 px-2.5 py-1 text-[11px] text-gray-300 hover:bg-white/5"
+ className="rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-gray-400 hover:bg-white/5 hover:text-gray-200"
>
Done
diff --git a/src/index.css b/src/index.css
index 677f742..3f7d135 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1903,7 +1903,7 @@ summary:focus-visible,
.kc-shiso-workspace-shell {
display: grid;
- grid-template-columns: clamp(280px, 20.2vw, 300px) minmax(0, 1fr);
+ grid-template-columns: clamp(292px, 19.5vw, 320px) minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
width: 100%;
height: 100%;
@@ -2255,9 +2255,9 @@ summary:focus-visible,
overscroll-behavior: contain;
scrollbar-gutter: stable;
gap: 12px;
- scroll-padding-block: 18px;
+ scroll-padding-block: 18px 24px;
min-height: 0;
- padding: 18px 36px 16px;
+ padding: 18px 36px 20px;
background:
radial-gradient(60% 72% at 54% 8%, color-mix(in srgb, var(--accent-text, #F59E0B) 7%, transparent), transparent 74%),
var(--bg-root, #0C0C0C);