Skip to content

Commit 9e6b429

Browse files
committed
Lazy loading de componentes y corregir warnings ESLint
1 parent 39a763c commit 9e6b429

File tree

7 files changed

+108
-84
lines changed

7 files changed

+108
-84
lines changed

src/App.vue

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup>
2-
import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
3-
import SimplexInput from './components/SimplexInput.vue'
4-
import SimplexSolution from './components/SimplexSolution.vue'
5-
import TransporteInput from './components/TransporteInput.vue'
6-
import CompararTodos from './components/CompararTodos.vue'
2+
import { ref, onMounted, onUnmounted, nextTick, watch, defineAsyncComponent } from 'vue'
73
import { vRipple } from './directives/ripple.js'
84
5+
const SimplexInput = defineAsyncComponent(() => import('./components/SimplexInput.vue'))
6+
const SimplexSolution = defineAsyncComponent(() => import('./components/SimplexSolution.vue'))
7+
const TransporteInput = defineAsyncComponent(() => import('./components/TransporteInput.vue'))
8+
const CompararTodos = defineAsyncComponent(() => import('./components/CompararTodos.vue'))
9+
910
// ===== ESTADO REACTIVO =====
1011
const numVariables = ref(2)
1112
const numConstraints = ref(2)
@@ -142,10 +143,10 @@ watch(currentView, (newVal) => {
142143
</div>
143144
<button
144145
v-ripple
145-
@click="startSolving('simplex')"
146146
class="btn-method btn-simplex"
147147
aria-label="Resolver con Método Simplex"
148148
:aria-busy="currentView === 'simplex'"
149+
@click="startSolving('simplex')"
149150
>
150151
Resolver con Simplex
151152
</button>
@@ -167,9 +168,9 @@ watch(currentView, (newVal) => {
167168
</div>
168169
<button
169170
v-ripple
170-
@click="startSolving('grafico')"
171171
class="btn-method btn-graphic"
172172
aria-label="Resolver con Método Gráfico"
173+
@click="startSolving('grafico')"
173174
>
174175
Resolver con Gráfico
175176
</button>
@@ -191,9 +192,9 @@ watch(currentView, (newVal) => {
191192
</div>
192193
<button
193194
v-ripple
194-
@click="startSolving('penalizacion')"
195195
class="btn-method btn-penalty"
196196
aria-label="Resolver con Métodos de Transporte"
197+
@click="startSolving('penalizacion')"
197198
>
198199
Resolver Transporte
199200
</button>
@@ -209,9 +210,9 @@ watch(currentView, (newVal) => {
209210
</div>
210211
<button
211212
v-ripple
212-
@click="startSolving('todos')"
213213
class="btn-compare-all"
214214
aria-label="Comparar todos los métodos disponibles"
215+
@click="startSolving('todos')"
215216
>
216217
Comparar Todos los Métodos
217218
</button>
@@ -280,21 +281,21 @@ watch(currentView, (newVal) => {
280281
<section v-else class="method-view" role="region" aria-label="Resolución de problemas">
281282
<!-- Navigation Bar -->
282283
<nav class="method-navigation" role="navigation" aria-label="Métodos disponibles">
283-
<button
284-
@click="backToWelcome"
284+
<button
285285
class="nav-back-btn"
286286
aria-label="Volver a inicio"
287+
@click="backToWelcome"
287288
>
288289
← Inicio
289290
</button>
290291

291292
<!-- Mobile Hamburger Button -->
292-
<button
293-
class="hamburger-btn"
294-
@click="mobileMenuOpen = !mobileMenuOpen"
293+
<button
294+
class="hamburger-btn"
295295
:class="{ open: mobileMenuOpen }"
296296
:aria-expanded="mobileMenuOpen"
297297
aria-label="Menú de métodos"
298+
@click="mobileMenuOpen = !mobileMenuOpen"
298299
>
299300
<span class="hamburger-line" aria-hidden="true"></span>
300301
<span class="hamburger-line" aria-hidden="true"></span>
@@ -304,42 +305,42 @@ watch(currentView, (newVal) => {
304305
<!-- Method Tabs -->
305306
<div class="method-tabs" :class="{ 'mobile-open': mobileMenuOpen }" role="tablist">
306307
<button
307-
@click="goToMethod('simplex')"
308-
:class="{ active: currentView === 'simplex' }"
309308
class="method-tab"
309+
:class="{ active: currentView === 'simplex' }"
310310
role="tab"
311311
:aria-selected="currentView === 'simplex'"
312312
aria-label="Método Simplex"
313+
@click="goToMethod('simplex')"
313314
>
314315
Método Simplex
315316
</button>
316317
<button
317-
@click="goToMethod('grafico')"
318-
:class="{ active: currentView === 'grafico' }"
319318
class="method-tab"
319+
:class="{ active: currentView === 'grafico' }"
320320
role="tab"
321321
:aria-selected="currentView === 'grafico'"
322322
aria-label="Método Gráfico"
323+
@click="goToMethod('grafico')"
323324
>
324325
Método Gráfico
325326
</button>
326327
<button
327-
@click="goToMethod('penalizacion')"
328-
:class="{ active: currentView === 'penalizacion' }"
329328
class="method-tab"
329+
:class="{ active: currentView === 'penalizacion' }"
330330
role="tab"
331331
:aria-selected="currentView === 'penalizacion'"
332332
aria-label="Métodos de Transporte"
333+
@click="goToMethod('penalizacion')"
333334
>
334335
Métodos de Transporte
335336
</button>
336337
<button
337-
@click="goToMethod('todos')"
338-
:class="{ active: currentView === 'todos' }"
339338
class="method-tab method-tab-all"
339+
:class="{ active: currentView === 'todos' }"
340340
role="tab"
341341
:aria-selected="currentView === 'todos'"
342342
aria-label="Comparar todos los métodos"
343+
@click="goToMethod('todos')"
343344
>
344345
Comparar Todos
345346
</button>
@@ -358,10 +359,10 @@ watch(currentView, (newVal) => {
358359
<SimplexInput
359360
v-else
360361
:key="currentView"
361-
v-model:numVariables="numVariables"
362-
v-model:numConstraints="numConstraints"
363-
v-model:problemType="problemType"
364-
:selectedMethod="selectedMethod"
362+
v-model:num-variables="numVariables"
363+
v-model:num-constraints="numConstraints"
364+
v-model:problem-type="problemType"
365+
:selected-method="selectedMethod"
365366
@solve="handleSolve"
366367
/>
367368
</div>
@@ -370,7 +371,7 @@ watch(currentView, (newVal) => {
370371
<!-- Sección de Solución -->
371372
<section v-if="currentView === 'solution' && problemData" class="solution-section" role="region" aria-label="Solución del problema">
372373
<SimplexSolution
373-
:problemData="problemData"
374+
:problem-data="problemData"
374375
@reset="handleNewProblem"
375376
/>
376377
</section>

src/components/CompararTodos.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,12 @@ const esProblemaTransporte = computed(() => {
531531
<label for="num-vars">Número de Variables:</label>
532532
<input
533533
id="num-vars"
534-
type="number"
535534
v-model.number="numVariables"
536-
@input="initializeMatrices"
535+
type="number"
537536
min="2"
538537
max="10"
539538
class="form-input"
539+
@input="initializeMatrices"
540540
>
541541
<small>Mínimo 2, Máximo 10</small>
542542
</div>
@@ -545,12 +545,12 @@ const esProblemaTransporte = computed(() => {
545545
<label for="num-constraints">Número de Restricciones:</label>
546546
<input
547547
id="num-constraints"
548-
type="number"
549548
v-model.number="numConstraints"
550-
@input="initializeMatrices"
549+
type="number"
551550
min="1"
552551
max="10"
553552
class="form-input"
553+
@input="initializeMatrices"
554554
>
555555
<small>Mínimo 1, Máximo 10</small>
556556
</div>
@@ -728,13 +728,13 @@ const esProblemaTransporte = computed(() => {
728728

729729
<!-- Botones de acción -->
730730
<div class="action-buttons">
731-
<button @click="loadExample" class="btn btn-secondary btn-example">
731+
<button class="btn btn-secondary btn-example" @click="loadExample">
732732
Cargar Ejemplo Simple (Simplex + Gráfico)
733733
</button>
734-
<button @click="loadTransportExample" class="btn btn-secondary btn-example">
734+
<button class="btn btn-secondary btn-example" @click="loadTransportExample">
735735
Cargar Ejemplo Transporte
736736
</button>
737-
<button @click="compareAllMethods" class="btn btn-secondary btn-solve-main">
737+
<button class="btn btn-secondary btn-solve-main" @click="compareAllMethods">
738738
Resolver y Comparar Métodos
739739
</button>
740740
</div>
@@ -879,7 +879,8 @@ const esProblemaTransporte = computed(() => {
879879
</tr>
880880
</thead>
881881
<tbody>
882-
<tr v-for="method in validationResults.transportComparison.methods" :key="method.name"
882+
<tr
883+
v-for="method in validationResults.transportComparison.methods" :key="method.name"
883884
:class="{ 'best-transport-row': method.name === validationResults.transportComparison.best.method }">
884885
<td>
885886
{{ method.name }}
@@ -919,7 +920,7 @@ const esProblemaTransporte = computed(() => {
919920

920921
<!-- Botón para nuevo problema al final -->
921922
<div class="final-actions">
922-
<button @click="resetComparison" class="btn btn-secondary btn-new-problem">
923+
<button class="btn btn-secondary btn-new-problem" @click="resetComparison">
923924
Nuevo Problema
924925
</button>
925926
</div>

src/components/MethodExplanation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ const headerDescription = computed(() => {
4141

4242
<div class="explanation-nav">
4343
<button
44-
@click="activeSection = 'intro'"
4544
:class="{ active: activeSection === 'intro' }"
4645
class="nav-btn"
46+
@click="activeSection = 'intro'"
4747
>
4848
Introducción
4949
</button>
5050
<button
51-
@click="activeSection = 'steps'"
5251
:class="{ active: activeSection === 'steps' }"
5352
class="nav-btn"
53+
@click="activeSection = 'steps'"
5454
>
5555
Pasos del Algoritmo
5656
</button>

src/components/SimplexInput.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,23 @@ initializeMatrices()
111111
<!-- Sistema de Pestañas -->
112112
<div class="tabs-container">
113113
<button
114-
@click="activeTab = 'calculadora'"
115114
:class="{ active: activeTab === 'calculadora' }"
116115
class="tab-btn"
116+
@click="activeTab = 'calculadora'"
117117
>
118118
Calculadora
119119
</button>
120120
<button
121-
@click="activeTab = 'pasoapaso'"
122121
:class="{ active: activeTab === 'pasoapaso' }"
123122
class="tab-btn"
123+
@click="activeTab = 'pasoapaso'"
124124
>
125125
Paso a Paso
126126
</button>
127127
<button
128-
@click="activeTab = 'teoria'"
129128
:class="{ active: activeTab === 'teoria' }"
130129
class="tab-btn"
130+
@click="activeTab = 'teoria'"
131131
>
132132
Teoría
133133
</button>
@@ -196,7 +196,7 @@ initializeMatrices()
196196
</div>
197197
</div>
198198

199-
<button @click="activeTab = 'calculadora'" class="btn-go-calculator">
199+
<button class="btn-go-calculator" @click="activeTab = 'calculadora'">
200200
Ir a la Calculadora
201201
</button>
202202
</div>
@@ -205,7 +205,7 @@ initializeMatrices()
205205
<!-- Contenido: Teoría -->
206206
<div v-else-if="activeTab === 'teoria'" class="tab-content">
207207
<div class="method-explanation-section">
208-
<MethodExplanation :selectedMethod="selectedMethod" />
208+
<MethodExplanation :selected-method="selectedMethod" />
209209
</div>
210210
</div>
211211

@@ -220,8 +220,8 @@ initializeMatrices()
220220
<label for="num-vars">Número de Variables:</label>
221221
<input
222222
id="num-vars"
223-
type="number"
224223
v-model.number="numVariables"
224+
type="number"
225225
min="1"
226226
max="10"
227227
class="form-input"
@@ -233,8 +233,8 @@ initializeMatrices()
233233
<label for="num-constraints">Número de Restricciones:</label>
234234
<input
235235
id="num-constraints"
236-
type="number"
237236
v-model.number="numConstraints"
237+
type="number"
238238
min="1"
239239
max="10"
240240
class="form-input"
@@ -284,7 +284,7 @@ initializeMatrices()
284284
</div>
285285

286286
<div class="examples-section">
287-
<button @click="showExamples = !showExamples" class="btn btn-secondary">
287+
<button class="btn btn-secondary" @click="showExamples = !showExamples">
288288
{{ showExamples ? 'Ocultar Ejemplos' : 'Ver Ejemplos' }}
289289
</button>
290290

@@ -366,7 +366,7 @@ initializeMatrices()
366366
</div>
367367

368368
<div class="action-buttons">
369-
<button @click="handleSolve" class="btn btn-secondary btn-solve-large">
369+
<button class="btn btn-secondary btn-solve-large" @click="handleSolve">
370370
Resolver Problema
371371
</button>
372372
</div>

0 commit comments

Comments
 (0)