diff --git a/frontend/app/(sidebar)/hub/[id]/page.tsx b/frontend/app/(sidebar)/hub/[id]/page.tsx new file mode 100644 index 0000000..7269159 --- /dev/null +++ b/frontend/app/(sidebar)/hub/[id]/page.tsx @@ -0,0 +1,295 @@ +"use client"; + +import { useState, useEffect } from "react"; +import Link from "next/link"; +import Image from "next/image"; +import { ArrowLeft, Calendar, Clock, Share2, Bookmark, ChevronUp } from "lucide-react"; + +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; + +// Sample blog data - in a real app, you would fetch this based on the ID +const blog = { + id: 1, + title: "Sustainable Farming Practices for Modern Agriculture", + description: "Learn about eco-friendly farming techniques that can increase yield while preserving the environment.", + date: "2023-05-15", + author: "Emma Johnson", + authorRole: "Agricultural Specialist", + authorImage: "/placeholder.svg?height=100&width=100", + topic: "Sustainability", + image: "/placeholder.svg?height=600&width=1200", + readTime: "5 min read", + content: ` +

Sustainable farming is not just a trend; it's a necessary evolution in agricultural practices to ensure food security for future generations while minimizing environmental impact. This article explores practical, eco-friendly farming techniques that can increase yield while preserving our precious natural resources.

+ +

The Importance of Sustainable Agriculture

+ +

As the global population continues to grow, the demand for food increases, putting pressure on farmers to produce more. However, conventional farming methods often lead to soil degradation, water pollution, and biodiversity loss. Sustainable farming addresses these challenges by working with natural processes rather than against them.

+ +

Key benefits of sustainable farming include:

+ + + +

Crop Rotation and Diversification

+ +

One of the simplest yet most effective sustainable farming practices is crop rotation. By alternating different crops in the same area across growing seasons, farmers can break pest cycles, improve soil structure, and enhance nutrient availability.

+ +

Diversification goes hand in hand with rotation. Growing a variety of crops rather than practicing monoculture helps spread risk, improves ecological balance, and can provide multiple income streams for farmers.

+ +

Integrated Pest Management (IPM)

+ +

IPM is an ecosystem-based approach that focuses on long-term prevention of pests through a combination of techniques such as biological control, habitat manipulation, and resistant crop varieties. Chemical pesticides are used only when monitoring indicates they are needed according to established guidelines.

+ +

This approach reduces pesticide use, minimizes environmental impact, and helps prevent the development of pesticide-resistant pests.

+ +

Water Conservation Techniques

+ +

Water is a precious resource, and sustainable farming emphasizes its efficient use. Drip irrigation systems deliver water directly to plant roots, reducing evaporation and runoff. Rainwater harvesting systems capture and store rainfall for later use during dry periods.

+ +

Additionally, selecting drought-resistant crop varieties and implementing proper soil management practices can significantly reduce water requirements.

+ +

Soil Health Management

+ +

Healthy soil is the foundation of sustainable agriculture. Practices such as minimal tillage, cover cropping, and the application of organic matter help maintain soil structure, prevent erosion, and enhance fertility.

+ +

Composting farm waste and applying it back to the fields creates a closed-loop system that reduces the need for synthetic fertilizers while improving soil quality.

+ +

Renewable Energy Integration

+ +

Modern sustainable farms are increasingly incorporating renewable energy sources such as solar panels, wind turbines, and biogas digesters. These technologies reduce dependence on fossil fuels, lower operational costs, and decrease the carbon footprint of agricultural operations.

+ +

Conclusion

+ +

Transitioning to sustainable farming practices requires knowledge, planning, and sometimes initial investment. However, the long-term benefits for farmers, communities, and the environment make it a worthwhile endeavor.

+ +

By adopting these eco-friendly techniques, farmers can ensure the viability of their operations while contributing to a healthier planet for future generations.

