Fix chart sizing issue on analytics dashboard
Charts were not rendering properly because admin-script.js targeted a non-existent canvas ID (peptide-analytics-chart) instead of the actual IDs (pn-trends-chart, pn-devices-chart, pn-sources-chart). The script also used hardcoded demo data instead of the peptideNewsDashboardData object exported from PHP. Changes: - Rewrite admin-script.js to initialise all three dashboard charts (line, doughnut, bar) using the correct canvas IDs and PHP data - Set maintainAspectRatio: false so explicit canvas heights are respected - Add max-height CSS constraint on chart canvases to prevent unbounded vertical growth - Sync JS/CSS to admin/ root directory to match PEPTIDE_NEWS_PLUGIN_URL asset path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
139
admin/css/admin-style.css
Normal file
139
admin/css/admin-style.css
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* Peptide News — Admin Styles
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
/* Dashboard layout */
|
||||
.peptide-news-dashboard {
|
||||
max-width: 1400px;
|
||||
}
|
||||
|
||||
/* Date filter bar */
|
||||
.pn-date-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 20px 0;
|
||||
padding: 15px 20px;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.pn-date-filter input[type="date"] {
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* Summary cards */
|
||||
.pn-summary-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 16px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.pn-card {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
transition: box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.pn-card:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.pn-card h3 {
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.pn-card p {
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* Charts */
|
||||
.pn-charts-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.pn-chart-wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.pn-chart-box {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pn-chart-box canvas {
|
||||
max-height: 300px;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.pn-chart-box h2 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
margin: 0 0 16px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
.pn-table-section {
|
||||
margin: 30px 0;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.pn-table-section h2 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
|
||||
.pn-table-section .wp-list-table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Articles page title count */
|
||||
.title-count {
|
||||
font-weight: 400;
|
||||
color: #64748b;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 782px) {
|
||||
.pn-charts-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.pn-summary-cards {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.pn-date-filter {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user