feat(nextjs): present mode enabled

This commit is contained in:
shiva raj badu 2025-07-17 21:18:45 +05:45
parent afffb374c4
commit 49412fccad
4 changed files with 19 additions and 23 deletions

View file

@ -8,8 +8,8 @@ import {
Maximize2,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { renderSlideContent } from "./slide_config";
import { Slide } from "../types/slide";
import { useGroupLayouts } from "../hooks/useGroupLayouts";
interface PresentationModeProps {
@ -20,7 +20,6 @@ interface PresentationModeProps {
onFullscreenToggle: () => void;
onExit: () => void;
onSlideChange: (slideNumber: number) => void;
language: string;
}
const PresentationMode: React.FC<PresentationModeProps> = ({
@ -32,8 +31,9 @@ const PresentationMode: React.FC<PresentationModeProps> = ({
onFullscreenToggle,
onExit,
onSlideChange,
language,
}) => {
const { renderSlideContent } = useGroupLayouts();
// Modify the handleKeyPress to prevent default behavior
const handleKeyPress = useCallback(
(event: KeyboardEvent) => {
@ -193,7 +193,7 @@ const PresentationMode: React.FC<PresentationModeProps> = ({
data-theme={currentTheme}
>
{slides[currentSlide] &&
renderSlideContent(slides[currentSlide], language)}
renderSlideContent(slides[currentSlide])}
</div>
</div>
</div>

View file

@ -247,10 +247,8 @@ export const LayoutProvider: React.FC<{ children: ReactNode }> = ({ children })
// Return cached layout if available
if (layoutCache.has(cacheKey)) {
console.log(` Returning cached layout: ${cacheKey}`);
return layoutCache.get(cacheKey)!;
}
// Create and cache layout if not available
const file = fileInfo.fileName.replace('.tsx', '').replace('.ts', '');
const Layout = dynamic(

View file

@ -285,21 +285,19 @@ const PresentationPage = ({ presentation_id }: { presentation_id: string }) => {
);
};
// if (isPresentMode) {
// return (
// <PresentationMode
// slides={presentationData?.slides!}
// currentSlide={currentSlide}
// currentTheme={currentTheme}
// isFullscreen={isFullscreen}
// onFullscreenToggle={toggleFullscreen}
// onExit={handlePresentExit}
// onSlideChange={handleSlideChange}
// language={presentationData?.presentation?.language || "English"}
// />
// );
// }
if (isPresentMode) {
return (
<PresentationMode
slides={presentationData?.slides!}
currentSlide={currentSlide}
currentTheme={currentTheme}
isFullscreen={isFullscreen}
onFullscreenToggle={toggleFullscreen}
onExit={handlePresentExit}
onSlideChange={handleSlideChange}
/>
);
}
// Regular view
return (

View file

@ -39,7 +39,7 @@ const SlideContent = ({
);
// Use the centralized group layouts hook
const { getGroupLayout, renderSlideContent, loading } = useGroupLayouts();
const { getGroupLayout, loading } = useGroupLayouts();
// Memoized layout component to prevent re-renders
const LayoutComponent = useMemo(() => {
@ -158,7 +158,7 @@ const SlideContent = ({
{/* render slides */}
{loading ? <div className="flex flex-col bg-white aspect-video items-center justify-center h-full">
<Loader2 className="w-8 h-8 animate-spin" />
</div> : renderSlideContent(slide)}
</div> : slideContent}
{!showNewSlideSelection && (
<div className="group-hover:opacity-100 hidden md:block opacity-0 transition-opacity my-4 duration-300">