Skip to main content

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

Contains all static assets including images, icons, and media files.Files:
  • ETCAicon150.png (13.5 KB) - ETCA logo/icon
  • arquero002a.webp (185 KB) - Archer image
  • loading.gif (1.4 MB) - Loading animation
  • pinesETCA.jpg (490 KB) - ETCA location image
  • react.svg (4.1 KB) - React logo
  • tresArquerosBochin.jpg (138 KB) - Three archers image
Usage: Imported directly in components using relative paths or Vite’s asset handling.
Contains authentication and authorization logic.Files:
  • RutaProtegida.jsx (15 lines) - Protected route wrapper component
Purpose:
  • Implements role-based access control
  • Redirects unauthorized users
  • Wraps protected routes (e.g., admin panel)
Example:
Reusable components used throughout the application.Component Files:
  • Cart.jsx (126 lines) - Shopping cart modal with items list
  • Equipo.jsx (29 lines) - Team/staff display component
  • Footer.jsx (49 lines) - Site footer with links and info
  • Formulario.jsx (55 lines) - Contact form component
  • FormularioEdicion.jsx (135 lines) - Product edit form for admin
  • FormularioProducto.jsx (106 lines) - New product creation form
  • Header.jsx (44 lines) - Navigation header with cart icon
  • ListaUsuarios.jsx (37 lines) - User management list
  • Main.jsx (29 lines) - Main content section component
  • Main2.jsx (29 lines) - Alternative main section
  • NotFound.jsx (28 lines) - 404 error page
  • Product.jsx (33 lines) - Individual product card
  • ProductList.jsx (75 lines) - Product grid/list display
Style Files:
  • style/Footer.css - Footer component styles
  • style/Header.css - Header component styles
  • style/Modal.css - Modal component styles
  • style/NotFound.css - 404 page styles
  • style/Product.css - Product card styles
React Context providers for global state management.Files:
  • AdminContext.jsx (135 lines) - Admin operations and product management
  • AuthContext.jsx (82 lines) - Authentication and user session
  • CartContext.jsx (94 lines) - Shopping cart and product data
Context Hierarchy:
Key Responsibilities:
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
Route Mapping:

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.jsx

Contexts

PascalCase with Context suffix: CartContext.jsx

Styles

PascalCase matching component: Header.css

Assets

camelCase or descriptive: pinesETCA.jpg

Component Size Distribution

Here’s a breakdown of component complexity by line count:

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

1

Development Server

Run npm run dev to start Vite dev server with hot reload
2

Component Development

Create components in appropriate directory (components/, layout/, etc.)
3

Context Integration

Use existing contexts or create new ones in context/ directory
4

Routing

Add routes in App.jsx, create layout components for pages
5

Build

Run npm run build for production-optimized bundle

Best Practices

Component Organization
  • Keep components focused and single-responsibility
  • Use layout/ for full pages, components/ for reusable UI
  • Co-locate styles with components when possible
Context Usage
  • Use useContext hook or custom hooks (like useAuth)
  • Keep context logic separate from UI components
  • Organize related state in same context

Next Steps

Architecture

Learn about the application architecture

Technologies

Explore the tech stack details