+ `, + tableOfContents: [ + { id: "importance", title: "The Importance of Sustainable Agriculture", level: 1 }, + { id: "crop-rotation", title: "Crop Rotation and Diversification", level: 1 }, + { id: "ipm", title: "Integrated Pest Management (IPM)", level: 1 }, + { id: "water-conservation", title: "Water Conservation Techniques", level: 1 }, + { id: "soil-health", title: "Soil Health Management", level: 1 }, + { id: "renewable-energy", title: "Renewable Energy Integration", level: 1 }, + { id: "conclusion", title: "Conclusion", level: 1 }, + ], + relatedArticles: [ + { + id: 2, + title: "Optimizing Fertilizer Usage for Maximum Crop Yield", + topic: "Fertilizers", + image: "/placeholder.svg?height=200&width=300", + }, + { + id: 4, + title: "Water Conservation Techniques for Drought-Prone Areas", + topic: "Sustainability", + image: "/placeholder.svg?height=200&width=300", + }, + { + id: 5, + title: "Organic Pest Control Methods That Actually Work", + topic: "Organic", + image: "/placeholder.svg?height=200&width=300", + }, + ], +}; + +export default function BlogPage() { + const [showScrollTop, setShowScrollTop] = useState(false); + + // Handle scroll to show/hide scroll to top button + useEffect(() => { + const handleScroll = () => { + setShowScrollTop(window.scrollY > 300); + }; + + window.addEventListener("scroll", handleScroll); + return () => window.removeEventListener("scroll", handleScroll); + }, []); + + // Scroll to top function + const scrollToTop = () => { + window.scrollTo({ top: 0, behavior: "smooth" }); + }; + + // Scroll to section function + const scrollToSection = (id: string) => { + const element = document.getElementById(id); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + }; + + return ( +
+ {/* Header */} +
+
+ + + +
+ + + + + + +

Share article

+
+
+
+ + + + + + + +

Save article

+
+
+
+
+
+
+ + {/* Main content */} +
+
+ {/* Article content */} +
+ {/* Topic badge */} +
+ {blog.topic} +
+ + {/* Article title */} +

{blog.title}

+ + {/* Article meta */} +
+
+ + {new Date(blog.date).toLocaleDateString()} +
+
+ + {blog.readTime} +
+ By {blog.author} +
+ + {/* Featured image */} +
+ {blog.title} +
+ + {/* Article description */} +

{blog.description}

+ + {/* Article content */} +
+ + {/* Author bio */} +
+
+
+ {blog.author} +
+
+

{blog.author}

+

{blog.authorRole}

+
+
+
+
+ + {/* Sidebar */} +
+ {/* Table of contents */} +
+ + + Table of Contents + + + + + + + {/* Related articles */} + + + Related Articles + + +
+ {blog.relatedArticles.map((article) => ( + +
+
+ {article.title} +
+
+

+ {article.title} +

+ + {article.topic} + +
+
+ + ))} +
+
+
+
+
+
+
+ + {/* Scroll to top button */} + {showScrollTop && ( + + )} +
+ ); +} diff --git a/frontend/app/(sidebar)/hub/page.tsx b/frontend/app/(sidebar)/hub/page.tsx new file mode 100644 index 0000000..787a2d4 --- /dev/null +++ b/frontend/app/(sidebar)/hub/page.tsx @@ -0,0 +1,259 @@ +"use client"; + +import { useState } from "react"; +import Link from "next/link"; +import Image from "next/image"; +import { CalendarIcon, ChevronRight, Leaf, Search } from "lucide-react"; + +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Badge } from "@/components/ui/badge"; +import { Separator } from "@/components/ui/separator"; +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; + +// Sample blog data +const blogs = [ + { + id: 1, + title: "Sustainable Farming Practices for Modern Agriculture", + description: + "Learn about eco-friendly farming techniques that can increase yield while preserving the environment.", + date: "2023-05-15", + author: "Emma Johnson", + topic: "Sustainability", + image: "/placeholder.svg?height=400&width=600", + readTime: "5 min read", + featured: true, + }, + { + id: 2, + title: "Optimizing Fertilizer Usage for Maximum Crop Yield", + description: "Discover the perfect balance of fertilizers to maximize your harvest without wasting resources.", + date: "2023-06-02", + author: "Michael Chen", + topic: "Fertilizers", + image: "/placeholder.svg?height=400&width=600", + readTime: "7 min read", + featured: false, + }, + { + id: 3, + title: "Seasonal Planting Guide: What to Grow and When", + description: + "A comprehensive guide to help you plan your planting schedule throughout the year for optimal results.", + date: "2023-06-18", + author: "Sarah Williams", + topic: "Plantation", + image: "/placeholder.svg?height=400&width=600", + readTime: "8 min read", + featured: false, + }, + { + id: 4, + title: "Water Conservation Techniques for Drought-Prone Areas", + description: "Essential strategies to maintain your crops during water shortages and drought conditions.", + date: "2023-07-05", + author: "David Rodriguez", + topic: "Sustainability", + image: "/placeholder.svg?height=400&width=600", + readTime: "6 min read", + featured: false, + }, + { + id: 5, + title: "Organic Pest Control Methods That Actually Work", + description: "Natural and effective ways to keep pests at bay without resorting to harmful chemicals.", + date: "2023-07-22", + author: "Lisa Thompson", + topic: "Organic", + image: "/placeholder.svg?height=400&width=600", + readTime: "9 min read", + featured: false, + }, + { + id: 6, + title: "The Future of Smart Farming: IoT and Agriculture", + description: "How Internet of Things technology is revolutionizing the way we monitor and manage farms.", + date: "2023-08-10", + author: "James Wilson", + topic: "Technology", + image: "/placeholder.svg?height=400&width=600", + readTime: "10 min read", + featured: true, + }, +]; + +// Extract unique topics from blogs +const topics = ["All", ...new Set(blogs.map((blog) => blog.topic))]; + +export default function KnowledgeHubPage() { + const [selectedTopic, setSelectedTopic] = useState("All"); + const [searchQuery, setSearchQuery] = useState(""); + + // Filter blogs based on selected topic and search query + const filteredBlogs = blogs.filter((blog) => { + const matchesTopic = selectedTopic === "All" || blog.topic === selectedTopic; + const matchesSearch = + blog.title.toLowerCase().includes(searchQuery.toLowerCase()) || + blog.description.toLowerCase().includes(searchQuery.toLowerCase()); + return matchesTopic && matchesSearch; + }); + + // Get featured blogs + const featuredBlogs = blogs.filter((blog) => blog.featured); + + return ( +
+ {/* Main content */} +
+
+
+ {/* Header */} +
+
+

Knowledge Hub

+

+ Explore our collection of articles, guides, and resources to help you grow better. +

+
+
+ + setSearchQuery(e.target.value)} + /> +
+
+ + {/* Featured article */} + {featuredBlogs.length > 0 && ( +
+

Featured Articles

+
+ {featuredBlogs.slice(0, 2).map((blog) => ( + +
+ {blog.title} +
+
+ {blog.topic} +

{blog.title}

+
+ + {new Date(blog.date).toLocaleDateString()} + + {blog.readTime} +
+
+
+ +
By {blog.author}
+ + + +
+ + ))} +
+
+ )} + + {/* Topic filters */} +
+

Browse by Topic

+
+ {topics.map((topic) => ( + + ))} +
+
+ + + + {/* Blog grid */} +
+ {filteredBlogs.length === 0 ? ( +
+

No articles found

+

+ Try adjusting your search or filter to find what you're looking for. +

+
+ ) : ( + filteredBlogs.map((blog) => ( + +
+ {blog.title} +
+ +
+ {blog.topic} +
{new Date(blog.date).toLocaleDateString()}
+
+ {blog.title} +
+ + {blog.description} + + +
By {blog.author}
+ + + +
+
+ )) + )} +
+ + {/* Pagination - simplified for this example */} + {filteredBlogs.length > 0 && ( +
+ + + + + +
+ )} +
+
+
+
+ ); +} diff --git a/frontend/app/(sidebar)/inventory/add-inventory-item.tsx b/frontend/app/(sidebar)/inventory/add-inventory-item.tsx new file mode 100644 index 0000000..34aea60 --- /dev/null +++ b/frontend/app/(sidebar)/inventory/add-inventory-item.tsx @@ -0,0 +1,115 @@ +"use client"; + +import { useState } from "react"; +import { CalendarIcon } from "lucide-react"; +import { format } from "date-fns"; + +import { Button } from "@/components/ui/button"; +import { Calendar } from "@/components/ui/calendar"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { cn } from "@/lib/utils"; + +export function AddInventoryItem() { + const [date, setDate] = useState(); + const [open, setOpen] = useState(false); + + return ( + + + + + + + Add Inventory Item + Add a new plantation or fertilizer item to your inventory. + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + + + + + +
+
+ + + +
+
+ ); +} diff --git a/frontend/app/(sidebar)/inventory/page.tsx b/frontend/app/(sidebar)/inventory/page.tsx new file mode 100644 index 0000000..eb6fab5 --- /dev/null +++ b/frontend/app/(sidebar)/inventory/page.tsx @@ -0,0 +1,183 @@ +"use client"; + +import { useState } from "react"; +import { Calendar, ChevronDown, Plus, Search } from "lucide-react"; + +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; +import { Pagination, PaginationContent, PaginationItem, PaginationLink } from "@/components/ui/pagination"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Calendar as CalendarComponent } from "@/components/ui/calendar"; +import { Badge } from "@/components/ui/badge"; + +export default function InventoryPage() { + const [date, setDate] = useState(); + const [inventoryType, setInventoryType] = useState("all"); + const [currentPage, setCurrentPage] = useState(1); + + // Sample inventory data + const inventoryItems = [ + { + id: 1, + name: "Tomato Seeds", + category: "Seeds", + type: "Plantation", + quantity: 500, + unit: "packets", + lastUpdated: "2023-03-01", + status: "In Stock", + }, + { + id: 2, + name: "NPK Fertilizer", + category: "Fertilizer", + type: "Fertilizer", + quantity: 200, + unit: "kg", + lastUpdated: "2023-03-05", + status: "Low Stock", + }, + { + id: 3, + name: "Corn Seeds", + category: "Seeds", + type: "Plantation", + quantity: 300, + unit: "packets", + lastUpdated: "2023-03-10", + status: "In Stock", + }, + { + id: 4, + name: "Organic Compost", + category: "Fertilizer", + type: "Fertilizer", + quantity: 150, + unit: "kg", + lastUpdated: "2023-03-15", + status: "In Stock", + }, + { + id: 5, + name: "Wheat Seeds", + category: "Seeds", + type: "Plantation", + quantity: 250, + unit: "packets", + lastUpdated: "2023-03-20", + status: "In Stock", + }, + ]; + + // Filter items based on selected type + const filteredItems = + inventoryType === "all" + ? inventoryItems + : inventoryItems.filter((item) => + inventoryType === "plantation" ? item.type === "Plantation" : item.type === "Fertilizer" + ); + + return ( +
+ {/* Main content */} +
+
+

Inventory

+ + {/* Filters and search */} +
+
+ + +
+ +
+ + + + + + + + + +
+ + +
+ + +
+
+ + {/* Table */} +
+

Table Fields

+ + + + Name + Category + Type + Quantity + Last Updated + Status + + + + {filteredItems.length === 0 ? ( + + + No inventory items found + + + ) : ( + filteredItems.map((item) => ( + + {item.name} + {item.category} + {item.type} + + {item.quantity} {item.unit} + + {item.lastUpdated} + + {item.status} + + + )) + )} + +
+
+
+
+
+ ); +}