Directory Overview
Tienda ETCA follows a standard React application structure with clear separation of concerns. The source code is organized into logical directories based on functionality.Source Directory Structure
Detailed Directory Breakdown
/src/assets/ - Static Assets
/src/assets/ - Static Assets
Contains all static assets including images, icons, and media files.Files:
ETCAicon150.png(13.5 KB) - ETCA logo/iconarquero002a.webp(185 KB) - Archer imageloading.gif(1.4 MB) - Loading animationpinesETCA.jpg(490 KB) - ETCA location imagereact.svg(4.1 KB) - React logotresArquerosBochin.jpg(138 KB) - Three archers image
/src/auth/ - Authentication
/src/auth/ - Authentication
Contains authentication and authorization logic.Files:
RutaProtegida.jsx(15 lines) - Protected route wrapper component
- Implements role-based access control
- Redirects unauthorized users
- Wraps protected routes (e.g., admin panel)
/src/components/ - UI Components
/src/components/ - UI Components
Reusable components used throughout the application.Component Files:
Cart.jsx(126 lines) - Shopping cart modal with items listEquipo.jsx(29 lines) - Team/staff display componentFooter.jsx(49 lines) - Site footer with links and infoFormulario.jsx(55 lines) - Contact form componentFormularioEdicion.jsx(135 lines) - Product edit form for adminFormularioProducto.jsx(106 lines) - New product creation formHeader.jsx(44 lines) - Navigation header with cart iconListaUsuarios.jsx(37 lines) - User management listMain.jsx(29 lines) - Main content section componentMain2.jsx(29 lines) - Alternative main sectionNotFound.jsx(28 lines) - 404 error pageProduct.jsx(33 lines) - Individual product cardProductList.jsx(75 lines) - Product grid/list display
style/Footer.css- Footer component stylesstyle/Header.css- Header component stylesstyle/Modal.css- Modal component stylesstyle/NotFound.css- 404 page stylesstyle/Product.css- Product card styles
/src/context/ - State Management
/src/context/ - State Management
React Context providers for global state management.Files:Key Responsibilities:
AdminContext.jsx(135 lines) - Admin operations and product managementAuthContext.jsx(82 lines) - Authentication and user sessionCartContext.jsx(94 lines) - Shopping cart and product data
| Context | State Managed | API Calls |
|---|---|---|
| AuthContext | Authentication, user role, login form | users.json |
| CartContext | Cart items, products, search | GET products |
| AdminContext | Product CRUD, modals | POST/PUT/DELETE products |
/src/layout/ - Page Layouts
/src/layout/ - Page Layouts
Full-page layout components representing application routes.Files:
AcercaDe.jsx(70 lines) - About page (/acercade)Admin.jsx(69 lines) - Admin dashboard (/admin)Contacto.jsx(36 lines) - Contact page (/contacto)DetallesProductos.jsx(47 lines) - Product detail page (/productos/:id)GaleriaProductos.jsx(32 lines) - Product gallery (/productos)Home.jsx(50 lines) - Homepage (/)Login.jsx(54 lines) - Login page (/login)layoutMain.css- Shared layout styles
Root Files
Application Entry Point
Styling Files
- index.css - Global CSS reset and base styles
- App.css - Application-level styling
- Component-specific CSS - Located in
components/style/
File Naming Conventions
Components
PascalCase:
ProductList.jsx, Header.jsxContexts
PascalCase with Context suffix:
CartContext.jsxStyles
PascalCase matching component:
Header.cssAssets
camelCase or descriptive:
pinesETCA.jpgComponent Size Distribution
Here’s a breakdown of component complexity by line count:| Category | Component | Lines | Purpose |
|---|---|---|---|
| Large | FormularioEdicion.jsx | 135 | Complex edit form with validation |
| AdminContext.jsx | 135 | Full CRUD operations | |
| Cart.jsx | 126 | Cart UI with item management | |
| Medium | FormularioProducto.jsx | 106 | New product form |
| CartContext.jsx | 94 | Cart state + API | |
| AuthContext.jsx | 82 | Authentication logic | |
| ProductList.jsx | 75 | Product grid rendering | |
| Small | Most layout components | 30-70 | Page structure |
| UI components | 20-50 | Focused functionality |
Import Patterns
Context Usage
Component Imports
Asset Imports
Build Configuration
The project uses Vite as the build tool. Key configuration details:- Entry Point:
src/main.jsx - Build Tool: Vite 6.3.1
- Plugin: @vitejs/plugin-react 4.3.4
- Output: Optimized production bundle
Development Workflow
Best Practices
Next Steps
Architecture
Learn about the application architecture
Technologies
Explore the tech stack details