diff --git a/ClyCites-Emarket/README.md b/ClyCites-Emarket/README.md index cba1122..3bdcc6a 100644 --- a/ClyCites-Emarket/README.md +++ b/ClyCites-Emarket/README.md @@ -1,2 +1,306 @@ -# ClyCites-Emarket +
+ ClyCites E-Market Logo +

ClyCites E-Market

+

A comprehensive agricultural marketplace platform connecting farmers directly with buyers

+ +
+ Next.js + React + TypeScript + Tailwind CSS + Prisma +
+
+ +## πŸ“‹ Table of Contents + +- [Module Overview](#module-overview) +- [Key Features](#key-features) +- [Tech Stack](#tech-stack) +- [Folder Structure](#folder-structure) +- [Setup Instructions](#setup-instructions) +- [Environment Variables](#environment-variables) +- [Available Scripts](#available-scripts) +- [Contribution Guidelines](#contribution-guidelines) + +## 🌱 Module Overview + +ClyCites E-Market is a dedicated marketplace module within the ClyCites ecosystem that enables farmers to sell their agricultural products directly to buyers. This module eliminates intermediaries, ensuring fair pricing and better market access for farmers while providing buyers with fresh, locally-sourced produce. + +The platform features both a customer-facing storefront and an administrative back-office, creating a complete e-commerce solution tailored for agricultural products. + +## πŸš€ Key Features + +### Customer-Facing Features +- **πŸͺ Product Marketplace**: Browse and search agricultural products by category, location, and season +- **πŸ›’ Shopping Cart**: Add to cart, manage quantities, and checkout seamlessly +- **πŸ‘€ User Authentication**: Secure login and registration for buyers and farmers +- **πŸ“± Farmer Profiles**: Dedicated dashboards for farmers to manage their products and orders +- **🎯 Local Markets**: Discover and connect with local agricultural markets +- **πŸ“¦ Order Management**: Track orders, delivery status, and purchase history +- **πŸ’¬ Customer Support**: Integrated support system for buyer and seller assistance + +### Administrative Features +- **πŸ“Š Analytics Dashboard**: Comprehensive sales, product, and user analytics +- **πŸ‘₯ User Management**: Manage buyers, farmers, and administrative users +- **πŸ“‹ Product Management**: Approve, feature, and manage product listings +- **πŸ’° Payment Integration**: Secure payment processing and transaction management +- **πŸ“ˆ Market Insights**: Data-driven insights for market trends and pricing + +### Technical Features +- **πŸ“± Responsive Design**: Mobile-first approach with full device compatibility +- **πŸŒ™ Dark/Light Theme**: Built-in theme switching capability +- **πŸ” Advanced Search**: Filter products by category, location, price, and more +- **πŸ“€ File Upload**: Image and document upload for product listings +- **πŸ”„ Real-time Updates**: Live inventory and order status updates + +## πŸ› οΈ Tech Stack + +### Frontend Framework +- **Next.js 15.1.5** - React framework with App Router and Turbopack +- **React 19** - Modern UI library with latest features +- **TypeScript 5** - Type-safe JavaScript development + +### Database & ORM +- **Prisma 6.6.0** - Modern database toolkit and ORM +- **PostgreSQL** - Primary database (configured via DATABASE_URL) + +### Authentication & Security +- **NextAuth 4.24.11** - Complete authentication solution +- **bcrypt** - Password hashing and security + +### UI & Styling +- **Tailwind CSS 3.3.2** - Utility-first CSS framework +- **Radix UI** - Accessible component primitives +- **Lucide React 0.473.0** - Modern icon library +- **Sass 1.89.1** - CSS preprocessor for advanced styling + +### E-commerce & Forms +- **React Hook Form 7.54.2** - Performant form handling +- **Uploadthing 7.5.2** - File upload solution +- **React Quill 2.0.0** - Rich text editor for product descriptions + +### Data Visualization +- **Chart.js 4.4.7** - Charts and analytics +- **React Chart.js 2 5.3.0** - React integration for Chart.js + +### Utilities & Libraries +- **Faker 9.4.0** - Data generation for development +- **clsx & tailwind-merge** - Conditional class utilities +- **React Hot Toast 2.5.1** - Notification system +- **Embla Carousel 8.6.0** - Carousel components + +## πŸ“ Folder Structure + +``` +ClyCites-Emarket/ +β”œβ”€β”€ app/ # Next.js app directory +β”‚ β”œβ”€β”€ (front-end)/ # Customer-facing application +β”‚ β”‚ β”œβ”€β”€ (buyer-dashboard)/ # Buyer dashboard pages +β”‚ β”‚ β”œβ”€β”€ (farmer-dashboard)/# Farmer dashboard pages +β”‚ β”‚ β”œβ”€β”€ about/ # About page +β”‚ β”‚ β”œβ”€β”€ careers/ # Careers page +β”‚ β”‚ β”œβ”€β”€ cart/ # Shopping cart functionality +β”‚ β”‚ β”œβ”€β”€ customer-support/ # Customer support pages +β”‚ β”‚ β”œβ”€β”€ faq/ # Frequently asked questions +β”‚ β”‚ β”œβ”€β”€ farmer-onboarding/ # Farmer registration flow +β”‚ β”‚ β”œβ”€β”€ features/ # Feature showcase +β”‚ β”‚ β”œβ”€β”€ how-it-works/ # How it works guide +β”‚ β”‚ β”œβ”€β”€ login/ # Login page +β”‚ β”‚ β”œβ”€β”€ markets/ # Local markets listing +β”‚ β”‚ β”œβ”€β”€ products/ # Product pages and listings +β”‚ β”‚ β”œβ”€β”€ register/ # User registration +β”‚ β”‚ β”œβ”€β”€ shop/ # Main shop interface +β”‚ β”‚ └── page.jsx # Homepage +β”‚ β”œβ”€β”€ (back-office)/ # Administrative interface +β”‚ β”‚ β”œβ”€β”€ dashboard/ # Admin dashboard pages +β”‚ β”‚ └── layout.js # Admin layout +β”‚ β”œβ”€β”€ api/ # API routes +β”‚ β”œβ”€β”€ layout.tsx # Root layout +β”‚ └── favicon.ico # Favicon +β”œβ”€β”€ components/ # React components +β”‚ β”œβ”€β”€ frontend/ # Customer-facing components +β”‚ β”œβ”€β”€ backend/ # Admin components +β”‚ └── ui/ # Reusable UI components +β”œβ”€β”€ context/ # React context providers +β”‚ └── Providers.jsx # Main context provider +β”œβ”€β”€ lib/ # Utility functions +β”‚ β”œβ”€β”€ apiRequest.js # API request utilities +β”‚ β”œβ”€β”€ db.js # Database connection +β”‚ β”œβ”€β”€ uploadthing.js # File upload configuration +β”‚ └── utils.ts # General utilities +β”œβ”€β”€ prisma/ # Database schema and migrations +β”œβ”€β”€ public/ # Static assets +β”œβ”€β”€ styles/ # Global styles +β”‚ └── main.scss # Main stylesheet +β”œβ”€β”€ data.json # Sample data for development +β”œβ”€β”€ package.json # Dependencies and scripts +β”œβ”€β”€ tailwind.config.js # Tailwind configuration +β”œβ”€β”€ tsconfig.json # TypeScript configuration +└── README.md # This file +``` + +## πŸš€ Setup Instructions + +### Prerequisites + +Make sure you have the following installed: +- [Node.js](https://nodejs.org/) (version 18 or higher) +- [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/) +- [PostgreSQL](https://www.postgresql.org/) (for database) +- [Git](https://git-scm.com/) + +### Installation + +1. **Clone the repository** (if not already done) + ```bash + git clone https://github.com/Saga211/ClyCites-Frontend.git + cd ClyCites-Frontend/ClyCites-Emarket + ``` + +2. **Install dependencies** + ```bash + npm install + ``` + +3. **Set up the database** + ```bash + # Ensure PostgreSQL is running + # Create database (replace with your credentials) + createdb clycites_emarket + + # Run Prisma migrations + npx prisma migrate dev + + # Generate Prisma client + npx prisma generate + ``` + +4. **Configure environment variables** (see Environment Variables section below) + +5. **Start the development server** + ```bash + npm run dev + ``` + +6. **Access the application** + - Frontend: [http://localhost:3000](http://localhost:3000) + - The app will automatically detect and route to front-end or back-office based on URL + +## πŸ”§ Environment Variables + +Create a `.env.local` file in the root of the ClyCites-Emarket directory: + +```env +# Database +DATABASE_URL="postgresql://username:password@localhost:5432/clycites_emarket" + +# Authentication +NEXTAUTH_SECRET="your-super-secret-key-here" +NEXTAUTH_URL="http://localhost:3000" + +# Uploadthing (for file uploads) +UPLOADTHING_SECRET="your-uploadthing-secret" +UPLOADTHING_APP_ID="your-uploadthing-app-id" + +# Optional: External services +# NEXT_PUBLIC_API_URL="http://localhost:8000" +``` + +### Getting Environment Variables + +1. **Database URL**: Set up your PostgreSQL database and use the connection string +2. **NEXTAUTH_SECRET**: Generate a secure random string: + ```bash + openssl rand -base64 32 + ``` +3. **Uploadthing**: Create an account at [uploadthing.com](https://uploadthing.com) to get your credentials + +## πŸ“œ Available Scripts + +```bash +npm run dev # Start development server with Turbopack +npm run build # Build for production +npm run start # Start production server +npm run lint # Run ESLint for code quality +``` + +### Additional Scripts + +```bash +npx prisma studio # Open Prisma Studio for database management +npx prisma migrate dev # Run database migrations +npx prisma generate # Generate Prisma client +``` + +## 🀝 Contribution Guidelines + +### Development Workflow + +1. **Create a feature branch** + ```bash + git checkout -b feature/your-feature-name + ``` + +2. **Follow coding standards** + - Use TypeScript for all new code + - Follow ESLint configuration + - Use Tailwind CSS for styling + - Write meaningful component names + +3. **Database changes** + - Modify Prisma schema for database changes + - Run `npx prisma migrate dev` to create migrations + - Update TypeScript types if needed + +4. **Testing** + - Test all functionality before submitting + - Ensure responsive design works on mobile devices + - Verify database operations work correctly + +### Component Guidelines + +- **Frontend Components**: Place in `components/frontend/` +- **Backend Components**: Place in `components/backend/` +- **UI Components**: Place in `components/ui/` for reusable elements +- **API Routes**: Place in `app/api/` following RESTful conventions + +### Code Style + +- **Components**: Use functional components with hooks +- **Styling**: Prefer Tailwind CSS classes over custom CSS +- **State Management**: Use React Context for global state +- **Forms**: Use React Hook Form for form handling +- **API Calls**: Use the provided `apiRequest.js` utility + +### Submitting Changes + +1. **Commit with descriptive messages** + ```bash + git commit -m "feat: add farmer dashboard analytics" + ``` + +2. **Push to your branch** + ```bash + git push origin feature/your-feature-name + ``` + +3. **Create a Pull Request** + - Provide clear description of changes + - Include screenshots for UI changes + - Request review from maintainers + +## πŸ“ž Support + +For questions or issues related to the E-Market module: +- Create an issue in the main repository +- Contact the development team +- Check existing documentation in the main ClyCites repository + +--- + +
+

