Add components and hooks for event theme management
Introduced the `usePresignedUpload` hook for file uploads and multiple components for event theme management, including form handling, asset uploads, and UI enhancements. These additions support creating, editing, and managing event themes effectively.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useEventThemes } from "@/context/event-theme-context";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { EventThemeForm } from "@/components/event-themes/event-theme-form";
|
||||
|
||||
export default function EditThemePage() {
|
||||
const params = useParams();
|
||||
const themeId = params.id as string;
|
||||
const { theme, isLoadingTheme, fetchThemeById } = useEventThemes();
|
||||
|
||||
useEffect(() => {
|
||||
if (themeId) {
|
||||
fetchThemeById(themeId);
|
||||
}
|
||||
}, [themeId, fetchThemeById]);
|
||||
|
||||
if (isLoadingTheme) {
|
||||
return (
|
||||
<Card className="w-full flex justify-center items-center p-12">
|
||||
<CardContent>
|
||||
<div className="flex flex-col items-center space-y-4">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-primary" />
|
||||
<p className="text-lg text-gray-600">Loading theme...</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
if (!theme) {
|
||||
return (
|
||||
<Card className="w-full p-12">
|
||||
<CardContent>
|
||||
<div className="text-center text-red-600">
|
||||
<h2 className="text-xl font-semibold">Theme not found</h2>
|
||||
<p className="mt-2">
|
||||
The theme you are trying to edit could not be found.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container mx-auto py-6 space-y-6">
|
||||
<h1 className="text-3xl font-bold">Edit Theme: {theme.name}</h1>
|
||||
<p className="text-gray-600">
|
||||
Make changes to your theme. These changes will affect all events using
|
||||
this theme.
|
||||
</p>
|
||||
<EventThemeForm mode="edit" theme={theme} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
17
frontend/src/app/(main)/dashboard/event-themes/new/page.tsx
Normal file
17
frontend/src/app/(main)/dashboard/event-themes/new/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { EventThemeForm } from "@/components/event-themes/event-theme-form";
|
||||
|
||||
export default function NewThemePage() {
|
||||
return (
|
||||
<div className="container mx-auto py-6 space-y-6">
|
||||
<h1 className="text-3xl font-bold">Create New Theme</h1>
|
||||
<p className="text-gray-600">
|
||||
Create a new theme for your events. Themes control the visual appearance
|
||||
of your invitation pages and can include colors, fonts, and images.
|
||||
</p>
|
||||
<EventThemeForm mode="create" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user