diff --git a/public/charts.js b/public/charts.js new file mode 100644 index 0000000..ca36cef --- /dev/null +++ b/public/charts.js @@ -0,0 +1,35 @@ +/* eslint-disable no-undef */ +function loadAllCharts() { + document.querySelectorAll('.feature-list-wrapper').forEach(wrapper => { + // Find and generate all relevant data + const allFeatureNodes = wrapper.querySelectorAll('.feature'); + const allDoneFeatureNodes = wrapper.querySelectorAll('.feature [checked]'); + + const progressPercentage = Math.round(Math.min((allDoneFeatureNodes.length / allFeatureNodes.length) * 100, 100)); + const remainingPercentage = 100 - progressPercentage; + + // Set inner paragraph + wrapper.querySelectorAll('.percentage-label').forEach(p => { + p.innerText = progressPercentage.toString().padStart(2, '0') + '%'; + }); + + // Create chart + const data = [progressPercentage, remainingPercentage]; + Chart.defaults.plugins.legend = { + display: false + }; + new Chart(wrapper.querySelector('canvas'), { + type: 'doughnut', + data: { + labels: ['Done', 'Todo'], + datasets: [ + { + data, + backgroundColor: ['white', 'transparent'] + } + ] + } + }); + }); +} +loadAllCharts(); \ No newline at end of file diff --git a/public/main.css b/public/main.css index acc1cdf..241a487 100644 --- a/public/main.css +++ b/public/main.css @@ -353,7 +353,68 @@ section.team { color: var(--text-secondary); } +/* Progress */ +.feature-list-wrapper h3 { + margin: 0; +} +.feature-list-wrapper hr { + border: 0; + width: 100%; + height: 1px; + margin: 20px 0; + background: rgba(255, 255, 255, 0.1); +} +.feature-list-wrapper .feature-list-top { + display: grid; + align-items: center; + grid-template-columns: auto 1fr; + grid-gap: 20px; +} +.feature-list-wrapper canvas { + width: 100px; + height: 100px; +} +.feature-progress-chart { + position: relative; +} +.feature-progress-chart p { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + margin: 0; +} + +/* Progress: Feature list */ +.feature-list { + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-gap: 10px; +} +.feature { + display: grid; + align-items: center; + grid-template-columns: auto 1fr; + grid-gap: 10px; +} + +/* Custom checkboxes */ +.custom-checkbox { + width: 1.5rem; + height: 1.5rem; + background: var(--background); + /* border: 1px solid var(--text-secondary); */ + color: var(--text); + border-radius: 4px; +} +.custom-checkbox svg { + width: 100%; + height: 100%; +} + + +/* Footer */ footer { text-align: center; color: var(--text-secondary); diff --git a/views/home.handlebars b/views/home.handlebars index 2115e67..270ab0c 100644 --- a/views/home.handlebars +++ b/views/home.handlebars @@ -98,9 +98,48 @@
{{ this }}
- {{/each}} +