feat: Redesign benefit detail page with beautiful CSS styling and markdown rendering
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

This commit is contained in:
Maciej Pienczyn 2026-02-03 08:53:03 +01:00
parent 8a7aad8eaa
commit 813bb066e8

View File

@ -3,9 +3,10 @@
{% block title %}{{ benefit.name }} - Korzyści Członkowskie{% endblock %}
{% block extra_css %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/marked-highlight/styles/github.min.css">
<style>
.benefit-detail {
max-width: 800px;
max-width: 900px;
margin: 0 auto;
}
@ -84,34 +85,414 @@
margin-bottom: var(--spacing-xl);
}
.benefit-detail-description {
color: var(--text-secondary);
line-height: 1.7;
margin-bottom: var(--spacing-xl);
white-space: pre-line;
}
.benefit-detail-section {
margin-bottom: var(--spacing-lg);
}
.benefit-detail-section-title {
font-weight: 600;
/* ============================================
MARKDOWN CONTENT STYLING
============================================ */
.benefit-content {
color: var(--text-primary);
margin-bottom: var(--spacing-sm);
line-height: 1.7;
}
.benefit-content h2 {
font-size: 1.5rem;
font-weight: 700;
color: var(--text-primary);
margin: 2rem 0 1rem 0;
padding-bottom: 0.5rem;
border-bottom: 2px solid var(--primary);
display: flex;
align-items: center;
gap: var(--spacing-sm);
gap: 0.5rem;
}
.benefit-detail-section-title svg {
width: 18px;
height: 18px;
.benefit-content h2:first-child {
margin-top: 0;
}
.benefit-content h3 {
font-size: 1.2rem;
font-weight: 600;
color: var(--text-primary);
margin: 1.5rem 0 0.75rem 0;
}
.benefit-content p {
margin-bottom: 1rem;
color: var(--text-secondary);
}
.benefit-content strong {
color: var(--text-primary);
font-weight: 600;
}
/* Beautiful tables */
.benefit-content table {
width: 100%;
border-collapse: collapse;
margin: 1rem 0 1.5rem 0;
border-radius: var(--radius-md);
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.benefit-content table thead {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
}
.benefit-content table th {
padding: 0.875rem 1rem;
text-align: left;
font-weight: 600;
font-size: 0.9rem;
}
.benefit-content table td {
padding: 0.875rem 1rem;
border-bottom: 1px solid var(--border-color);
background: white;
}
.benefit-content table tr:last-child td {
border-bottom: none;
}
.benefit-content table tr:hover td {
background: #f8fafc;
}
/* Lists */
.benefit-content ul, .benefit-content ol {
margin: 0.75rem 0 1.25rem 0;
padding-left: 0;
list-style: none;
}
.benefit-content ul li, .benefit-content ol li {
position: relative;
padding: 0.5rem 0 0.5rem 2rem;
color: var(--text-secondary);
}
.benefit-content ul li::before {
content: "✓";
position: absolute;
left: 0;
color: var(--success);
font-weight: bold;
font-size: 1rem;
}
/* Code blocks (for flowcharts) - convert to visual */
.benefit-content pre {
display: none; /* Hide ASCII flowcharts */
}
/* Horizontal rule */
.benefit-content hr {
border: none;
height: 1px;
background: linear-gradient(to right, transparent, var(--border-color), transparent);
margin: 2rem 0;
}
/* ============================================
PLAN CARDS
============================================ */
.plan-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin: 1.5rem 0;
}
.plan-card {
background: white;
border: 2px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 1.25rem;
text-align: center;
transition: all 0.2s ease;
}
.plan-card:hover {
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: var(--shadow-lg);
}
.plan-card.featured {
border-color: var(--primary);
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.plan-card.free {
border-color: #22c55e;
background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}
.plan-card.student {
border-color: #8b5cf6;
background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}
.plan-card-icon {
font-size: 2rem;
margin-bottom: 0.5rem;
}
.plan-card-title {
font-weight: 700;
font-size: 1.1rem;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.plan-card-price {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary);
margin-bottom: 0.25rem;
}
.plan-card.free .plan-card-price {
color: #22c55e;
}
.plan-card.student .plan-card-price {
color: #8b5cf6;
}
.plan-card-subtitle {
font-size: 0.85rem;
color: var(--text-secondary);
}
/* ============================================
PROCESS STEPS (Flowchart replacement)
============================================ */
.process-section {
margin: 2rem 0;
}
.process-title {
font-size: 1.1rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.process-steps {
position: relative;
padding-left: 2rem;
}
.process-steps::before {
content: "";
position: absolute;
left: 0.75rem;
top: 0;
bottom: 0;
width: 2px;
background: linear-gradient(to bottom, var(--primary), var(--success));
border-radius: 1px;
}
.process-step {
position: relative;
padding: 0.75rem 0 0.75rem 1.5rem;
margin-bottom: 0.5rem;
}
.process-step::before {
content: attr(data-step);
position: absolute;
left: -1.25rem;
top: 0.75rem;
width: 1.5rem;
height: 1.5rem;
background: var(--primary);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 700;
z-index: 1;
}
.process-step:last-child::before {
background: var(--success);
}
.process-step-content {
background: #f8fafc;
padding: 1rem;
border-radius: var(--radius-md);
border-left: 3px solid var(--primary);
}
.process-step:last-child .process-step-content {
border-left-color: var(--success);
background: #f0fdf4;
}
.process-step-title {
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.25rem;
}
.process-step-desc {
font-size: 0.9rem;
color: var(--text-secondary);
}
/* ============================================
FEATURE BADGES
============================================ */
.feature-list {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin: 1rem 0;
}
.feature-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: #f0f9ff;
border: 1px solid #bae6fd;
border-radius: 2rem;
font-size: 0.9rem;
color: #0369a1;
}
.feature-badge.success {
background: #f0fdf4;
border-color: #bbf7d0;
color: #15803d;
}
/* ============================================
DOCUMENT LIST
============================================ */
.document-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.75rem;
margin: 1rem 0;
}
.document-item {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem;
background: #f8fafc;
border-radius: var(--radius-md);
font-size: 0.9rem;
color: var(--text-secondary);
}
.document-item-icon {
font-size: 1.25rem;
}
/* ============================================
EXAMPLE CARDS
============================================ */
.example-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin: 1.5rem 0;
}
.example-card {
background: white;
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 1.25rem;
transition: all 0.2s ease;
}
.example-card:hover {
box-shadow: var(--shadow-lg);
transform: translateY(-2px);
}
.example-card-icon {
font-size: 1.75rem;
margin-bottom: 0.75rem;
}
.example-card-title {
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.example-card-desc {
font-size: 0.9rem;
color: var(--text-secondary);
line-height: 1.5;
}
/* ============================================
TABS FOR OPTIONS
============================================ */
.option-tabs {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
}
.option-tab {
flex: 1;
padding: 0.75rem 1rem;
background: #f1f5f9;
border: 2px solid transparent;
border-radius: var(--radius-md);
font-weight: 600;
cursor: pointer;
text-align: center;
transition: all 0.2s ease;
}
.option-tab:hover {
background: #e2e8f0;
}
.option-tab.active {
background: white;
border-color: var(--primary);
color: var(--primary);
}
.option-content {
display: none;
padding: 1.5rem;
background: #f8fafc;
border-radius: var(--radius-lg);
}
.option-content.active {
display: block;
}
/* ============================================
CTA & PROMO
============================================ */
.benefit-promo-code-box {
background: #f0f9ff;
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
border: 2px dashed #0ea5e9;
border-radius: var(--radius-lg);
padding: var(--spacing-lg);
@ -132,6 +513,10 @@
font-size: var(--font-size-2xl);
letter-spacing: 2px;
margin-bottom: var(--spacing-sm);
background: white;
padding: 0.5rem 1.5rem;
border-radius: var(--radius-md);
display: inline-block;
}
.promo-code-instructions {
@ -151,19 +536,21 @@
justify-content: center;
gap: var(--spacing-sm);
padding: var(--spacing-md) var(--spacing-lg);
background: var(--primary);
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
border: none;
border-radius: var(--radius-md);
font-weight: 600;
font-size: var(--font-size-lg);
cursor: pointer;
transition: background 0.2s ease;
transition: all 0.2s ease;
text-decoration: none;
box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.3);
}
.benefit-cta-primary:hover {
background: var(--primary-dark);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
color: white;
}
@ -223,6 +610,29 @@
.commission-info strong {
color: #78350f;
}
/* Mobile responsiveness */
@media (max-width: 640px) {
.plan-cards {
grid-template-columns: 1fr;
}
.example-grid {
grid-template-columns: 1fr;
}
.document-grid {
grid-template-columns: 1fr 1fr;
}
.benefit-detail-cta {
flex-direction: column;
}
.option-tabs {
flex-direction: column;
}
}
</style>
{% endblock %}
@ -263,8 +673,8 @@
<div class="benefit-detail-body">
{% if benefit.description %}
<div class="benefit-detail-description">
{{ benefit.description }}
<div id="benefit-content" class="benefit-content">
<!-- Content will be rendered by JavaScript -->
</div>
{% endif %}
@ -282,7 +692,7 @@
<div class="benefit-detail-cta">
<a href="{{ url_for('benefits.benefit_redirect', slug=benefit.slug) }}" class="benefit-cta-primary" target="_blank" rel="noopener">
Skorzystaj z oferty
Wypróbuj za darmo
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
@ -292,15 +702,15 @@
{% if benefit.product_url %}
<a href="{{ benefit.product_url }}" class="benefit-cta-secondary" target="_blank" rel="noopener">
Zobacz demo
Zobacz stronę produktu
</a>
{% endif %}
</div>
<!-- Admin info -->
{% if current_user.is_admin %}
<!-- Admin info - tylko dla właściciela -->
{% if current_user.email == 'maciej.pienczyn@inpi.pl' %}
<div class="commission-info">
<strong>Info dla admina:</strong>
<strong>Dane prowizji (prywatne):</strong>
{% if benefit.commission_rate %}Prowizja: {{ benefit.commission_rate }}{% endif %}
{% if benefit.commission_duration %} przez {{ benefit.commission_duration }}{% endif %}
{% if benefit.partner_platform %} | Platforma: {{ benefit.partner_platform }}{% endif %}
@ -310,4 +720,37 @@
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const rawContent = {{ benefit.description | tojson | safe }};
const contentEl = document.getElementById('benefit-content');
if (rawContent && contentEl) {
// Configure marked
marked.setOptions({
breaks: true,
gfm: true
});
// Render markdown
let html = marked.parse(rawContent);
// Post-process for better visual elements
// Convert ASCII flowcharts to hidden (they're replaced by visual elements)
html = html.replace(/<pre><code[^>]*>[\s\S]*?<\/code><\/pre>/g, '');
contentEl.innerHTML = html;
// Add visual enhancements after render
enhanceContent();
}
});
function enhanceContent() {
// This function could be extended to add more dynamic enhancements
// For example, converting certain patterns to interactive elements
}
</script>
{% endblock %}