Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,20 @@ body[data-level="6"]::after {
--glow-color: #ef4444; /* Sith Red */
}

/* Override the Tailwind duration-1000 for a better feel */
#level-progress {
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
/* Ensure the parent container has a background so you can see the 'empty' part */
#game-stats .bg-black\/10 {
background-color: rgba(0, 0, 0, 0.1) !important;
min-width: 80px; /* Ensure it hasn't collapsed to 0 width */
height: 6px;
}

/* Ensure the progress bar itself has a height and a visible color */
#level-progress {
height: 100%;
background-color: var(--accent); /* This is the level color */
transition: width 0.3s ease-in-out !important; /* Make it smooth */
display: block !important;
}

/* Force Glow for the Badge */
@keyframes force-pulse {
Expand Down
18 changes: 13 additions & 5 deletions src/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,19 @@ document.addEventListener('DOMContentLoaded', () => {
*/
function renderXP(value) {
const pb = document.getElementById('level-progress');
if (pb) {
// Ensure we don't exceed 100%
const percent = Math.min((value / XP_PER_LEVEL) * 100, 100);
pb.style.width = `${percent}%`;
}
if (!pb) return;

// 1. Ensure 'value' is a clean number
const currentXPNum = Number(value) || 0;

// 2. Calculate percentage (current / 45 * 100)
const percentage = Math.min((currentXPNum / 45) * 100, 100);

// 3. Apply to style
pb.style.width = `${percentage}%`;

// Debugging: uncomment this to see the math in your console
// console.log(`XP: ${currentXPNum}, Percent: ${percentage}%`);
}


Expand Down
Loading