usefathom / fathom

Fathom Lite. Simple, privacy-focused website analytics. Built with Golang & Preact.
https://usefathom.com/
MIT License
7.55k stars 368 forks source link

Table.js: widthClass must be zero padded. #323

Closed flopp closed 2 years ago

flopp commented 4 years ago

assets/src/js/components/Table.js creates the widthClassas

widthClass = "w" + Math.min(98, Math.round(p.Pageviews / state.total * 100 * 2.5));

=> so, there's no leading 0 for values < 10, e.g. w7

assets/src/css/styles.css defines the width classes with leading 0, e.g.

.w07:after{width:7%}

=> The light-green count bars inn the "Top Pages" and "Top Referrers" tables are not displayed properly for values < 10.

To fix this, widthClassshould be zero padded, e.g.

widthClass = "w" + ("" + Math.min(98, Math.round(p.Pageviews / state.total * 100 * 2.5))).padStart(2, '0');