Admin dashboard: fix stats waterfall, redesign layout, add animations
Deploy to route.crispygoat.com / deploy (push) Failing after 3m13s
Deploy to route.crispygoat.com / deploy (push) Failing after 3m13s
- Fetch dashboard stats server-side in admin/page.tsx to eliminate client-side useEffect waterfall and the '—' placeholder flash - Pass pre-fetched stats as props to DashboardClient - Lazy-load UpgradePlanModal via next/dynamic (only loads when needed) - Redesign stats cards with compact layout, smaller icons, Fraunces serif values - Improve Quick Actions + Usage row: side-by-side on desktop, stacked mobile - Clean up Recent Orders as a proper list with icon/name/time/amount/badge - Add staggered fade-up entrance animations (0/60/120/180/240ms delays) - Consolidate loading.tsx skeleton to match actual dashboard structure - Mobile-responsive: 2-col stats on mobile, stacked usage, collapsible header
This commit is contained in:
@@ -1863,3 +1863,392 @@
|
||||
0 1px 2px rgba(60, 56, 37, 0.06),
|
||||
0 0 0 1px rgba(60, 56, 37, 0.06);
|
||||
}
|
||||
|
||||
/* ============================================================ */
|
||||
/* === Admin Dashboard — Compact Card System ================== */
|
||||
/* ============================================================ */
|
||||
|
||||
/* Entrance animation — staggered fade-up */
|
||||
@keyframes dashboard-fade-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
.animate-fade-up {
|
||||
animation: dashboard-fade-up 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
|
||||
}
|
||||
|
||||
/* ── Stat Card ─────────────────────────────────────────────── */
|
||||
.admin-stat-card {
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 0.75rem;
|
||||
overflow: hidden;
|
||||
transition: box-shadow 150ms, transform 150ms;
|
||||
}
|
||||
.admin-stat-card:hover {
|
||||
box-shadow: var(--admin-shadow-md);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.admin-stat-card-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.875rem 1rem;
|
||||
}
|
||||
.admin-stat-icon {
|
||||
flex-shrink: 0;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
border-radius: 0.625rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.admin-stat-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.admin-stat-label {
|
||||
font-size: 0.625rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--admin-text-muted);
|
||||
line-height: 1;
|
||||
}
|
||||
.admin-stat-value {
|
||||
font-family: var(--font-fraunces), ui-serif, Georgia, serif;
|
||||
font-size: 1.375rem;
|
||||
font-weight: 600;
|
||||
font-variation-settings: "opsz" 144;
|
||||
letter-spacing: -0.025em;
|
||||
color: var(--admin-text-primary);
|
||||
line-height: 1;
|
||||
font-variant-numeric: lining-nums tabular-nums;
|
||||
}
|
||||
|
||||
/* ── Card Section (Quick Actions, Usage, Orders) ────────────── */
|
||||
.admin-card-section {
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 0.75rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
.admin-section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid var(--admin-border-light);
|
||||
}
|
||||
.admin-section-title {
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
/* ── Quick Actions ──────────────────────────────────────────── */
|
||||
.admin-quick-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.admin-quick-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.625rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
text-decoration: none;
|
||||
transition: background 150ms;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
.admin-quick-action:hover {
|
||||
background: var(--admin-bg-subtle);
|
||||
color: var(--admin-text-primary);
|
||||
}
|
||||
.admin-quick-action-icon {
|
||||
flex-shrink: 0;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
border-radius: 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.admin-quick-action-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Usage Grid ─────────────────────────────────────────────── */
|
||||
.admin-usage-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 0.75rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.admin-usage-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.625rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
.admin-usage-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
.admin-usage-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.admin-usage-label {
|
||||
font-size: 0.625rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
.admin-usage-value {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--admin-text-primary);
|
||||
}
|
||||
.admin-usage-bar {
|
||||
height: 0.375rem;
|
||||
background: var(--admin-bg);
|
||||
border-radius: 9999px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.admin-usage-fill {
|
||||
height: 100%;
|
||||
border-radius: 9999px;
|
||||
transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
.admin-usage-warning {
|
||||
font-size: 0.5625rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--admin-danger);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* ── Recent Orders ──────────────────────────────────────────── */
|
||||
.admin-orders-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.admin-order-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid var(--admin-border-light);
|
||||
text-decoration: none;
|
||||
transition: background 150ms;
|
||||
}
|
||||
.admin-order-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.admin-order-row:hover {
|
||||
background: var(--admin-bg-subtle);
|
||||
}
|
||||
.admin-order-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.admin-order-icon {
|
||||
flex-shrink: 0;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border-radius: 0.5rem;
|
||||
background: var(--admin-bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.admin-order-name {
|
||||
display: block;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--admin-text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 12rem;
|
||||
}
|
||||
.admin-order-time {
|
||||
display: block;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--admin-text-muted);
|
||||
margin-top: 0.125rem;
|
||||
}
|
||||
.admin-order-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.admin-order-amount {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
color: var(--admin-text-primary);
|
||||
}
|
||||
.admin-order-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.1875rem 0.5rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.625rem;
|
||||
font-weight: 700;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.admin-orders-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
padding: 2.5rem 1.5rem;
|
||||
}
|
||||
|
||||
/* ── Section Navigation Cards ───────────────────────────────── */
|
||||
.admin-section-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
padding: 1rem;
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 0.75rem;
|
||||
text-decoration: none;
|
||||
transition: box-shadow 180ms, transform 180ms, border-color 180ms;
|
||||
overflow: hidden;
|
||||
}
|
||||
.admin-section-card:hover {
|
||||
box-shadow: var(--admin-shadow-md);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.admin-section-card--locked {
|
||||
opacity: 0.65;
|
||||
border-style: dashed;
|
||||
}
|
||||
.admin-section-card--locked:hover {
|
||||
opacity: 0.85;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.admin-section-card--prominent {
|
||||
border-color: rgba(22, 163, 74, 0.25);
|
||||
background: linear-gradient(180deg, #fafffe 0%, #ffffff 60%);
|
||||
}
|
||||
.admin-section-card-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.125rem;
|
||||
}
|
||||
.admin-section-card-icon {
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
border-radius: 0.625rem;
|
||||
background: var(--admin-bg);
|
||||
color: var(--admin-text-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: transform 180ms;
|
||||
}
|
||||
.admin-section-card:hover .admin-section-card-icon {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
.admin-section-card-icon--prominent {
|
||||
background: var(--admin-accent-light);
|
||||
color: var(--admin-accent-text);
|
||||
}
|
||||
.admin-section-card-icon--locked {
|
||||
background: var(--admin-bg);
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
.admin-section-card-body {
|
||||
flex: 1;
|
||||
}
|
||||
.admin-section-card-title {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
color: var(--admin-text-primary);
|
||||
line-height: 1.2;
|
||||
}
|
||||
.admin-section-card-desc {
|
||||
font-size: 0.75rem;
|
||||
color: var(--admin-text-secondary);
|
||||
line-height: 1.4;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
.admin-section-card-hint {
|
||||
font-size: 0.625rem;
|
||||
font-weight: 600;
|
||||
color: var(--admin-warning);
|
||||
letter-spacing: 0.02em;
|
||||
line-height: 1.3;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
.admin-section-card-arrow {
|
||||
position: absolute;
|
||||
bottom: 0.75rem;
|
||||
right: 0.75rem;
|
||||
color: var(--admin-accent);
|
||||
opacity: 0;
|
||||
transform: translateX(-4px);
|
||||
transition: opacity 180ms, transform 180ms;
|
||||
}
|
||||
.admin-section-card:hover .admin-section-card-arrow {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
/* ── Mobile optimizations ───────────────────────────────────── */
|
||||
@media (max-width: 480px) {
|
||||
.admin-stat-card-inner {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
.admin-stat-value {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
.admin-quick-actions {
|
||||
gap: 0;
|
||||
}
|
||||
.admin-order-name {
|
||||
max-width: 8rem;
|
||||
}
|
||||
.admin-section-card {
|
||||
padding: 0.875rem;
|
||||
}
|
||||
.admin-section-card-title {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
.admin-section-card-desc {
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user