feat(ui): add styled user profile component and stats dashboard

Introduce a new, modern user profile interface with a dedicated
statistics grid and improved visual hierarchy.

- Implement `.ifnex-user-profile` and `.ifnex-profile-header` components
- Add responsive statistics grid with support for warning, info, and
  success color variants
- Add dark mode support via `prefers-color-scheme` media queries
- Refactor profile shortcode to use new CSS classes instead of inline
  styles
- Remove legacy inline-styled multi-currency credit table in favor of
  the new design system
This commit is contained in:
Kazem Alghasi 2026-10-04 01:54:14 +03:30
parent a5fd01dde1
commit c4a5255e98
2 changed files with 167 additions and 39 deletions

View File

@ -876,4 +876,171 @@
.ifnex-form-actions {
width: 100%;
}
}
/* ════════ Profile Page Styling ════════ */
.ifnex-user-profile {
max-width: 800px;
margin: 0 auto;
}
.ifnex-profile-header {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
color: #ffffff;
border-radius: 16px;
padding: 24px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
.ifnex-profile-header h2 {
margin: 0 0 8px 0;
font-size: 22px;
font-weight: 700;
color: #ffffff;
}
.ifnex-profile-info {
flex: 1;
min-width: 200px;
}
.ifnex-profile-info p {
margin: 4px 0;
font-size: 14px;
color: #cbd5e1;
}
.ifnex-profile-info p strong {
color: #f59e0b;
font-weight: 600;
margin-left: 4px;
}
/* ─── Stats Grid ─── */
.ifnex-stats-grid {
background: #ffffff;
border: 1px solid #e5e7eb;
border-radius: 16px;
padding: 20px;
margin-bottom: 20px;
}
.ifnex-stats-grid h3 {
margin: 0 0 16px 0;
font-size: 16px;
font-weight: 700;
color: #1f2937;
}
.ifnex-stats-cards {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 12px;
margin-bottom: 16px;
}
@media (max-width: 768px) {
.ifnex-stats-cards {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 480px) {
.ifnex-stats-cards {
grid-template-columns: 1fr;
}
}
.ifnex-stat-card {
text-align: center;
padding: 16px 8px;
border-radius: 12px;
background: #f9fafb;
border: 1px solid #e5e7eb;
transition: transform 0.2s, box-shadow 0.2s;
}
.ifnex-stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.ifnex-stat-value {
font-size: 28px;
font-weight: 800;
color: #111827;
line-height: 1.2;
margin-bottom: 4px;
}
.ifnex-stat-label {
font-size: 12px;
color: #6b7280;
font-weight: 500;
}
/* Color variants */
.ifnex-stat-warning {
background: #fffbeb;
border-color: #fed7aa;
}
.ifnex-stat-warning .ifnex-stat-value { color: #d97706; }
.ifnex-stat-info {
background: #eff6ff;
border-color: #bfdbfe;
}
.ifnex-stat-info .ifnex-stat-value { color: #2563eb; }
.ifnex-stat-success {
background: #ecfdf5;
border-color: #a7f3d0;
}
.ifnex-stat-success .ifnex-stat-value { color: #059669; }
.ifnex-total-spent {
text-align: center;
font-size: 15px;
color: #4b5563;
padding: 12px;
background: #f3f4f6;
border-radius: 8px;
margin: 0;
}
.ifnex-total-spent strong {
color: #1f2937;
}
/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
.ifnex-stats-grid {
background: #1e293b;
border-color: #334155;
}
.ifnex-stats-grid h3 {
color: #f9fafb;
}
.ifnex-stat-card {
background: #334155;
border-color: #475569;
}
.ifnex-stat-value {
color: #f9fafb;
}
.ifnex-stat-label {
color: #94a3b8;
}
.ifnex-total-spent {
background: #334155;
color: #cbd5e1;
}
.ifnex-total-spent strong {
color: #f9fafb;
}
}

View File

@ -292,45 +292,6 @@ function ifnex_user_profile_shortcode($atts) {
⚠️ بدهی‌های بالا به ارز اصلی ثبت شده‌اند و با نرخ روز تسویه می‌شوند.
</div>
</div>
<?php endif; ?>
<!-- بدهی‌های چندارزی -->
<?php if (!empty($profile['foreign_credits'])): ?>
<div style="background: white; border-radius: 8px; padding: 15px; margin-bottom: 15px; border: 1px solid #fed7aa;">
<div style="font-size: 12px; color: #666; margin-bottom: 10px; font-weight: bold;">
🌍 بدهی‌های چندارزی
</div>
<table style="width: 100%; font-size: 13px; border-collapse: collapse;">
<thead>
<tr style="text-align: right; color: #666; border-bottom: 1px solid #e5e7eb;">
<th style="padding: 4px 8px;">ارز</th>
<th style="padding: 4px 8px;">مبلغ کل</th>
<th style="padding: 4px 8px;">تسویه‌شده</th>
<th style="padding: 4px 8px;">مانده</th>
</tr>
</thead>
<tbody>
<?php foreach ($profile['foreign_credits'] as $fc): ?>
<tr style="border-bottom: 1px solid #f3f4f6;">
<td style="padding: 6px 8px;">
<span style="background: #fef3c7; color: #b45309; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700;">
<?php echo esc_html($fc['currency_code']); ?>
</span>
</td>
<td style="padding: 6px 8px; font-weight: 600;">
<?php echo number_format($fc['total_amount'], 2); ?>
</td>
<td style="padding: 6px 8px; color: #059669;">
<?php echo number_format($fc['total_settled'], 2); ?>
</td>
<td style="padding: 6px 8px; font-weight: 700; color: #dc2626;">
<?php echo number_format($fc['balance'], 2); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<!-- جزئیات -->