feat: novas redes sociais e qrcodes.
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 5s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Run Tests (pull_request) Successful in 3s
BCards Deployment Pipeline / Build and Push Image (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (pull_request) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (pull_request) Has been skipped
BCards Deployment Pipeline / PR Validation (pull_request) Successful in 0s
BCards Deployment Pipeline / Deployment Summary (pull_request) Successful in 0s
BCards Deployment Pipeline / Build and Push Image (push) Successful in 19m44s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Successful in 22s
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 5s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Run Tests (pull_request) Successful in 3s
BCards Deployment Pipeline / Build and Push Image (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (pull_request) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (pull_request) Has been skipped
BCards Deployment Pipeline / PR Validation (pull_request) Successful in 0s
BCards Deployment Pipeline / Deployment Summary (pull_request) Successful in 0s
BCards Deployment Pipeline / Build and Push Image (push) Successful in 19m44s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Successful in 22s
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
This commit is contained in:
parent
5d70ba797a
commit
c32b4ef034
@ -27,7 +27,8 @@
|
||||
"Bash(./clean-build.sh:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(scp:*)",
|
||||
"Bash(ssh:*)"
|
||||
"Bash(ssh:*)",
|
||||
"Bash(cat:*)"
|
||||
]
|
||||
},
|
||||
"enableAllProjectMcpServers": false
|
||||
|
||||
@ -551,6 +551,54 @@ public class AdminController : Controller
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.TiktokUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "TikTok",
|
||||
Url = model.TiktokUrl,
|
||||
Icon = "fab fa-tiktok",
|
||||
IsActive = true,
|
||||
Order = userPage.Links.Count + socialLinks.Count
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.PinterestUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Pinterest",
|
||||
Url = model.PinterestUrl,
|
||||
Icon = "fab fa-pinterest",
|
||||
IsActive = true,
|
||||
Order = userPage.Links.Count + socialLinks.Count
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.DiscordUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Discord",
|
||||
Url = model.DiscordUrl,
|
||||
Icon = "fab fa-discord",
|
||||
IsActive = true,
|
||||
Order = userPage.Links.Count + socialLinks.Count
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.KawaiUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Kawai",
|
||||
Url = model.KawaiUrl,
|
||||
Icon = "fas fa-heart",
|
||||
IsActive = true,
|
||||
Order = userPage.Links.Count + socialLinks.Count
|
||||
});
|
||||
}
|
||||
|
||||
userPage.Links.AddRange(socialLinks);
|
||||
|
||||
await _userPageService.CreatePageAsync(userPage);
|
||||
@ -822,6 +870,54 @@ public class AdminController : Controller
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.TiktokUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "TikTok",
|
||||
Url = model.TiktokUrl,
|
||||
Icon = "fab fa-tiktok",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.PinterestUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Pinterest",
|
||||
Url = model.PinterestUrl,
|
||||
Icon = "fab fa-pinterest",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.DiscordUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Discord",
|
||||
Url = model.DiscordUrl,
|
||||
Icon = "fab fa-discord",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.KawaiUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Kawai",
|
||||
Url = model.KawaiUrl,
|
||||
Icon = "fas fa-heart",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
userPage.Links.AddRange(socialLinks);
|
||||
return userPage;
|
||||
}
|
||||
@ -932,6 +1028,54 @@ public class AdminController : Controller
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.TiktokUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "TikTok",
|
||||
Url = model.TiktokUrl,
|
||||
Icon = "fab fa-tiktok",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.PinterestUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Pinterest",
|
||||
Url = model.PinterestUrl,
|
||||
Icon = "fab fa-pinterest",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.DiscordUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Discord",
|
||||
Url = model.DiscordUrl,
|
||||
Icon = "fab fa-discord",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.KawaiUrl))
|
||||
{
|
||||
socialLinks.Add(new LinkItem
|
||||
{
|
||||
Title = "Kawai",
|
||||
Url = model.KawaiUrl,
|
||||
Icon = "fas fa-heart",
|
||||
IsActive = true,
|
||||
Order = currentOrder++
|
||||
});
|
||||
}
|
||||
|
||||
page.Links.AddRange(socialLinks);
|
||||
}
|
||||
|
||||
@ -1168,6 +1312,18 @@ public class AdminController : Controller
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.TwitterUrl) || model.TwitterUrl.Trim().Length <= 1)
|
||||
model.TwitterUrl = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.TiktokUrl) || model.TiktokUrl.Trim().Length <= 1)
|
||||
model.TiktokUrl = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.PinterestUrl) || model.PinterestUrl.Trim().Length <= 1)
|
||||
model.PinterestUrl = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.DiscordUrl) || model.DiscordUrl.Trim().Length <= 1)
|
||||
model.DiscordUrl = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.KawaiUrl) || model.KawaiUrl.Trim().Length <= 1)
|
||||
model.KawaiUrl = string.Empty;
|
||||
}
|
||||
|
||||
// Endpoint para validar impacto de downgrade
|
||||
@ -1246,6 +1402,10 @@ public class AdminController : Controller
|
||||
modelState.Remove<ManagePageViewModel>(x => x.FacebookUrl);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.TwitterUrl);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.WhatsAppNumber);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.TiktokUrl);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.PinterestUrl);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.DiscordUrl);
|
||||
modelState.Remove<ManagePageViewModel>(x => x.KawaiUrl);
|
||||
|
||||
// Remover validação de 'Description' para links do tipo 'Normal'
|
||||
if (model.Links != null)
|
||||
|
||||
@ -28,6 +28,14 @@ public class CreatePageViewModel
|
||||
|
||||
public string InstagramUrl { get; set; } = string.Empty;
|
||||
|
||||
public string TiktokUrl { get; set; } = string.Empty;
|
||||
|
||||
public string PinterestUrl { get; set; } = string.Empty;
|
||||
|
||||
public string DiscordUrl { get; set; } = string.Empty;
|
||||
|
||||
public string KawaiUrl { get; set; } = string.Empty;
|
||||
|
||||
public List<CreateLinkViewModel> Links { get; set; } = new();
|
||||
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
|
||||
@ -34,6 +34,14 @@ public class ManagePageViewModel
|
||||
|
||||
public string InstagramUrl { get; set; } = string.Empty;
|
||||
|
||||
public string TiktokUrl { get; set; } = string.Empty;
|
||||
|
||||
public string PinterestUrl { get; set; } = string.Empty;
|
||||
|
||||
public string DiscordUrl { get; set; } = string.Empty;
|
||||
|
||||
public string KawaiUrl { get; set; } = string.Empty;
|
||||
|
||||
public List<ManageLinkViewModel> Links { get; set; } = new();
|
||||
|
||||
// Profile image fields
|
||||
|
||||
@ -249,7 +249,11 @@
|
||||
"facebook",
|
||||
"whatsapp",
|
||||
"twitter",
|
||||
"instagram"
|
||||
"instagram",
|
||||
"tiktok",
|
||||
"pinterest",
|
||||
"discord",
|
||||
"kawai"
|
||||
};
|
||||
var match = myList.FirstOrDefault(stringToCheck =>
|
||||
!string.IsNullOrEmpty(Model.Links[i].Icon) &&
|
||||
@ -382,10 +386,18 @@
|
||||
var twitter = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("twitter")).FirstOrDefault();
|
||||
var whatsapp = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("whatsapp")).FirstOrDefault();
|
||||
var instagram = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("instagram")).FirstOrDefault();
|
||||
var tiktok = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("tiktok")).FirstOrDefault();
|
||||
var pinterest = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("pinterest")).FirstOrDefault();
|
||||
var discord = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("discord")).FirstOrDefault();
|
||||
var kawai = Model.Links.Where(x => !string.IsNullOrEmpty(x.Icon) && x.Icon.Contains("kawai")).FirstOrDefault();
|
||||
var facebookUrl = facebook !=null ? facebook.Url.Replace("https://facebook.com/","").Replace("https://www.facebook.com/","").Replace("https://fb.com/","") : "";
|
||||
var twitterUrl = twitter !=null ? twitter.Url.Replace("https://x.com/","").Replace("https://twitter.com/","").Replace("https://www.twitter.com/","") : "";
|
||||
var whatsappUrl = whatsapp !=null ? whatsapp.Url.Replace("https://wa.me/","").Replace("whatsapp://","") : "";
|
||||
var instagramUrl = instagram !=null ? instagram.Url.Replace("https://instagram.com/","").Replace("https://www.instagram.com/","") : "";
|
||||
var tiktokUrl = tiktok !=null ? tiktok.Url.Replace("https://tiktok.com/@@","").Replace("https://www.tiktok.com/@@","").Replace("https://vm.tiktok.com/","") : "";
|
||||
var pinterestUrl = pinterest !=null ? pinterest.Url.Replace("https://pinterest.com/","").Replace("https://www.pinterest.com/","").Replace("https://pin.it/","") : "";
|
||||
var discordUrl = discord !=null ? discord.Url.Replace("https://discord.gg/","").Replace("https://discord.com/invite/","") : "";
|
||||
var kawaiUrl = kawai !=null ? kawai.Url.Replace("https://kawai.com/","").Replace("https://www.kawai.com/","") : "";
|
||||
}
|
||||
<!-- Passo 4: Redes Sociais (Opcional) -->
|
||||
<div class="accordion-item">
|
||||
@ -491,6 +503,92 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<!-- TikTok -->
|
||||
<div class="mb-4">
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="enableTiktok">
|
||||
<label class="form-check-label" for="enableTiktok">
|
||||
<i class="fab fa-tiktok me-2"></i>
|
||||
<strong>Conectar TikTok</strong>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group social-input-group" id="tiktokGroup" style="display: none;">
|
||||
<span class="input-group-text">
|
||||
<i class="fab fa-tiktok me-2"></i>
|
||||
https://tiktok.com/@@
|
||||
</span>
|
||||
<input type="text" class="form-control" id="tiktokUser" placeholder="seu-usuario">
|
||||
</div>
|
||||
<input asp-for="TiktokUrl" type="hidden" value="@(tiktokUrl ?? "")">
|
||||
<span asp-validation-for="TiktokUrl" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<!-- Pinterest -->
|
||||
<div class="mb-4">
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="enablePinterest">
|
||||
<label class="form-check-label" for="enablePinterest">
|
||||
<i class="fab fa-pinterest me-2"></i>
|
||||
<strong>Conectar Pinterest</strong>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group social-input-group" id="pinterestGroup" style="display: none;">
|
||||
<span class="input-group-text">
|
||||
<i class="fab fa-pinterest me-2"></i>
|
||||
https://pinterest.com/
|
||||
</span>
|
||||
<input type="text" class="form-control" id="pinterestUser" placeholder="seu-usuario">
|
||||
</div>
|
||||
<input asp-for="PinterestUrl" type="hidden" value="@(pinterestUrl ?? "")">
|
||||
<span asp-validation-for="PinterestUrl" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<!-- Discord -->
|
||||
<div class="mb-4">
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="enableDiscord">
|
||||
<label class="form-check-label" for="enableDiscord">
|
||||
<i class="fab fa-discord me-2"></i>
|
||||
<strong>Conectar Discord</strong>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group social-input-group" id="discordGroup" style="display: none;">
|
||||
<span class="input-group-text">
|
||||
<i class="fab fa-discord me-2"></i>
|
||||
https://discord.gg/
|
||||
</span>
|
||||
<input type="text" class="form-control" id="discordUser" placeholder="codigo-convite">
|
||||
</div>
|
||||
<input asp-for="DiscordUrl" type="hidden" value="@(discordUrl ?? "")">
|
||||
<span asp-validation-for="DiscordUrl" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<!-- Kawai -->
|
||||
<div class="mb-4">
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="enableKawai">
|
||||
<label class="form-check-label" for="enableKawai">
|
||||
<i class="fas fa-heart me-2"></i>
|
||||
<strong>Conectar Kawai</strong>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group social-input-group" id="kawaiGroup" style="display: none;">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-heart me-2"></i>
|
||||
https://kawai.com/
|
||||
</span>
|
||||
<input type="text" class="form-control" id="kawaiUser" placeholder="seu-usuario">
|
||||
</div>
|
||||
<input asp-for="KawaiUrl" type="hidden" value="@(kawaiUrl ?? "")">
|
||||
<span asp-validation-for="KawaiUrl" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="button" class="btn btn-outline-secondary" onclick="previousStep(3)">
|
||||
<i class="fas fa-arrow-left me-1"></i> Anterior
|
||||
@ -1603,7 +1701,11 @@
|
||||
{ checkbox: '#enableWhatsApp', hidden: 'input[name="WhatsAppNumber"]' },
|
||||
{ checkbox: '#enableFacebook', hidden: 'input[name="FacebookUrl"]' },
|
||||
{ checkbox: '#enableInstagram', hidden: 'input[name="InstagramUrl"]' },
|
||||
{ checkbox: '#enableTwitter', hidden: 'input[name="TwitterUrl"]' }
|
||||
{ checkbox: '#enableTwitter', hidden: 'input[name="TwitterUrl"]' },
|
||||
{ checkbox: '#enableTiktok', hidden: 'input[name="TiktokUrl"]' },
|
||||
{ checkbox: '#enablePinterest', hidden: 'input[name="PinterestUrl"]' },
|
||||
{ checkbox: '#enableDiscord', hidden: 'input[name="DiscordUrl"]' },
|
||||
{ checkbox: '#enableKawai', hidden: 'input[name="KawaiUrl"]' }
|
||||
];
|
||||
|
||||
socialFields.forEach(field => {
|
||||
@ -1619,7 +1721,11 @@
|
||||
'Facebook': ['https://facebook.com/', 'https://www.facebook.com/', 'https://fb.com/', 'https://www.fb.com/'],
|
||||
'Instagram': ['https://instagram.com/', 'https://www.instagram.com/', 'https://instagr.am/'],
|
||||
'Twitter': ['https://x.com/', 'https://twitter.com/', 'https://www.twitter.com/', 'https://www.x.com/'],
|
||||
'WhatsApp': ['https://wa.me/', 'whatsapp://', 'https://api.whatsapp.com/', 'wa.me/']
|
||||
'WhatsApp': ['https://wa.me/', 'whatsapp://', 'https://api.whatsapp.com/', 'wa.me/'],
|
||||
'Tiktok': ['https://tiktok.com/@@', 'https://www.tiktok.com/@@', 'https://vm.tiktok.com/'],
|
||||
'Pinterest': ['https://pinterest.com/', 'https://www.pinterest.com/', 'https://pin.it/'],
|
||||
'Discord': ['https://discord.gg/', 'https://discord.com/invite/'],
|
||||
'Kawai': ['https://kawai.com/', 'https://www.kawai.com/']
|
||||
};
|
||||
|
||||
const typePrefixes = prefixes[socialType] || [];
|
||||
@ -1645,6 +1751,18 @@
|
||||
|
||||
// Twitter
|
||||
setupSocialField('Twitter', 'TwitterUrl', 'https://x.com/', false);
|
||||
|
||||
// TikTok
|
||||
setupSocialField('Tiktok', 'TiktokUrl', 'https://tiktok.com/@@', false);
|
||||
|
||||
// Pinterest
|
||||
setupSocialField('Pinterest', 'PinterestUrl', 'https://pinterest.com/', false);
|
||||
|
||||
// Discord
|
||||
setupSocialField('Discord', 'DiscordUrl', 'https://discord.gg/', false);
|
||||
|
||||
// Kawai
|
||||
setupSocialField('Kawai', 'KawaiUrl', 'https://kawai.com/', false);
|
||||
}
|
||||
|
||||
function setupSocialField(name, hiddenFieldName, prefix, isWhatsApp) {
|
||||
|
||||
@ -38,6 +38,139 @@
|
||||
@Html.Raw(writer.ToString())
|
||||
}
|
||||
}
|
||||
|
||||
/* QR Code Section Styles */
|
||||
.qrcode-section {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.qrcode-toggle {
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 12px;
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
color: inherit;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.qrcode-toggle:hover {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-color: rgba(255, 255, 255, 0.3);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.qrcode-toggle i {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.qrcode-container {
|
||||
margin-top: 1rem;
|
||||
padding: 1.5rem;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
animation: slideDown 0.3s ease;
|
||||
}
|
||||
|
||||
@@keyframes slideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.qrcode-canvas {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0 auto 1rem;
|
||||
padding: 1rem;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
.qrcode-canvas > div {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
.qrcode-canvas img,
|
||||
.qrcode-canvas canvas {
|
||||
display: block !important;
|
||||
margin: 0 auto !important;
|
||||
max-width: 200px !important;
|
||||
max-height: 200px !important;
|
||||
}
|
||||
|
||||
/* Hide duplicate canvas/img if library generates both */
|
||||
.qrcode-canvas img + canvas,
|
||||
.qrcode-canvas canvas + img {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.qrcode-hint {
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.btn-download-qr {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 0.75rem 1.5rem;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-download-qr:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.btn-download-qr:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* Mobile Responsive */
|
||||
@@media (max-width: 576px) {
|
||||
.qrcode-toggle {
|
||||
font-size: 0.9rem;
|
||||
padding: 0.875rem;
|
||||
}
|
||||
|
||||
.qrcode-container {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.qrcode-canvas {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.btn-download-qr {
|
||||
padding: 0.625rem 1.25rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
@ -184,6 +317,23 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- QR Code Section -->
|
||||
<div class="qrcode-section mt-4">
|
||||
<button class="qrcode-toggle" onclick="toggleQRCode()" type="button">
|
||||
<i class="fas fa-qrcode me-2"></i>
|
||||
<span id="qrToggleText">Ocultar QR Code</span>
|
||||
<i class="fas fa-chevron-up ms-auto" id="qrToggleIcon"></i>
|
||||
</button>
|
||||
|
||||
<div class="qrcode-container" id="qrcodeContainer" style="display: block;">
|
||||
<div class="qrcode-canvas" id="qrcode"></div>
|
||||
<p class="qrcode-hint">Escaneie para compartilhar esta página</p>
|
||||
<button class="btn-download-qr" onclick="downloadQR()" type="button">
|
||||
<i class="fas fa-download me-1"></i> Baixar QR Code
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="profile-footer">
|
||||
<div class="footer-promo" onclick="togglePromo(this)">
|
||||
@ -215,6 +365,9 @@
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<!-- QRCode.js Library - Load FIRST -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
|
||||
|
||||
<script>
|
||||
function recordClick(pageId, linkIndex) {
|
||||
// Detectar se é LivePage ou UserPage
|
||||
@ -276,6 +429,95 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Generate QR Code on page load
|
||||
generateQRCode();
|
||||
});
|
||||
|
||||
// QR Code Functions
|
||||
let qrCodeGenerated = false;
|
||||
|
||||
function toggleQRCode() {
|
||||
const container = document.getElementById('qrcodeContainer');
|
||||
const icon = document.getElementById('qrToggleIcon');
|
||||
const text = document.getElementById('qrToggleText');
|
||||
|
||||
if (container.style.display === 'block') {
|
||||
// Close
|
||||
container.style.display = 'none';
|
||||
icon.classList.remove('fa-chevron-up');
|
||||
icon.classList.add('fa-chevron-down');
|
||||
text.textContent = 'Mostrar QR Code';
|
||||
} else {
|
||||
// Open
|
||||
container.style.display = 'block';
|
||||
icon.classList.remove('fa-chevron-down');
|
||||
icon.classList.add('fa-chevron-up');
|
||||
text.textContent = 'Ocultar QR Code';
|
||||
}
|
||||
}
|
||||
|
||||
function generateQRCode() {
|
||||
if (qrCodeGenerated) {
|
||||
console.log('QR Code already generated, skipping...');
|
||||
return;
|
||||
}
|
||||
|
||||
const qrcodeElement = document.getElementById("qrcode");
|
||||
if (!qrcodeElement) {
|
||||
console.error('QR Code container not found');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if already has content (double-call prevention)
|
||||
if (qrcodeElement.querySelector('canvas')) {
|
||||
console.log('Canvas already exists, skipping generation');
|
||||
qrCodeGenerated = true;
|
||||
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) {
|
||||
console.error('Error generating QR Code:', error);
|
||||
qrcodeElement.innerHTML = '<p class="text-danger small">Erro ao gerar QR Code</p>';
|
||||
qrCodeGenerated = false; // Reset on error so it can retry
|
||||
}
|
||||
}
|
||||
|
||||
function downloadQR() {
|
||||
try {
|
||||
const canvas = document.querySelector('#qrcode canvas');
|
||||
if (!canvas) {
|
||||
alert('QR Code não está disponível');
|
||||
return;
|
||||
}
|
||||
|
||||
const url = canvas.toDataURL("image/png");
|
||||
const link = document.createElement('a');
|
||||
link.download = 'qrcode-@(Model.Slug ?? "page").png';
|
||||
link.href = url;
|
||||
link.click();
|
||||
} catch (error) {
|
||||
console.error('Error downloading QR Code:', error);
|
||||
alert('Erro ao baixar QR Code');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user