Skip to content

Commit 8d087fa

Browse files
committed
Use accurate student Checks count
1 parent dc715f9 commit 8d087fa

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/modules/ui.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ div[data-modal-page] {
122122
transition: 0.25s background-color;
123123
}
124124

125-
[data-modal-page="store"]:has(.promo button:hover) .promo:not(:has(button:hover)),
126125
[data-modal-page="store"]:has(.promo button:hover) .theme-item:not(:has(button:hover)),
127126
[data-modal-page="store"]:has(.promo button:hover) [data-modal-buttons],
128-
[data-modal-page="store"]:has(.themes-grid .theme-item button:hover) .promo:not(:has(button:hover)),
129-
[data-modal-page="store"]:has(.themes-grid .theme-item button:hover)
130-
.theme-item:not(:has(button:hover)),
127+
[data-modal-page="store"]:has(.themes-grid .theme-item button:hover) .promo,
128+
[data-modal-page="store"]:has(.themes-grid .theme-item button:hover) .theme-item:not(:has(button:hover)),
131129
[data-modal-page="store"]:has(.themes-grid .theme-item button:hover) [data-modal-buttons] {
132130
opacity: 0;
133131
transition: 0.25s opacity;
@@ -160,6 +158,11 @@ div[data-modal-page] {
160158
font-weight: bold;
161159
}
162160

161+
[data-modal-page="store"] .promo:has(button:hover) {
162+
background-image: none !important;
163+
border-color: transparent;
164+
}
165+
163166
[data-modal-page="store"] .promo .promo-inner {
164167
color: var(--text-color);
165168
background: var(--surface-color);

src/themes/themes.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,11 @@ try {
347347
// Render Theme Store
348348
const store = document.querySelector(`[data-modal-page="store"]`);
349349
if (store) {
350-
const checks = 0;
350+
await storage.idbReady;
351+
const checks = (await storage.idbGet("cache"))?.checksCount || 0;
351352
const checksText = document.createElement("p");
352353
checksText.classList = 'checks-text';
353-
checksText.innerHTML = `<i class="bi bi-check2-circle"></i> You've got ${checks} Checks`;
354+
checksText.innerHTML = `<i class="bi bi-check2-circle"></i> You've got ${checks} Check${checks == 1 ? '' : 's'} available to spend!`;
354355
store.appendChild(checksText);
355356
if (featuredTheme) {
356357
const promo = document.createElement("div");
@@ -365,7 +366,7 @@ try {
365366
promoButton.addEventListener("mouseover", () => {
366367
initialTheme = document.body.getAttribute('data-theme') || '';
367368
document.body.setAttribute('data-theme', featuredTheme[0] || '');
368-
promoButton.textContent = `Get Theme (${featuredTheme[3] ? `${featuredTheme[3]} Checks` : 'Free'})`;
369+
promoButton.textContent = `Get Theme (${featuredTheme[3] ? `${featuredTheme[3]} Check${featuredTheme[3] == 1 ? '' : 's'}` : 'Free'})`;
369370
});
370371
promoButton.addEventListener("mouseout", () => {
371372
document.body.setAttribute('data-theme', initialTheme);
@@ -384,15 +385,15 @@ try {
384385
const themeItem = document.createElement("div");
385386
themeItem.classList = 'theme-item';
386387
themeItem.setAttribute("data-theme", value);
387-
themeItem.setAttribute('tooltip', `${name} Theme (${theme[3] ? `${theme[3]} Checks` : 'Free'})`);
388-
themeItem.innerHTML = `${theme[2] ? `<i class="bi bi-${theme[2]}"></i>` : ''}<h5>${name}</h5><p>${theme[3] ? `${theme[3]} Checks` : 'Free'}</p>${theme[4] && theme[4].length ? `<small>Requires: ${theme[4].map(t => themes.find(th => th[0] == t)[1] || t).join(', ')}</small>` : ''}`;
388+
themeItem.setAttribute('tooltip', `${name} Theme (${theme[3] ? `${theme[3]} Check${theme[3] == 1 ? '' : 's'}` : 'Free'})`);
389+
themeItem.innerHTML = `${theme[2] ? `<i class="bi bi-${theme[2]}"></i>` : ''}<h5>${name}</h5><p>${theme[3] ? `${theme[3]} Check${theme[3] == 1 ? '' : 's'}` : 'Free'}</p>${theme[4] && theme[4].length ? `<small>Requires: ${theme[4].map(t => themes.find(th => th[0] == t)[1] || t).join(', ')}</small>` : ''}`;
389390
if (value === initialTheme) themeItem.classList.add('selected');
390391
const themeButton = document.createElement("button");
391392
themeButton.textContent = "Preview";
392393
themeButton.addEventListener("mouseover", () => {
393394
initialTheme = document.body.getAttribute('data-theme') || '';
394395
document.body.setAttribute('data-theme', theme[0] || '');
395-
themeButton.textContent = `Get (${theme[3] ? `${theme[3]} Checks` : 'Free'})`;
396+
themeButton.textContent = theme[3] ? `Get (${theme[3] ? `${theme[3]} Check${theme[3] == 1 ? '' : 's'}` : 'Free'})` : 'Apply Now';
396397
});
397398
themeButton.addEventListener("mouseout", () => {
398399
document.body.setAttribute('data-theme', initialTheme);

0 commit comments

Comments
 (0)