Built with ❀️ for the agricultural community

+

Empowering farmers through digital marketplace solutions

+
diff --git a/ClyCites/app/globals.css b/ClyCites/app/globals.css index e8d347a..2a2f6f7 100644 --- a/ClyCites/app/globals.css +++ b/ClyCites/app/globals.css @@ -6,6 +6,78 @@ @tailwind components; @tailwind utilities; +/* Theme tokens used by Tailwind (bg-background, text-foreground, card, input, etc.) */ +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 47.4% 11.2%; + + --card: 0 0% 100%; + --card-foreground: 222.2 47.4% 11.2%; + + --popover: 0 0% 100%; + --popover-foreground: 222.2 47.4% 11.2%; + + --primary: 222.2 47.4% 11.2%; + --primary-foreground: 210 40% 98%; + + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 222.2 84% 4.9%; + + --radius: 0.5rem; + } + + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 212.7 26.8% 83.9%; + } + + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} + /* Global Reset */ * { margin: 0; diff --git a/ClyCites/app/layout.tsx b/ClyCites/app/layout.tsx index a53b6ed..d553ee9 100644 --- a/ClyCites/app/layout.tsx +++ b/ClyCites/app/layout.tsx @@ -5,6 +5,7 @@ import "./globals.css" import { Header } from "@/components/header" import { Footer } from "@/components/Footer" import { ThemeProvider } from "@/components/theme-provider" +import { I18nProvider } from "@/components/I18nProvider" export const metadata: Metadata = { title: "ClyCites - Digital Agriculture Platform", @@ -20,9 +21,11 @@ export default function RootLayout({ -
-
{children}
-