fix: keep conversation history visible

This commit is contained in:
jjbrunton committed 2026-08-14 15:00:45 +01:00
1 parent 712226cd43
commit b7fcc7db05
4 files changed
+19 -6

No files matched your search

@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useRef, useState } from 'react';
import {
useConversationImageReplacementOptionsQuery,
useGenerateConversationImageReplacementMutation,
@@ -11,6 +11,7 @@ export function ConversationImageReplacement({ conversationId }: { conversationI
const [isResultRevealed, setIsResultRevealed] = useState(false);
const [sourceAssetId, setSourceAssetId] = useState<string | null>(null);
const [targetId, setTargetId] = useState<string | null>(null);
const targetFieldsetRef = useRef<HTMLFieldSetElement>(null);
const optionsQuery = useConversationImageReplacementOptionsQuery(conversationId, isOpen);
const generation = useGenerateConversationImageReplacementMutation(conversationId);
const options = optionsQuery.data;
@@ -53,6 +54,9 @@ export function ConversationImageReplacement({ conversationId }: { conversationI
onChange={() => {
setSourceAssetId(source.id);
clearResult();
window.requestAnimationFrame(() => {
targetFieldsetRef.current?.scrollIntoView?.({ behavior: 'smooth', block: 'nearest' });
});
}}
type="radio"
/>
@@ -68,7 +72,7 @@ export function ConversationImageReplacement({ conversationId }: { conversationI
</fieldset>
) : null}
{options?.targets.length ? (
<fieldset>
<fieldset ref={targetFieldsetRef}>
<legend>2. Image to place on the green screen</legend>
<button onClick={() => setAreTargetsRevealed((current) => !current)} type="button">
{areTargetsRevealed ? 'Blur conversation choices' : 'Reveal conversation choices'}
@@ -143,7 +143,7 @@
.conversation-image-reveal { position: absolute; bottom: .5rem; left: .5rem; min-height: 2rem !important; padding: .35rem .6rem !important; color: white !important; background: rgba(0, 0, 0, .76) !important; border-color: rgba(255, 255, 255, .45) !important; font-size: .75rem; font-weight: 800; }
.conversation-image-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.conversation-empty-detail { padding: 2rem; color: var(--muted); text-align: center; }
.conversation-composer { flex: 0 0 auto; display: grid; gap: .65rem; padding: 1rem; overflow-y: auto; border-top: 1px solid var(--border); }
.conversation-composer { flex: 0 1 auto; display: grid; gap: .65rem; min-height: 0; max-height: 70%; padding: 1rem; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; border-top: 1px solid var(--border); }
.conversation-section-heading, .conversation-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.conversation-section-heading h3 { margin: 0; }
.conversation-actions > span { color: var(--muted); font-size: .75rem; }
@@ -165,7 +165,7 @@
.conversation-image-replacement fieldset { display: grid; gap: .55rem; min-width: 0; padding: .65rem; border: 1px solid var(--border); border-radius: .55rem; }
.conversation-image-replacement legend { padding: 0 .3rem; color: #e9f1ec; font-size: .8rem; font-weight: 800; }
.conversation-image-replacement fieldset > button { justify-self: start; }
.conversation-replacement-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .65rem; }
.conversation-replacement-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .65rem; max-height: 18rem; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.conversation-replacement-options label { display: grid; gap: .35rem; padding: .35rem; overflow: hidden; border: 1px solid var(--border); border-radius: .55rem; cursor: pointer; }
.conversation-replacement-options label.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.conversation-replacement-options label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }