openvibers/openvibe.coupons Commits

Best code: Remind me with the other actions; the expiry as one plain line (#188)

OP OpenVibers committed 11 days ago · 6ef74f62de · 3 files, +6 −6

Changes

ddiff --git a/server/render/pages.js b/server/render/pages.js
iindex 51aed6b..1d946c8 100644
---- a/server/render/pages.js
++++ b/server/render/pages.js
@@@ -28,7 +28,7 @@ const SITE_SUMMARY = 'Coupon codes for online shops with merchant/domain matchin
const BASIS_LABEL = {
evidence: 'as stated on the evidence page',
submitter: 'according to the person who submitted it',
-- source: 'as stated by the imported source',
++ source: 'as the source states',
staff: 'set by staff',
};
const REASON_LABEL = {
ddiff --git a/server/render/store.js b/server/render/store.js
iindex ce97239..699ec2f 100644
---- a/server/render/store.js
++++ b/server/render/store.js
@@@ -93,7 +93,7 @@ function expiryOf(v) {
const day = `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
return {
instant,
-- short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day} (end of day, UTC)`,
++ short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day}, end of day UTC`,
full: instant ? `${iso.slice(0, 16).replace('T', ' ')} UTC` : `${iso.slice(0, 10)} (end of that day in UTC; the merchant's time zone is not stated)`,
basis: e.basis || null,
said: BASIS_LABEL[e.basis] || null,
@@@ -179,9 +179,9 @@ function bestCard(v, { now, windowDays, csrf, back, shop = '' }) {
<div class="cpn-codebox"><code class="cpn-codetext" id="${codeId}">${v.code}</code>${k(copyButton(codeId))}</div>
<p class="cpn-status-line">${statusText(v)}${lw ? h` · ${lw}` : ''}</p>
${lr.ever ? h`<p class="cpn-meta">${lr.iso ? h`<time datetime="${lr.iso}">${lr.text}</time>` : lr.text}</p>` : ''}
--<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` (${ex.said})` : ''}` : h`<span class="unknown">Expiry unknown</span>`}${remind ? k(remind) : ''}</p>
++<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` · ${ex.said}` : ''}` : h`<span class="unknown">Expiry unknown</span>`}</p>
${limits.length ? h`<p class="cpn-meta cpn-limits">${limits.join(' · ')}</p>` : h`<p class="cpn-meta cpn-limits">No restrictions stated. That does not mean there are none.</p>`}
--<div class="cpn-votes">${reportForms(v, { csrf, back })}</div>
++<div class="cpn-votes">${reportForms(v, { csrf, back })}${remind ? k(remind) : ''}</div>
</section>`;
}
@@@ -190,7 +190,7 @@ function codeRow(v, { now, windowDays, csrf, back, shop = '' }) {
const lr = lastReport(v, now, windowDays);
const ex = expiryOf(v);
// No report yet: the status already says so, so it is not said twice.
-- const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} (${ex.said})` : ex.short) : 'Expiry unknown'];
++ const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} · ${ex.said}` : ex.short) : 'Expiry unknown'];
const limits = restrictionText(v.restrictions);
const codeId = v.id;
// "Remind me" for the moment the code ends (plan L48 R3), with the row's other actions; only when the end is
ddiff --git a/test/store-page.test.js b/test/store-page.test.js
iindex e4048fa..41ad728 100644
---- a/test/store-page.test.js
++++ b/test/store-page.test.js
@@@ -166,7 +166,7 @@ function bestCardCode(html) {
assert.match(page.text, /id="cpn-sticky"/, 'the slim bar');
assert.match(page.text, /hidden/, 'the bar is hidden until the best code leaves the screen');
assert.match(page.text, /IntersectionObserver/, 'the few lines that show it');
-- assert.match(page.text, /Expires 31 Dec 2026 \(end of day, UTC\)/, 'the expiry with its precision');
++ assert.match(page.text, /Expires 31 Dec 2026, end of day UTC/, 'the expiry with its precision');
const about = await t.get('/m/' + shop.slug + '?tab=about');
assert.strictEqual(about.status, 200);
assert.match(about.text, /Quick facts/);