fix(Nextjs): Outline Stream Json fix & Image Edit improved
This commit is contained in:
parent
5faf61d70f
commit
b55b3a4df0
5 changed files with 9 additions and 8 deletions
|
|
@ -11,6 +11,7 @@ interface EditableLayoutWrapperProps {
|
|||
slideIndex: number;
|
||||
slideData: any;
|
||||
isEditMode?: boolean;
|
||||
properties?: any;
|
||||
}
|
||||
|
||||
interface EditableElement {
|
||||
|
|
@ -26,6 +27,7 @@ const EditableLayoutWrapper: React.FC<EditableLayoutWrapperProps> = ({
|
|||
children,
|
||||
slideIndex,
|
||||
slideData,
|
||||
properties
|
||||
}) => {
|
||||
const dispatch = useDispatch();
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
|
@ -193,13 +195,14 @@ const EditableLayoutWrapper: React.FC<EditableLayoutWrapperProps> = ({
|
|||
htmlImg.addEventListener('click', clickHandler);
|
||||
|
||||
const itemIndex = parseInt(`${slideIndex}-${type}-${dataPath}-${index}`.split('-').pop() || '0');
|
||||
const properties = slideData.properties?.[itemIndex];
|
||||
const propertiesData = properties?.[itemIndex];
|
||||
console.log('propertiesData', propertiesData);
|
||||
|
||||
// Add hover effects without changing layout
|
||||
htmlImg.style.cursor = 'pointer';
|
||||
htmlImg.style.transition = 'opacity 0.2s, transform 0.2s';
|
||||
htmlImg.style.objectFit = properties?.objectFit;
|
||||
htmlImg.style.objectPosition = `${properties?.focusPoint?.x}% ${properties?.focusPoint?.y}%`;
|
||||
htmlImg.style.objectFit = propertiesData?.initialObjectFit;
|
||||
htmlImg.style.objectPosition = `${propertiesData?.initialFocusPoint?.x}% ${propertiesData?.initialFocusPoint?.y}%`;
|
||||
|
||||
const mouseEnterHandler = () => {
|
||||
htmlImg.style.opacity = '0.8';
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ const ImageEditor = ({
|
|||
|
||||
<div className="mt-6">
|
||||
<Tabs defaultValue="generate" className="w-full">
|
||||
<TabsList className="grid bg-blue-100 border border-blue-300 w-full grid-cols-3 mx-auto">
|
||||
<TabsList className="grid bg-blue-100 border border-blue-300 w-full grid-cols-2 mx-auto">
|
||||
<TabsTrigger className="font-medium" value="generate">
|
||||
AI Generate
|
||||
</TabsTrigger>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export const useGroupLayouts = () => {
|
|||
<EditableLayoutWrapper
|
||||
slideIndex={slide.index}
|
||||
slideData={slide.content}
|
||||
|
||||
properties={slide.properties}
|
||||
>
|
||||
<TiptapTextReplacer
|
||||
key={slide.id}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import Wrapper from "@/components/Wrapper";
|
|||
import OutlineContent from "./OutlineContent";
|
||||
import LayoutSelection from "./LayoutSelection";
|
||||
import EmptyStateView from "./EmptyStateView";
|
||||
import PageHeader from "./PageHeader";
|
||||
import GenerateButton from "./GenerateButton";
|
||||
|
||||
import { TABS, LayoutGroup } from "../types/index";
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ export const useOutlineStreaming = (presentationId: string | null) => {
|
|||
|
||||
eventSource.addEventListener("response", (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('data', data);
|
||||
switch (data.type) {
|
||||
case "chunk":
|
||||
accumulatedChunks += data.chunk;
|
||||
|
|
@ -50,7 +49,7 @@ export const useOutlineStreaming = (presentationId: string | null) => {
|
|||
|
||||
case "complete":
|
||||
try {
|
||||
const outlinesData: SlideOutline[] = JSON.parse(data.presentation).outlines;
|
||||
const outlinesData: SlideOutline[] = data.presentation.outlines;
|
||||
dispatch(setOutlines(outlinesData));
|
||||
setStreamState({ isStreaming: false, isLoading: false });
|
||||
eventSource.close();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue