De-emphasize input for past document version (#468)

This commit is contained in:
Jeremy 2024-10-30 21:28:33 +05:30 committed by GitHub
parent 29f095bcc9
commit 14e88a9c26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 11 deletions

View file

@ -5,6 +5,7 @@ import { useSWRConfig } from 'swr';
import { Suggestion } from '@/db/schema';
import { UICanvas } from './canvas';
import useWindowSize from './use-window-size';
type StreamingDelta = {
type: 'text-delta' | 'title' | 'id' | 'suggestion' | 'clear' | 'finish';
@ -31,6 +32,9 @@ export function useCanvasStream({
}
}, [optimisticSuggestions, mutate]);
const { width: windowWidth = 1920, height: windowHeight = 1080 } =
useWindowSize();
useEffect(() => {
const mostRecentDelta = streamingData?.at(-1);
if (!mostRecentDelta) return;
@ -46,10 +50,10 @@ export function useCanvasStream({
documentId: delta.type === 'id' ? (delta.content as string) : '',
status: 'idle',
boundingBox: {
top: 0,
left: 0,
width: 0,
height: 0,
top: windowHeight / 4,
left: windowWidth / 4,
width: 250,
height: 50,
},
};
}