refactor(nextjs): remove unused files and clean up imports
This commit is contained in:
parent
2addb9ee65
commit
c649ec495c
14 changed files with 36 additions and 147 deletions
|
|
@ -82,7 +82,7 @@ const ImageEditor = ({
|
|||
if (isOpen && !previousGeneratedImages.length) {
|
||||
getPreviousGeneratedImage();
|
||||
}
|
||||
}, [isOpen, previousGeneratedImages]);
|
||||
}, [isOpen]);
|
||||
|
||||
// Handle close with animation
|
||||
const handleClose = () => {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { Trash2 } from 'lucide-react';
|
||||
import React from 'react'
|
||||
import { useGroupLayoutLoader } from '@/app/layout-preview/hooks/useGroupLayoutLoader';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { addNewSlide } from '@/store/slices/presentationGeneration';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
import { useGroupLayoutLoader } from '@/app/layout-preview/hooks/useGroupLayoutLoader';
|
||||
interface NewSlideProps {
|
||||
setShowNewSlideSelection: (show: boolean) => void;
|
||||
group: string;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { useGroupLayoutLoader } from '@/app/layout-preview/hooks/useGroupLayoutLoader';
|
||||
import { CheckCircle } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { LayoutGroup } from "../types/index";
|
||||
|
||||
import { useGroupLayoutLoader } from '@/app/layout-preview/hooks/useGroupLayoutLoader';
|
||||
interface GroupLayoutsProps {
|
||||
group: LayoutGroup;
|
||||
onSelectLayoutGroup: (group: LayoutGroup) => void;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import { useSelector } from "react-redux";
|
|||
import { RootState } from "@/store/store";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import PresentationMode from "../../components/PresentationMode";
|
||||
import SidePanel from "../components/SidePanel";
|
||||
import SlideContent from "../components/SlideContent";
|
||||
import Header from "../components/Header";
|
||||
import SidePanel from "./SidePanel";
|
||||
import SlideContent from "./SlideContent";
|
||||
import Header from "./Header";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { AlertCircle, Loader2 } from "lucide-react";
|
||||
import Help from "./Help";
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { getHeader, getHeaderForFormData } from "./header";
|
||||
import { IconSearch, ImageGenerate, ImageSearch, PreviousGeneratedImagesResponse } from "./params";
|
||||
export class PresentationGenerationApi {
|
||||
|
||||
|
||||
static async uploadDoc(documents: File[]) {
|
||||
const formData = new FormData();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
class SettingsStore {
|
||||
private settingsPath: string | undefined;
|
||||
private settings: { [key: string]: any };
|
||||
|
||||
constructor() {
|
||||
this.settings = {};
|
||||
this.loadSettings();
|
||||
}
|
||||
|
||||
private getSettingsPath() {
|
||||
if (this.settingsPath) return this.settingsPath;
|
||||
this.settingsPath = path.join(process.env.APP_DATA_DIRECTORY!, 'settings.json');
|
||||
return this.settingsPath;
|
||||
}
|
||||
|
||||
private loadSettings() {
|
||||
try {
|
||||
const settingsPath = this.getSettingsPath();
|
||||
if (fs.existsSync(settingsPath)) {
|
||||
const data = fs.readFileSync(settingsPath, 'utf-8');
|
||||
this.settings = JSON.parse(data);
|
||||
|
||||
} else {
|
||||
this.settings = {};
|
||||
this.saveSettings();
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading settings:', error);
|
||||
this.settings = {};
|
||||
}
|
||||
}
|
||||
|
||||
private saveSettings() {
|
||||
try {
|
||||
const settingsPath = this.getSettingsPath();
|
||||
fs.writeFileSync(settingsPath, JSON.stringify(this.settings, null, 2));
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error saving settings:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get(key: string, defaultValue: any = null): any {
|
||||
const value = this.settings[key];
|
||||
|
||||
return value || defaultValue;
|
||||
}
|
||||
|
||||
set(key: string, value: any): void {
|
||||
|
||||
this.settings[key] = value;
|
||||
this.saveSettings();
|
||||
}
|
||||
|
||||
// Helper method to check if settings exist
|
||||
has(key: string): boolean {
|
||||
return key in this.settings;
|
||||
}
|
||||
|
||||
// Helper method to delete a setting
|
||||
delete(key: string): void {
|
||||
delete this.settings[key];
|
||||
this.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
// Export a singleton instance
|
||||
export const settingsStore = new SettingsStore();
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
import { settingsStore } from "@/app/(presentation-generator)/services/setting-store";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
const FOOTER_KEY = 'footer';
|
||||
// GET handler to retrieve properties
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const properties = settingsStore.get(FOOTER_KEY);
|
||||
|
||||
if (!properties) {
|
||||
return NextResponse.json({ properties: null });
|
||||
}
|
||||
|
||||
return NextResponse.json({ properties });
|
||||
} catch (error) {
|
||||
console.error('Error retrieving footer properties:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to retrieve footer properties' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// POST handler to save properties
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { properties } = body;
|
||||
|
||||
if (!properties) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Properties are required' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// Validate required properties
|
||||
if (!properties.logoProperties || !properties.footerMessage) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid footer properties structure' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
settingsStore.set(FOOTER_KEY, properties);
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
properties
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error saving footer properties:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to save footer properties' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,7 +87,6 @@ export default function RootLayout({
|
|||
className={`${inter.variable} ${roboto.variable} ${instrument_sans.variable} antialiased`}
|
||||
>
|
||||
<Providers>
|
||||
|
||||
<LayoutProvider>
|
||||
{children}
|
||||
</LayoutProvider>
|
||||
|
|
|
|||
26
servers/nextjs/app/schema/page.tsx
Normal file
26
servers/nextjs/app/schema/page.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
'use client'
|
||||
import React from 'react'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { useLayout } from '../(presentation-generator)/context/LayoutContext'
|
||||
const page = () => {
|
||||
const searchParams = useSearchParams()
|
||||
const group = searchParams.get('group')
|
||||
const { getLayoutsByGroup, loading } = useLayout()
|
||||
if (!group) {
|
||||
return <div>No group provided</div>
|
||||
}
|
||||
const layouts = getLayoutsByGroup(group)
|
||||
return (
|
||||
<div>
|
||||
{loading ? (
|
||||
<div>Loading...</div>
|
||||
) : (
|
||||
<div data-layouts={JSON.stringify(layouts)}>
|
||||
<pre>{JSON.stringify(layouts, null, 2)}</pre>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default page
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import React from "react";
|
||||
import * as z from "zod";
|
||||
|
||||
import { ImageSchema, IconSchema } from "../defaultSchemes";
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const OurServiceSlide = ({ data }: { data: Partial<SchemaType> }) => {
|
|||
{bulletPoints && bulletPoints.map((point, index) => (
|
||||
<div key={index} className="text-base font-semibold text-gray-800 tracking-wide">
|
||||
<div className="flex gap-3 items-center">
|
||||
<div className="w-8 h-8 bg-teal-700 rounded-full "></div>
|
||||
<div className="min-w-8 min-h-8 bg-teal-700 rounded-full "></div>
|
||||
<p className="text-lg font-medium text-gray-800 tracking-wide">{point}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from "react";
|
||||
import * as z from "zod";
|
||||
import { ImageSchema, IconSchema } from "../defaultSchemes";
|
||||
import { ChartContainer, ChartTooltip, ChartTooltipContent } from '@/components/ui/chart';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from "react";
|
||||
import * as z from "zod";
|
||||
import { ImageSchema, IconSchema } from "../defaultSchemes";
|
||||
import { ChartContainer, ChartTooltip, ChartTooltipContent } from '@/components/ui/chart';
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
||||
Loading…
Add table
Reference in a new issue