feat: implement event submission flow with image upload and modal interface
This commit is contained in:
@@ -17,6 +17,9 @@ export async function createBlogPost(data: {
|
||||
metaDescription?: string;
|
||||
publishedAt?: Date;
|
||||
status?: ContentStatus;
|
||||
coverPosition?: string;
|
||||
coverZoom?: number;
|
||||
sources?: any;
|
||||
}) {
|
||||
try {
|
||||
const slug = data.slug || generateSlug(data.title);
|
||||
@@ -51,6 +54,9 @@ export async function updateBlogPost(id: string, data: {
|
||||
metaDescription?: string;
|
||||
publishedAt?: Date;
|
||||
status?: ContentStatus;
|
||||
coverPosition?: string;
|
||||
coverZoom?: number;
|
||||
sources?: any;
|
||||
}) {
|
||||
try {
|
||||
const slug = data.slug || generateSlug(data.title);
|
||||
|
||||
@@ -18,6 +18,8 @@ export async function createEvent(data: {
|
||||
metaDescription?: string;
|
||||
publishedAt?: Date;
|
||||
status?: ContentStatus;
|
||||
coverPosition?: string;
|
||||
coverZoom?: number;
|
||||
}) {
|
||||
try {
|
||||
const slug = data.slug || generateSlug(data.title);
|
||||
@@ -53,6 +55,8 @@ export async function updateEvent(id: string, data: {
|
||||
metaDescription?: string;
|
||||
publishedAt?: Date;
|
||||
status?: ContentStatus;
|
||||
coverPosition?: string;
|
||||
coverZoom?: number;
|
||||
}) {
|
||||
try {
|
||||
const slug = data.slug || generateSlug(data.title);
|
||||
|
||||
@@ -27,6 +27,8 @@ export async function createSlide(data: any) {
|
||||
linkUrl: data.linkUrl || null,
|
||||
order: data.order || 0,
|
||||
isActive: data.isActive ?? true,
|
||||
coverPosition: data.coverPosition || "50% 50%",
|
||||
coverZoom: data.coverZoom || 1,
|
||||
}
|
||||
});
|
||||
revalidatePath("/slides");
|
||||
@@ -50,6 +52,8 @@ export async function updateSlide(id: string, data: any) {
|
||||
linkUrl: data.linkUrl || null,
|
||||
order: data.order || 0,
|
||||
isActive: data.isActive ?? true,
|
||||
coverPosition: data.coverPosition || "50% 50%",
|
||||
coverZoom: data.coverZoom || 1,
|
||||
}
|
||||
});
|
||||
revalidatePath("/slides");
|
||||
|
||||
@@ -14,7 +14,9 @@ export async function uploadImage(formData: FormData) {
|
||||
const buffer = Buffer.from(bytes);
|
||||
|
||||
// Create a unique filename
|
||||
const fileExtension = file.name.split('.').pop();
|
||||
let fileExtension = file.name.split('.').pop()?.toLowerCase() || 'jpg';
|
||||
if (fileExtension === 'jpeg') fileExtension = 'jpg';
|
||||
|
||||
const fileName = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}.${fileExtension}`;
|
||||
|
||||
// Path for the ROOT public/uploads (where the main site will look)
|
||||
|
||||
Reference in New Issue
Block a user