fix(nextjs): fix build error & remove theme apis
This commit is contained in:
parent
dece7399d4
commit
c583590c2f
5 changed files with 20 additions and 92 deletions
|
|
@ -4,7 +4,6 @@ import { mount } from 'cypress/react'
|
|||
import { store } from '@/store/store'
|
||||
import { Provider } from 'react-redux'
|
||||
import { AppRouterContext } from 'next/dist/shared/lib/app-router-context.shared-runtime'
|
||||
import { Toaster } from '@/components/ui/toaster'
|
||||
|
||||
// Import global styles
|
||||
import '@/app/globals.css'
|
||||
|
|
@ -34,7 +33,6 @@ Cypress.Commands.add('mount', (component, options = {}) => {
|
|||
<AppRouterContext.Provider value={router}>
|
||||
<Provider store={store}>
|
||||
{children}
|
||||
<Toaster />
|
||||
</Provider>
|
||||
</AppRouterContext.Provider>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { defaultColors } from "@/app/(presentation-generator)/store/themeSlice";
|
||||
|
||||
|
||||
export const GET = async (request: NextRequest) => {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const themeName = searchParams.get("theme") ?? "light";
|
||||
|
||||
const theme = {
|
||||
name: themeName,
|
||||
colors: defaultColors[themeName as keyof typeof defaultColors],
|
||||
}
|
||||
|
||||
return NextResponse.json(theme);
|
||||
};
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
import { settingsStore } from "@/app/(presentation-generator)/services/setting-store";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
const THEME_KEY = 'theme';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const theme = settingsStore.get(THEME_KEY);
|
||||
|
||||
if (!theme) {
|
||||
return NextResponse.json({ theme: null });
|
||||
}
|
||||
|
||||
return NextResponse.json({ theme });
|
||||
} catch (error) {
|
||||
console.error('Error retrieving theme:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to retrieve theme' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { themeData } = body;
|
||||
|
||||
if (!themeData || !themeData.name || !themeData.colors) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid theme data' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
settingsStore.set(THEME_KEY, themeData);
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
theme: themeData
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error saving theme:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to save theme' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -111,10 +111,8 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
|
||||
const renderSVGIcon = (iconText: string) => {
|
||||
// If it's an emoji, return as is
|
||||
if (/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/u.test(iconText)) {
|
||||
return <span className="text-2xl">{iconText}</span>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// For non-emoji, create a simple circle with text
|
||||
return (
|
||||
<div className="w-8 h-8 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-sm font-bold">
|
||||
|
|
@ -126,11 +124,11 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
return (
|
||||
<>
|
||||
{/* Import Google Fonts */}
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap"
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
|
||||
<div
|
||||
className="w-full rounded-sm max-w-[1280px] shadow-md h-[720px] flex flex-col aspect-video bg-stone-100 relative z-20 mx-auto overflow-hidden"
|
||||
style={{
|
||||
|
|
@ -139,11 +137,11 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
>
|
||||
{/* Glass overlay background */}
|
||||
<div className="absolute inset-0 bg-white/20 backdrop-blur-sm rounded-sm border border-slate-200"></div>
|
||||
|
||||
|
||||
<div className="relative z-10 flex flex-col w-full h-full p-4 sm:p-6 lg:p-8">
|
||||
{/* Header section */}
|
||||
<div className="flex-shrink-0 h-12 sm:h-16 flex items-center justify-center">
|
||||
<h1
|
||||
<h1
|
||||
className="text-3xl font-bold text-gray-900 leading-tight text-center"
|
||||
style={{
|
||||
fontFamily: 'Space Grotesk, sans-serif'
|
||||
|
|
@ -159,8 +157,8 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
<div className="w-full max-w-5xl">
|
||||
<div className={`grid ${getGridLayout()} gap-6 content-center`}>
|
||||
{items.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
<div
|
||||
key={index}
|
||||
className={`backdrop-blur-sm rounded-xl border shadow-md p-4 sm:p-6 ${getBackgroundColor(item.status)}`}
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
|
|
@ -168,11 +166,11 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
<div className="flex-shrink-0 mt-1">
|
||||
{renderSVGIcon(item.icon)}
|
||||
</div>
|
||||
|
||||
|
||||
{/* Content */}
|
||||
<div className="flex-1">
|
||||
{/* Heading */}
|
||||
<h3
|
||||
<h3
|
||||
className={`text-lg font-semibold leading-tight mb-2 ${getStatusColor(item.status)}`}
|
||||
style={{
|
||||
fontFamily: 'Space Grotesk, sans-serif'
|
||||
|
|
@ -180,9 +178,9 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
>
|
||||
{item.heading}
|
||||
</h3>
|
||||
|
||||
|
||||
{/* Description */}
|
||||
<p
|
||||
<p
|
||||
className="text-sm text-gray-500 leading-relaxed"
|
||||
style={{
|
||||
fontFamily: 'Nunito, sans-serif'
|
||||
|
|
@ -201,7 +199,7 @@ const TextIconListSlideLayout: React.FC<TextIconListSlideLayoutProps> = ({ data:
|
|||
|
||||
{/* Bottom Description section */}
|
||||
<div className="flex-shrink-0 h-16 sm:h-20 flex items-center justify-center">
|
||||
<p
|
||||
<p
|
||||
className="text-sm sm:text-base text-center text-gray-700 leading-relaxed max-w-4xl px-4"
|
||||
style={{
|
||||
fontFamily: 'Nunito, sans-serif'
|
||||
|
|
|
|||
|
|
@ -30,21 +30,17 @@ interface BasicInfoSlideLayoutProps {
|
|||
}
|
||||
|
||||
const BasicInfoSlideLayout: React.FC<BasicInfoSlideLayoutProps> = ({ data: slideData }) => {
|
||||
// Generate initials from presenter name
|
||||
const getInitials = (name: string) => {
|
||||
return name.split(' ').map(word => word.charAt(0).toUpperCase()).join('');
|
||||
};
|
||||
|
||||
const presenterInitials = getInitials(slideData?.presenterName || 'John Doe');
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Import Google Fonts */}
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap"
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<div
|
||||
|
||||
<div
|
||||
className="w-full rounded-sm max-w-[1280px] shadow-lg max-h-[720px] aspect-video bg-white relative z-20 mx-auto overflow-hidden"
|
||||
style={{
|
||||
fontFamily: 'Poppins, sans-serif'
|
||||
|
|
@ -80,7 +76,7 @@ const BasicInfoSlideLayout: React.FC<BasicInfoSlideLayoutProps> = ({ data: slide
|
|||
{slideData?.description || 'Our product offers customizable dashboards for real-time reporting and data-driven decisions. It integrates with third-party tools to enhance operations and scales with business growth for improved efficiency.'}
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue