fix(Nextjs): update slide ID generation to use uuid & expand slide options to 20
This commit is contained in:
parent
4a5cd41209
commit
a34d018d0f
3 changed files with 18 additions and 12 deletions
|
|
@ -196,7 +196,6 @@ const EditableLayoutWrapper: React.FC<EditableLayoutWrapperProps> = ({
|
|||
|
||||
const itemIndex = parseInt(`${slideIndex}-${type}-${dataPath}-${index}`.split('-').pop() || '0');
|
||||
const propertiesData = properties?.[itemIndex];
|
||||
console.log('propertiesData', propertiesData);
|
||||
|
||||
// Add hover effects without changing layout
|
||||
htmlImg.style.cursor = 'pointer';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { useDispatch } from 'react-redux';
|
|||
import { addNewSlide } from '@/store/slices/presentationGeneration';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { useGroupLayoutLoader } from '@/app/layout-preview/hooks/useGroupLayoutLoader';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { toast } from 'sonner';
|
||||
interface NewSlideProps {
|
||||
setShowNewSlideSelection: (show: boolean) => void;
|
||||
group: string;
|
||||
|
|
@ -13,16 +15,21 @@ interface NewSlideProps {
|
|||
const NewSlide = ({ setShowNewSlideSelection, group, index, presentationId }: NewSlideProps) => {
|
||||
const dispatch = useDispatch();
|
||||
const handleNewSlide = (sampleData: any, id: string) => {
|
||||
const newSlide = {
|
||||
id: crypto.randomUUID(),
|
||||
index: index,
|
||||
content: sampleData,
|
||||
layout_group: group,
|
||||
layout: `${group}:${id}`,
|
||||
presentation: presentationId
|
||||
try {
|
||||
const newSlide = {
|
||||
id: uuidv4(),
|
||||
index: index,
|
||||
content: sampleData,
|
||||
layout_group: group,
|
||||
layout: `${group}:${id}`,
|
||||
presentation: presentationId
|
||||
}
|
||||
dispatch(addNewSlide({ slideData: newSlide, index }));
|
||||
setShowNewSlideSelection(false);
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
toast.error('Error adding new slide')
|
||||
}
|
||||
dispatch(addNewSlide({ slideData: newSlide, index }));
|
||||
setShowNewSlideSelection(false);
|
||||
}
|
||||
const { layoutGroup, loading } = useGroupLayoutLoader(group)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ interface ConfigurationSelectsProps {
|
|||
onConfigChange: (key: keyof PresentationConfig, value: string) => void;
|
||||
}
|
||||
|
||||
type SlideOption = "5" | "8" | "10" | "12" | "15" | "18" | "20";
|
||||
type SlideOption = "5" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20";
|
||||
|
||||
// Constants
|
||||
const SLIDE_OPTIONS: SlideOption[] = ["5", "8", "10", "12", "15", "18", "20"];
|
||||
const SLIDE_OPTIONS: SlideOption[] = ["5", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
|
||||
|
||||
/**
|
||||
* Renders a select component for slide count
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue