diff --git a/alimento-nextjs/.env.example b/alimento-nextjs/.env.example index 36157c9..9e52350 100644 --- a/alimento-nextjs/.env.example +++ b/alimento-nextjs/.env.example @@ -1 +1,22 @@ -DATABASE_URL="your mongodb url" \ No newline at end of file +# Database URL for MongoDB connection +# Format: "mongodb+srv://:@/" +DATABASE_URL="your_mongodb_connection_string_here" + +# SMTP Configuration for Email Services +# Replace with your SMTP provider's details if not using Gmail. +SMTP_HOST="smtp.gmail.com" # SMTP server host +SMTP_PORT=587 # SMTP server port (587 for TLS) +SMTP_SECURE=false # Use false for TLS/STARTTLS, true for SSL +SMTP_USER="your_email@example.com" # Email address to send from +SMTP_PASS="your_smtp_password_here" # SMTP password or app-specific password for Gmail + +# NextAuth Configuration +# NEXTAUTH_URL: Set to your app's URL for production; use http://localhost:3000 for local development. +NEXTAUTH_URL="http://localhost:3000" # Base URL for NextAuth authentication +NEXTAUTH_SECRET="your_nextauth_secret_here" # Secret used to sign NextAuth tokens + +# Cloudinary Configuration for Image Uploads +# Replace these with your Cloudinary account details for image uploads. +NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="your_cloud_name_here" # Cloudinary cloud name +NEXT_PUBLIC_CLOUDINARY_CLOUD_PRESET="your_upload_preset" # Cloudinary upload preset + diff --git a/alimento-nextjs/actions/dish/dishCREATE.ts b/alimento-nextjs/actions/dish/dishCREATE.ts index 678842a..d05edb3 100644 --- a/alimento-nextjs/actions/dish/dishCREATE.ts +++ b/alimento-nextjs/actions/dish/dishCREATE.ts @@ -10,6 +10,7 @@ export async function createDish({ category, tags, vendorId, + images, }: { name: string; description?: string; @@ -17,6 +18,7 @@ export async function createDish({ category: Category; tags: Tag[]; vendorId: string; + images: string[] }): Promise<{ success: boolean; error?: string; data?: Dish }> { try { const newDish = await prismadb.dish.create({ @@ -27,6 +29,9 @@ export async function createDish({ category, tags, vendorId, + images: { + create: images.map(url => ({ url })), // Assuming you're passing URLs + }, }, }); return { success: true, data: newDish }; diff --git a/alimento-nextjs/components/multistepForm/components/sidebarConstants.tsx b/alimento-nextjs/components/multistepForm/components/sidebarConstants.tsx index bb2a25a..0f9630d 100644 --- a/alimento-nextjs/components/multistepForm/components/sidebarConstants.tsx +++ b/alimento-nextjs/components/multistepForm/components/sidebarConstants.tsx @@ -14,5 +14,10 @@ export const data = [ step: 'step 3', title: 'select tags', }, + { + id: 4, + step: 'step 4', + title: 'add images', + }, ]; \ No newline at end of file diff --git a/alimento-nextjs/components/multistepForm/pages/formPage4.tsx b/alimento-nextjs/components/multistepForm/pages/formPage4.tsx new file mode 100644 index 0000000..802dfc4 --- /dev/null +++ b/alimento-nextjs/components/multistepForm/pages/formPage4.tsx @@ -0,0 +1,25 @@ +import ImageUpload from '@/components/ui/imageUpload'; +import { useGlobalDish } from '@/context/dishFormContext'; + +const FormPage4 = () => { + const { imageUrl, handleImageChange, handleImageRemove } = useGlobalDish(); + + return ( +
+

+ Add Images +

+

+ Please add some images for your listing +
+

+ imageUrl)} + onChange={handleImageChange} + onRemove={handleImageRemove} + /> +
+ ); +}; + +export default FormPage4; diff --git a/alimento-nextjs/components/multistepForm/pages/main.tsx b/alimento-nextjs/components/multistepForm/pages/main.tsx index 194431a..6354526 100644 --- a/alimento-nextjs/components/multistepForm/pages/main.tsx +++ b/alimento-nextjs/components/multistepForm/pages/main.tsx @@ -5,6 +5,8 @@ import { Toaster } from 'react-hot-toast'; import FormPage1 from './formPage1'; import FormPage2 from './formPage2'; import TagSelector from './formPage3'; +import FormPage3 from './formPage3'; +import FormPage4 from './formPage4'; const Main = ({ VendorId }: { VendorId: string }) => { const { @@ -77,7 +79,8 @@ const Main = ({ VendorId }: { VendorId: string }) => { {currentStep === 1 && } {currentStep === 2 && } - {currentStep === 3 && } + {currentStep === 3 && } + {currentStep === 4 && } {!formCompleted && (