Skip to content

Commit c59c323

Browse files
committed
Enhance contribution graph responsiveness by adjusting margin based on container overflow
1 parent 9219449 commit c59c323

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/templates/app/statistics.html

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,28 +335,31 @@ <h5 class="card-title mb-3 text-center">Highest Rated Media</h5>
335335
<script>
336336
function updateJustification(containerSelector = '.activity-stats') {
337337
const container = document.querySelector(containerSelector);
338-
338+
const contributionGraph = container.querySelector('.contribution-graph');
339+
339340
// Check if content is wider than container
340341
const hasOverflow = container.scrollWidth > container.clientWidth;
341342

342343
if (hasOverflow) {
343344
container.classList.remove('justify-content-center');
344345
container.classList.add('justify-content-start');
346+
contributionGraph.classList.add('mb-4');
345347
} else {
346348
container.classList.remove('justify-content-start');
347349
container.classList.add('justify-content-center');
350+
contributionGraph.classList.remove('mb-4');
348351
}
349-
}
350-
351-
// Initial check
352-
document.addEventListener('DOMContentLoaded', () => {
353-
updateJustification();
354-
});
355-
356-
// Update on window resize
357-
window.addEventListener('resize', () => {
358-
updateJustification();
359-
});
352+
}
353+
354+
// Initial check
355+
document.addEventListener('DOMContentLoaded', () => {
356+
updateJustification();
357+
});
358+
359+
// Update on window resize
360+
window.addEventListener('resize', () => {
361+
updateJustification();
362+
});
360363
</script>
361364

362365
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.iife.min.js"></script>

0 commit comments

Comments
 (0)