Compare commits

..

No commits in common. "72e2a220e503d6e791e34af89346a4f2d0843e56" and "6c2b618b9259b51140f87f80bd3451d2ce4f9c3a" have entirely different histories.

3 changed files with 778 additions and 796 deletions

File diff suppressed because it is too large Load Diff

View File

@ -209,37 +209,31 @@
.qrcode-toggle { .qrcode-toggle {
width: 100%; width: 100%;
background-color: var(--primary-color); background: rgba(255, 255, 255, 0.1);
color: white !important; border: 1px solid rgba(255, 255, 255, 0.2);
border: none;
border-radius: 12px; border-radius: 12px;
padding: 0.75rem 1.25rem; padding: 1rem;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease; transition: all 0.3s ease;
color: inherit;
font-size: 1rem; font-size: 1rem;
font-weight: 600; font-weight: 500;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
} }
.qrcode-toggle:hover { .qrcode-toggle:hover {
background-color: var(--secondary-color); background: rgba(255, 255, 255, 0.15);
border-color: rgba(255, 255, 255, 0.3);
transform: translateY(-2px); transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
} }
.qrcode-toggle i { .qrcode-toggle i {
transition: transform 0.3s ease; transition: transform 0.3s ease;
} }
.qrcode-toggle div {
display: flex;
align-items: center;
gap: 0.75rem;
}
.qrcode-container { .qrcode-container {
margin-top: 1rem; margin-top: 1rem;
padding: 1.5rem; padding: 1.5rem;
@ -556,13 +550,13 @@
<div class="qrcode-section mt-4"> <div class="qrcode-section mt-4">
<button class="qrcode-toggle" onclick="toggleQRCode()" type="button"> <button class="qrcode-toggle" onclick="toggleQRCode()" type="button">
<i class="fas fa-qrcode me-2"></i> <i class="fas fa-qrcode me-2"></i>
QR Code <span id="qrToggleText">Ocultar QR Code</span>
<i class="fas fa-chevron-up ms-auto" id="qrToggleIcon"></i> <i class="fas fa-chevron-up ms-auto" id="qrToggleIcon"></i>
</button> </button>
<div class="qrcode-container" id="qrcodeContainer" style="display: block;"> <div class="qrcode-container" id="qrcodeContainer" style="display: block;">
<div class="qrcode-canvas" id="qrcode"></div> <div class="qrcode-canvas" id="qrcode"></div>
<p class="qrcode-hint">Escaneie o QR Code para abrir no celular</p> <p class="qrcode-hint">Escaneie para compartilhar esta página</p>
<button class="btn-download-qr" onclick="downloadQR()" type="button"> <button class="btn-download-qr" onclick="downloadQR()" type="button">
<i class="fas fa-download me-1"></i> Baixar QR Code <i class="fas fa-download me-1"></i> Baixar QR Code
</button> </button>
@ -600,8 +594,8 @@
</div> </div>
@section Scripts { @section Scripts {
<!-- QR Code Library - Usando bwip-js para maior compatibilidade --> <!-- QRCode.js Library - Load FIRST -->
<script src="https://cdn.jsdelivr.net/npm/bwip-js@3.4.1/dist/bwip-js-min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<script> <script>
function recordClick(pageId, linkIndex) { function recordClick(pageId, linkIndex) {
@ -724,76 +718,64 @@
function toggleQRCode() { function toggleQRCode() {
const container = document.getElementById('qrcodeContainer'); const container = document.getElementById('qrcodeContainer');
const icon = document.getElementById('qrToggleIcon'); const icon = document.getElementById('qrToggleIcon');
const text = document.getElementById('qrToggleText');
if (container.style.display === 'block') { if (container.style.display === 'block') {
// Close // Close
container.style.display = 'none'; container.style.display = 'none';
icon.classList.remove('fa-chevron-up'); icon.classList.remove('fa-chevron-up');
icon.classList.add('fa-chevron-down'); icon.classList.add('fa-chevron-down');
text.textContent = 'Mostrar QR Code';
} else { } else {
// Open // Open
container.style.display = 'block'; container.style.display = 'block';
icon.classList.remove('fa-chevron-down'); icon.classList.remove('fa-chevron-down');
icon.classList.add('fa-chevron-up'); icon.classList.add('fa-chevron-up');
text.textContent = 'Ocultar QR Code';
} }
} }
function generateQRCode() { function generateQRCode() {
if (qrCodeGenerated) { if (qrCodeGenerated) {
console.log('[QR] QR Code already generated, skipping...'); console.log('QR Code already generated, skipping...');
return; return;
} }
const qrcodeElement = document.getElementById("qrcode"); const qrcodeElement = document.getElementById("qrcode");
if (!qrcodeElement) { if (!qrcodeElement) {
console.error('[QR] QR Code container not found'); console.error('QR Code container not found');
return; return;
} }
if (typeof bwipjs === 'undefined') { // Check if already has content (double-call prevention)
console.error('[QR] bwip-js library is not loaded'); if (qrcodeElement.querySelector('canvas')) {
qrcodeElement.innerHTML = '<p class="text-danger small">Erro ao carregar gerador de QR Code. Verifique sua conexão ou bloqueador de anúncios.</p>'; console.log('Canvas already exists, skipping generation');
return;
}
// Construir a URL final (LivePage)
const baseUrl = window.location.origin;
const categoryName = '@Html.Raw(category?.Name ?? "")'.trim();
const slug = '@Html.Raw(Model.Slug ?? "")'.trim();
// Se não houver categoria, usa 'geral' ou remove a barra extra
const categoryPart = categoryName ? encodeURIComponent(categoryName) : "page";
const pageUrl = `${baseUrl}/page/${categoryPart}/${encodeURIComponent(slug)}`;
console.log('[QR] Generating QR for URL:', pageUrl);
// Criar um elemento canvas dinamicamente
const canvas = document.createElement('canvas');
canvas.style.maxWidth = '100%';
canvas.style.height = 'auto';
try {
// bwip-js usa um canvas para renderizar
bwipjs.toCanvas(canvas, {
bcid: 'qrcode', // Tipo de código de barras
text: pageUrl, // Texto/URL
scale: 3, // Escala (resolução)
height: 50, // Altura (para QR é proporcional)
width: 50,
includetext: false, // Não mostrar o texto embaixo
textxalign: 'center',
});
// Limpar e adicionar o canvas ao container
qrcodeElement.innerHTML = '';
qrcodeElement.appendChild(canvas);
qrCodeGenerated = true; qrCodeGenerated = true;
console.log('[QR] QR Code generated successfully with bwip-js'); return;
}
// Mark as generated BEFORE creating to prevent race conditions
qrCodeGenerated = true;
// Clear any existing content
qrcodeElement.innerHTML = '';
const pageUrl = window.location.href.split('?')[0]; // Remove query params
try {
new QRCode(qrcodeElement, {
text: pageUrl,
width: 200,
height: 200,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
console.log('QR Code generated successfully for:', pageUrl);
} catch (error) { } catch (error) {
console.error('[QR] Error generating QR Code with bwip-js:', error); console.error('Error generating QR Code:', error);
qrcodeElement.innerHTML = '<p class="text-danger small">Erro ao gerar QR Code. Consulte o console para detalhes.</p>'; qrcodeElement.innerHTML = '<p class="text-danger small">Erro ao gerar QR Code</p>';
qrCodeGenerated = false; qrCodeGenerated = false; // Reset on error so it can retry
} }
} }

View File

@ -21,7 +21,7 @@
"Plans": { "Plans": {
"Basic": { "Basic": {
"Name": "Básico", "Name": "Básico",
"PriceId": "price_1TR10MBk8jHwC3c0iey23Ghb", "PriceId": "price_1RycPaBMIadsOxJVKioZZofK",
"Price": 12.90, "Price": 12.90,
"MaxPages": 3, "MaxPages": 3,
"MaxLinks": 8, "MaxLinks": 8,
@ -35,7 +35,7 @@
}, },
"Professional": { "Professional": {
"Name": "Profissional", "Name": "Profissional",
"PriceId": "price_1TR10NBk8jHwC3c0yqmy8soD", "PriceId": "price_1RycQmBMIadsOxJVGqjVMaOj",
"Price": 25.90, "Price": 25.90,
"MaxPages": 5, "MaxPages": 5,
"MaxLinks": 20, "MaxLinks": 20,
@ -49,7 +49,7 @@
}, },
"Premium": { "Premium": {
"Name": "Premium", "Name": "Premium",
"PriceId": "price_1TR10OBk8jHwC3c0eZa77y31", "PriceId": "price_1RycRUBMIadsOxJVkxGOh3uu",
"Price": 29.90, "Price": 29.90,
"MaxPages": 15, "MaxPages": 15,
"MaxLinks": -1, "MaxLinks": -1,
@ -64,7 +64,7 @@
}, },
"PremiumAffiliate": { "PremiumAffiliate": {
"Name": "Premium+Afiliados", "Name": "Premium+Afiliados",
"PriceId": "price_1TR10PBk8jHwC3c0B1oIvvYY", "PriceId": "price_1RycTaBMIadsOxJVeDLseXQq",
"Price": 34.90, "Price": 34.90,
"MaxPages": 15, "MaxPages": 15,
"MaxLinks": -1, "MaxLinks": -1,
@ -79,7 +79,7 @@
}, },
"BasicYearly": { "BasicYearly": {
"Name": "Básico Anual", "Name": "Básico Anual",
"PriceId": "price_1TR10NBk8jHwC3c0L4SDaWe9", "PriceId": "price_1RycWgBMIadsOxJVGdtEeoMS",
"Price": 129.00, "Price": 129.00,
"MaxPages": 3, "MaxPages": 3,
"MaxLinks": 8, "MaxLinks": 8,
@ -93,7 +93,7 @@
}, },
"ProfessionalYearly": { "ProfessionalYearly": {
"Name": "Profissional Anual", "Name": "Profissional Anual",
"PriceId": "price_1TR10OBk8jHwC3c0IuyvrvRf", "PriceId": "price_1RycXdBMIadsOxJV5cNX7dHm",
"Price": 259.00, "Price": 259.00,
"MaxPages": 5, "MaxPages": 5,
"MaxLinks": 20, "MaxLinks": 20,
@ -107,7 +107,7 @@
}, },
"PremiumYearly": { "PremiumYearly": {
"Name": "Premium Anual", "Name": "Premium Anual",
"PriceId": "price_1TR10PBk8jHwC3c0qngPYMUN", "PriceId": "price_1RycYnBMIadsOxJVPdKmzy4m",
"Price": 299.00, "Price": 299.00,
"MaxPages": 15, "MaxPages": 15,
"MaxLinks": -1, "MaxLinks": -1,
@ -122,7 +122,7 @@
}, },
"PremiumAffiliateYearly": { "PremiumAffiliateYearly": {
"Name": "Premium+Afiliados Anual", "Name": "Premium+Afiliados Anual",
"PriceId": "price_1TR10QBk8jHwC3c0f8CBaD1n", "PriceId": "price_1RycaEBMIadsOxJVEhsdB2Y1",
"Price": 349.00, "Price": 349.00,
"MaxPages": 15, "MaxPages": 15,
"MaxLinks": -1, "MaxLinks": -1,