From 603698c9c0213959e4dc10c338df0f764e7b34fc Mon Sep 17 00:00:00 2001 From: Ricardo Carneiro Date: Thu, 26 Jun 2025 00:25:11 -0300 Subject: [PATCH] fix: paginas de links funcionando --- .../Controllers/UserPageController.cs | 3 +- src/BCards.Web/Views/Shared/_Layout.cshtml | 1 + .../Views/Shared/_ThemeStyles.cshtml | 565 +++++++++++------- .../Views/Shared/_UserPageLayout.cshtml | 2 + src/BCards.Web/Views/UserPage/Display.cshtml | 298 ++++++--- 5 files changed, 594 insertions(+), 275 deletions(-) diff --git a/src/BCards.Web/Controllers/UserPageController.cs b/src/BCards.Web/Controllers/UserPageController.cs index 0f17640..bc5e4d9 100644 --- a/src/BCards.Web/Controllers/UserPageController.cs +++ b/src/BCards.Web/Controllers/UserPageController.cs @@ -24,7 +24,8 @@ public class UserPageController : Controller } //[Route("{category}/{slug}")] - [ResponseCache(Duration = 300, VaryByQueryKeys = new[] { "category", "slug" })] + //VOltar a linha abaixo em prod + //[ResponseCache(Duration = 300, VaryByQueryKeys = new[] { "category", "slug" })] public async Task Display(string category, string slug) { var userPage = await _userPageService.GetPageAsync(category, slug); diff --git a/src/BCards.Web/Views/Shared/_Layout.cshtml b/src/BCards.Web/Views/Shared/_Layout.cshtml index a801765..91906ac 100644 --- a/src/BCards.Web/Views/Shared/_Layout.cshtml +++ b/src/BCards.Web/Views/Shared/_Layout.cshtml @@ -31,6 +31,7 @@ } + diff --git a/src/BCards.Web/Views/Shared/_ThemeStyles.cshtml b/src/BCards.Web/Views/Shared/_ThemeStyles.cshtml index 86ec234..1afbb31 100644 --- a/src/BCards.Web/Views/Shared/_ThemeStyles.cshtml +++ b/src/BCards.Web/Views/Shared/_ThemeStyles.cshtml @@ -1,16 +1,14 @@ @model BCards.Web.Models.PageTheme + @{ var theme = Model ?? new BCards.Web.Models.PageTheme - { - Name = "Padrão", - PrimaryColor = "#2563eb", - SecondaryColor = "#1d4ed8", - BackgroundColor = "#ffffff", - TextColor = "#1f2937" - }; - - // Debug - vamos ver o que está chegando - // Console.WriteLine($"Theme recebido: {Model?.Name ?? "NULL"} - Primary: {Model?.PrimaryColor ?? "NULL"}"); + { + Name = "Padrão", + PrimaryColor = "#2563eb", + SecondaryColor = "#1d4ed8", + BackgroundColor = "#ffffff", + TextColor = "#1f2937" + }; } :root { @@ -18,28 +16,27 @@ --secondary-color: @theme.SecondaryColor; --background-color: @theme.BackgroundColor; --text-color: @theme.TextColor; + --card-bg: rgba(255, 255, 255, 0.95); + --border-color: rgba(0, 0, 0, 0.1); } .user-page { background-color: var(--background-color); color: var(--text-color); - @if (!string.IsNullOrEmpty(theme.BackgroundImage)) - { - @:background-image: url('@theme.BackgroundImage'); - @:background-size: cover; - @:background-position: center; - @:background-attachment: fixed; - } + min-height: 100vh; + padding: 2rem 0; + } .profile-card { - background-color: rgba(255, 255, 255, 0.95); + background-color: var(--card-bg); backdrop-filter: blur(10px); border-radius: 20px; padding: 2rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); - border: 1px solid rgba(255, 255, 255, 0.2); + border: 1px solid var(--border-color); max-width: 500px; + margin: 0 auto; } .profile-image { @@ -56,15 +53,20 @@ height: 120px; border-radius: 50%; border: 4px solid var(--primary-color); - background-color: rgba(255, 255, 255, 0.1); + background-color: var(--card-bg); color: var(--primary-color); + display: flex; + align-items: center; + justify-content: center; + font-size: 3rem; + margin: 0 auto; } .profile-name { color: var(--primary-color); font-size: 2rem; font-weight: 600; - margin-bottom: 0.5rem; + margin: 1rem 0 0.5rem 0; } .profile-bio { @@ -74,104 +76,347 @@ font-size: 1.1rem; } +/* ========== LINKS CONTAINER ========== */ .links-container { margin-bottom: 2rem; } -.link-button { - background-color: var(--primary-color); - color: white !important; - border: none; - padding: 0.75rem 1.5rem; +/* ========== UNIVERSAL LINK STYLE (TODOS OS LINKS IGUAIS) ========== */ +.universal-link { + border: 1px solid var(--border-color); border-radius: 12px; - text-decoration: none; - display: block; margin-bottom: 0.75rem; - text-align: center; - font-weight: 500; - transition: all 0.3s ease; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - position: relative; overflow: hidden; - max-width: 100%; - font-size: 0.95rem; + background-color: var(--card-bg); + transition: all 0.3s ease; } -.link-button:hover { - background-color: var(--secondary-color); +.universal-link:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); - color: white !important; - text-decoration: none; } -.link-button:active { - transform: translateY(0); +.universal-link-header { + background-color: var(--primary-color); + color: white !important; + padding: 0.75rem 1rem; + display: flex; + align-items: center; + justify-content: space-between; + cursor: pointer; + text-decoration: none !important; + transition: background-color 0.3s ease; + position: relative; + font-weight: 500; +} + +.universal-link-header:hover { + background-color: var(--secondary-color); + color: white !important; + text-decoration: none !important; +} + +.universal-link-content { + display: flex; + align-items: center; + flex: 1; + min-width: 0; + text-align: left; +} + +/* Thumbnail para produtos */ +.link-thumbnail { + width: 40px; + height: 40px; + border-radius: 6px; + object-fit: cover; + margin-right: 0.75rem; + flex-shrink: 0; + background-color: rgba(255, 255, 255, 0.2); +} + +/* Ícone para links normais */ +.link-icon { + width: 40px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + margin-right: 0.75rem; + flex-shrink: 0; + font-size: 1.2rem; + color: white; +} + +.link-text-container { + flex: 1; + min-width: 0; } .link-title { - font-size: 1.1rem; - margin-bottom: 0.25rem; font-weight: 600; + font-size: 1rem; + color: white; + margin: 0; + line-height: 1.2; + /* Truncate long titles */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } -.link-description { +.link-subtitle { + font-size: 0.85rem; + color: rgba(255, 255, 255, 0.8); + margin: 0; + line-height: 1.1; + /* Truncate long subtitles */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/* Seta de expansão */ +.expand-arrow { + background: rgba(255, 255, 255, 0.2); + border: none; + color: white; + border-radius: 6px; + width: 32px; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition: all 0.3s ease; + flex-shrink: 0; + margin-left: 0.5rem; +} + +.expand-arrow:hover { + background: rgba(255, 255, 255, 0.3); + transform: scale(1.05); +} + +.expand-arrow i { font-size: 0.9rem; - opacity: 0.9; + transition: transform 0.3s ease; } -.link-icon { - font-size: 1.2rem; - margin-right: 0.5rem; +.expand-arrow.expanded i { + transform: rotate(180deg); } -.profile-footer { - border-top: 1px solid rgba(0, 0, 0, 0.1); - padding-top: 1rem; +/* Conteúdo expandido */ +.universal-link-details { + padding: 0; + background-color: var(--card-bg); + border-top: 1px solid var(--border-color); + max-height: 0; + overflow: hidden; + transition: max-height 0.3s ease-out, padding 0.3s ease; } -.profile-footer a { +.universal-link-details.show { + max-height: 400px; + padding: 1rem; +} + +/* Imagem expandida para produtos */ +.expanded-image { + width: 100%; + max-width: 200px; + height: auto; + border-radius: 8px; + margin-bottom: 1rem; + display: block; + margin-left: auto; + margin-right: auto; +} + +.expanded-description { + color: var(--text-color); + opacity: 0.8; + font-size: 0.9rem; + line-height: 1.5; + margin-bottom: 0.75rem; +} + +.expanded-price { + color: #28a745; + font-weight: 700; + font-size: 1.1rem; + margin-bottom: 0.75rem; + text-align: center; +} + +.expanded-action { color: var(--primary-color); + font-size: 0.85rem; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + gap: 0.25rem; +} + +/* ========== FOOTER ========== */ +.profile-footer { + margin-top: 2rem; + padding-top: 1rem; + border-top: 1px solid var(--border-color); + text-align: center; +} + +.footer-promo { + background-color: var(--card-bg); + border: 1px solid var(--border-color); + border-radius: 8px; + padding: 1rem; + margin-bottom: 1rem; + cursor: pointer; + transition: all 0.3s ease; +} + +.footer-promo:hover { + transform: translateY(-1px); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); +} + +.footer-promo-header { + display: flex; + align-items: center; + justify-content: space-between; + color: var(--primary-color); + font-weight: 600; + font-size: 0.9rem; +} + +.footer-promo-header i { + transition: transform 0.3s ease; +} + +.footer-promo-header.expanded i { + transform: rotate(180deg); +} + +.footer-promo-content { + margin-top: 0.5rem; + max-height: 0; + overflow: hidden; + transition: max-height 0.3s ease-out, margin-top 0.3s ease; + color: var(--text-color); + opacity: 0.8; + font-size: 0.85rem; + line-height: 1.4; +} + +.footer-promo-content.show { + max-height: 200px; + margin-top: 0.75rem; +} + +.footer-promo-button { + background-color: var(--primary-color); + color: white !important; + border: none; + padding: 0.4rem 0.8rem; + border-radius: 6px; + text-decoration: none !important; + font-size: 0.8rem; + display: inline-flex; + align-items: center; + gap: 0.25rem; + margin-top: 0.5rem; + transition: background-color 0.3s ease; +} + +.footer-promo-button:hover { + background-color: var(--secondary-color); + color: white !important; + text-decoration: none !important; +} + +.footer-credits { + font-size: 0.8rem; + color: var(--text-color); + opacity: 0.6; +} + +.footer-credits a { + color: var(--primary-color); + text-decoration: none; font-weight: 500; } -.profile-footer a:hover { +.footer-credits a:hover { color: var(--secondary-color); + text-decoration: underline; } -/* Responsive Design */ +/* ========== ANIMATIONS ========== */ +@@keyframes slideDown { + from { + max-height: 0; + padding-top: 0; + padding-bottom: 0; + opacity: 0; + } + to { + max-height: 400px; + padding-top: 1rem; + padding-bottom: 1rem; + opacity: 1; + } +} + +/* ========== RESPONSIVE DESIGN ========== */ @@media (max-width: 768px) { + .user-page { + padding: 1rem 0; + } + .profile-card { padding: 1.5rem; - margin: 1rem; + margin: 0 1rem; border-radius: 15px; } - + .profile-image, .profile-image-placeholder { width: 100px; height: 100px; } - + .profile-name { font-size: 1.75rem; } - - .profile-bio { - font-size: 1rem; + + .universal-link-header { + padding: 0.65rem 0.8rem; } - - .link-button { - padding: 0.65rem 1.25rem; - font-size: 0.9rem; - margin-bottom: 0.6rem; - } - + .link-title { font-size: 0.95rem; } - - .link-description { + + .link-subtitle { + font-size: 0.8rem; + } + + .link-thumbnail, + .link-icon { + width: 36px; + height: 36px; + margin-right: 0.5rem; + } + + .expand-arrow { + width: 28px; + height: 28px; + } + + .expand-arrow i { font-size: 0.8rem; } } @@ -179,150 +424,70 @@ @@media (max-width: 480px) { .profile-card { padding: 1rem; - margin: 0.5rem; + margin: 0 0.5rem; } - + .profile-image, .profile-image-placeholder { width: 80px; height: 80px; } - + .profile-name { font-size: 1.5rem; } - - .link-button { - padding: 0.6rem 1rem; - font-size: 0.85rem; - margin-bottom: 0.5rem; + + .universal-link-header { + padding: 0.6rem 0.8rem; } -} -/* Dark theme adjustments */ -@@media (prefers-color-scheme: dark) { - .user-page[data-theme="dark"] .profile-card { - background-color: rgba(17, 24, 39, 0.95); - color: #f9fafb; - } -} - -/* Animation for link buttons */ -.link-button::before { - content: ''; - position: absolute; - top: 0; - left: -100%; - width: 100%; - height: 100%; - background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); - transition: left 0.5s; -} - -.link-button:hover::before { - left: 100%; -} - -/* Product Link Card Styles */ -.product-link-card { - transition: transform 0.2s ease, box-shadow 0.2s ease; - border: 1px solid rgba(0, 0, 0, 0.125); - border-radius: 15px; - overflow: hidden; - background: rgba(255, 255, 255, 0.95); - backdrop-filter: blur(10px); -} - -.product-link-card:hover { - transform: translateY(-3px); - box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); - border-color: var(--primary-color); -} - -.product-image { - height: 120px; - width: 100%; - object-fit: cover; - border-radius: 15px 0 0 15px; -} - -.product-title { - color: var(--primary-color); - font-weight: 600; - margin-bottom: 0.5rem; - line-height: 1.3; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.product-description { - font-size: 0.85rem; - line-height: 1.4; - margin-bottom: 0.5rem; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.product-price { - font-size: 1.1rem; - font-weight: 700; - color: #28a745 !important; -} - -.product-link .card-body { - padding: 1rem; -} - -/* Responsive adjustments for product cards */ -@@media (max-width: 768px) { - .product-image { - height: 100px; - border-radius: 15px 15px 0 0; - } - - .product-link-card .row { - flex-direction: column; - } - - .product-link-card .col-md-4, - .product-link-card .col-md-8 { - flex: none; - width: 100%; - max-width: 100%; - } - - .product-title { - font-size: 1rem; - } - - .product-description { - font-size: 0.8rem; - } - - .product-price { - font-size: 1rem; - } -} - -@@media (max-width: 480px) { - .product-image { - height: 80px; - } - - .product-link .card-body { - padding: 0.75rem; - } - - .product-title { + .link-title { font-size: 0.9rem; } - - .product-description { + + .link-subtitle { font-size: 0.75rem; - -webkit-line-clamp: 1; } + + .link-thumbnail, + .link-icon { + width: 32px; + height: 32px; + margin-right: 0.5rem; + } + + .expand-arrow { + width: 26px; + height: 26px; + } + + .expanded-image { + max-width: 150px; + } +} + +/* ========== DARK THEME COMPATIBILITY ========== */ +.user-page[data-theme="dark"] .profile-card, +.user-page[data-theme="dark"] .universal-link, +.user-page[data-theme="dark"] .footer-promo { + background-color: rgba(31, 41, 55, 0.95); + border-color: rgba(255, 255, 255, 0.1); +} + +.user-page[data-theme="dark"] .universal-link-details, +.user-page[data-theme="dark"] .footer-promo-content { + background-color: rgba(31, 41, 55, 0.95); + border-color: rgba(255, 255, 255, 0.1); +} + +/* Accessibility */ +.universal-link-header:focus, +.expand-arrow:focus { + outline: 2px solid rgba(255, 255, 255, 0.5); + outline-offset: 2px; +} + +/* Smooth scroll for mobile */ +.universal-link-details { + scroll-behavior: smooth; } \ No newline at end of file diff --git a/src/BCards.Web/Views/Shared/_UserPageLayout.cshtml b/src/BCards.Web/Views/Shared/_UserPageLayout.cshtml index 4b32c7e..d288596 100644 --- a/src/BCards.Web/Views/Shared/_UserPageLayout.cshtml +++ b/src/BCards.Web/Views/Shared/_UserPageLayout.cshtml @@ -42,7 +42,9 @@ } + + @await RenderSectionAsync("Styles", required: false) diff --git a/src/BCards.Web/Views/UserPage/Display.cshtml b/src/BCards.Web/Views/UserPage/Display.cshtml index 47f633f..fa629a3 100644 --- a/src/BCards.Web/Views/UserPage/Display.cshtml +++ b/src/BCards.Web/Views/UserPage/Display.cshtml @@ -11,7 +11,15 @@ @section Styles { } @@ -27,20 +35,20 @@ } else { -
- 👤 +
+ 👤
}

@Model.DisplayName

- + @if (!string.IsNullOrEmpty(Model.Bio)) {

@Model.Bio

} - +