From 14e88a9c260c67939db4a6d18ca94966e54c4fdb Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 30 Oct 2024 21:28:33 +0530 Subject: [PATCH] De-emphasize input for past document version (#468) --- components/custom/canvas.tsx | 22 ++++++++++++++++------ components/custom/multimodal-input.tsx | 2 +- components/custom/use-canvas-stream.tsx | 12 ++++++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/components/custom/canvas.tsx b/components/custom/canvas.tsx index f2e7288..3f444f0 100644 --- a/components/custom/canvas.tsx +++ b/components/custom/canvas.tsx @@ -270,7 +270,17 @@ export function Canvas({ }} exit={{ opacity: 0, x: 10, scale: 0.95, transition: { delay: 0 } }} > -
+ + {!isCurrentVersion && ( + + )} + +
{ setCanvas(null); }} @@ -412,7 +422,7 @@ export function Canvas({
{ handleVersionChange('prev'); }} @@ -420,7 +430,7 @@ export function Canvas({
{ handleVersionChange('next'); }} @@ -429,8 +439,8 @@ export function Canvas({
{ handleVersionChange('toggle'); diff --git a/components/custom/multimodal-input.tsx b/components/custom/multimodal-input.tsx index 4ac7c95..1615ef8 100644 --- a/components/custom/multimodal-input.tsx +++ b/components/custom/multimodal-input.tsx @@ -228,7 +228,7 @@ export function MultimodalInput({ value={input} onChange={handleInput} className={cx( - 'min-h-[24px] overflow-hidden resize-none rounded-lg text-base bg-muted', + 'min-h-[24px] overflow-hidden resize-none rounded-xl text-base bg-muted', className )} rows={3} diff --git a/components/custom/use-canvas-stream.tsx b/components/custom/use-canvas-stream.tsx index efde09d..ddd2857 100644 --- a/components/custom/use-canvas-stream.tsx +++ b/components/custom/use-canvas-stream.tsx @@ -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, }, }; }