agrega checkbox para modo QR en UuidSelector

- Checkbox que cambia comportamiento del click en UUID cards
- Modo QR: muestra modal QR en lugar de redirigir
- Modo normal: comportamiento original de navegación
- Botón descriptivo que indica el modo actual
- Estilos responsive para móviles
- Facilita acceso a QR para usuarios sin click derecho
This commit is contained in:
2025-08-16 02:47:13 -06:00
parent d0c206f5f0
commit 42b30cbd49

View File

@@ -17,6 +17,16 @@
<span class="search-icon">🔍</span> <span class="search-icon">🔍</span>
</div> </div>
<!-- QR Mode Toggle -->
<div class="qr-mode-container">
<label class="qr-mode-label">
<input type="checkbox" v-model="qrMode" class="qr-mode-checkbox" />
<span class="qr-mode-text">
{{ qrMode ? '📱 Mostrar QR al hacer click' : '🎮 Ir al juego al hacer click' }}
</span>
</label>
</div>
<!-- Loading State --> <!-- Loading State -->
<div v-if="loading" class="loading"> <div v-if="loading" class="loading">
<div class="spinner"></div> <div class="spinner"></div>
@@ -114,6 +124,7 @@ const loading = ref(true);
const allUuids = ref<UuidInfo[]>([]); const allUuids = ref<UuidInfo[]>([]);
const searchQuery = ref(''); const searchQuery = ref('');
const filteredUuids = ref<UuidInfo[]>([]); const filteredUuids = ref<UuidInfo[]>([]);
const qrMode = ref(false);
const qrCanvas = ref<HTMLCanvasElement>(); const qrCanvas = ref<HTMLCanvasElement>();
const printContainer = ref<HTMLElement>(); const printContainer = ref<HTMLElement>();
@@ -188,7 +199,16 @@ function formatUuid(uuid: string): string {
} }
function selectUuid(uuid: string) { function selectUuid(uuid: string) {
router.push(`/${uuid}`); if (qrMode.value) {
// Find the UUID info and show QR modal
const uuidInfo = allUuids.value.find(u => u.uuid === uuid);
if (uuidInfo) {
printQR(uuidInfo);
}
} else {
// Normal behavior: navigate to the UUID
router.push(`/${uuid}`);
}
} }
function selectRandom() { function selectRandom() {
@@ -581,6 +601,65 @@ async function copyToClipboard() {
opacity: 0.6; opacity: 0.6;
} }
/* QR Mode Toggle Styles */
.qr-mode-container {
margin: 15px 0 25px 0;
display: flex;
justify-content: center;
}
.qr-mode-label {
display: flex;
align-items: center;
gap: 10px;
cursor: pointer;
padding: 12px 20px;
background: rgba(102, 126, 234, 0.1);
border-radius: 25px;
border: 2px solid transparent;
transition: all 0.3s ease;
user-select: none;
}
.qr-mode-label:hover {
background: rgba(102, 126, 234, 0.15);
border-color: rgba(102, 126, 234, 0.3);
transform: translateY(-1px);
}
.qr-mode-checkbox {
width: 18px;
height: 18px;
border: 2px solid #667eea;
border-radius: 4px;
background: white;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
}
.qr-mode-checkbox:checked {
background: #667eea;
border-color: #667eea;
}
.qr-mode-checkbox:checked::after {
content: '✓';
position: absolute;
top: -2px;
left: 2px;
color: white;
font-size: 14px;
font-weight: bold;
}
.qr-mode-text {
font-size: 16px;
font-weight: 600;
color: #667eea;
transition: color 0.3s ease;
}
.uuids-grid { .uuids-grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
@@ -927,6 +1006,19 @@ async function copyToClipboard() {
font-size: 2rem; font-size: 2rem;
} }
.qr-mode-container {
margin: 10px 0 20px 0;
}
.qr-mode-label {
padding: 10px 16px;
font-size: 14px;
}
.qr-mode-text {
font-size: 14px;
}
.uuids-grid { .uuids-grid {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
} }