Location: leafDex_Web/src/components/ui/Navbar.tsx
The Navbar component provides the main navigation interface for the application, including links to different sections and user actions.
interface NavbarProps {
// No props required as it's a standalone navigation component
}<MainLayout>
<Navbar />
<Outlet />
</MainLayout>Location: leafDex_Web/src/components/ui/PlantCard.tsx
Displays individual plant information in a card format, including image, name, and basic details.
interface PlantCardProps {
plant: {
id: string;
name: string;
image: string;
category: string;
// ... other plant properties
};
onEdit?: (id: string) => void;
onDelete?: (id: string) => void;
}<PlantCard plant={plantData} onEdit={handleEdit} onDelete={handleDelete} />Location: leafDex_Web/src/components/ui/PlantList.tsx
Renders a list of PlantCard components with optional filtering and sorting capabilities.
interface PlantListProps {
plants: Plant[];
onFilterChange?: (filter: FilterOptions) => void;
onSortChange?: (sort: SortOptions) => void;
}<PlantList
plants={plants}
onFilterChange={handleFilter}
onSortChange={handleSort}
/>Location: leafDex_Web/src/components/ui/SearchBar.tsx
Provides search functionality for plants with real-time filtering.
interface SearchBarProps {
onSearch: (query: string) => void;
placeholder?: string;
className?: string;
}<SearchBar onSearch={handleSearch} placeholder="Search plants..." />Location: leafDex_Web/src/components/ui/PlantForm.tsx
Form component for adding or editing plant information.
interface PlantFormProps {
initialData?: Plant;
onSubmit: (data: PlantFormData) => void;
onCancel: () => void;
}<PlantForm
initialData={existingPlant}
onSubmit={handleSubmit}
onCancel={handleCancel}
/>Location: leafDex_Web/src/pages/IdentifiedPlantsPage.tsx
Main page for displaying and managing identified plants.
No props required as it's a page component.
<Route path="/plants" element={<IdentifiedPlantsPage />} />Location: leafDex_Web/src/pages/AboutPage.tsx
Displays information about the LeafDex application and its features.
No props required as it's a page component.
<Route path="/about" element={<AboutPage />} />Location: leafDex_Web/src/pages/LoginPage.tsx
Handles user authentication and login functionality.
No props required as it's a page component.
<Route path="/login" element={<LoginPage />} />Location: leafDex_Web/src/pages/ContactPage.tsx
Provides contact information and a contact form for user inquiries.
No props required as it's a page component.
<Route path="/contact" element={<ContactPage />} />Location: leafDex_Web/src/pages/SignupPage.tsx
Handles new user registration and account creation.
No props required as it's a page component.
<Route path="/signup" element={<SignupPage />} />Location: leafDex_Web/src/uploadContext.tsx
Manages the state of uploaded plant images across the application.
interface ImageContextValue {
images: string[];
addImage: (img: string) => void;
}const { images, addImage } = useContext(ImageContext);Location: leafDex_Web/src/layouts/MainLayout.tsx
Provides the main application layout structure including the navbar and content area.
No props required as it's a layout component.
<Route element={<MainLayout />}>
<Route path="/" element={<HomePage />} />
<Route path="/about" element={<AboutPage />} />
</Route>All components use the shared styling system defined in styles/classes.ts. The styling system provides consistent classes for:
- Layout and spacing
- Typography
- Colors and themes
- Component-specific styles
ImageContext: Used by components that need to manage plant imagesAuthContext: Used by components that need authentication state
Components are organized into:
- Page components (in
/pages) - Layout components (in
/layouts) - UI components (in
/components/ui)
-
Component Organization
- Keep components focused and single-responsibility
- Use TypeScript interfaces for prop definitions
- Document complex props and behaviors
-
State Management
- Use context for global state
- Use local state for component-specific data
- Implement proper error handling
-
Styling
- Use the shared classes system
- Maintain consistent spacing and typography
- Follow responsive design principles
-
Performance
- Implement proper memoization where needed
- Optimize image loading
- Use lazy loading for routes