[+] Display no data

This commit is contained in:
Azalea
2024-03-05 03:21:49 -05:00
parent 67b29851ea
commit 666fbe8ce7

View File

@@ -75,18 +75,22 @@
<div class="trend"> <div class="trend">
<!-- ChartJS cannot be fully responsive unless there is a parent div that's independent from its size and helps it determine its size --> <!-- ChartJS cannot be fully responsive unless there is a parent div that's independent from its size and helps it determine its size -->
<div class="chartjs-box-reference"> <div class="chartjs-box-reference">
<Line data={{ {#if d.trend.length === 0}
datasets: [ <div class="no-data">No data in the past 60 days</div>
{ {:else}
label: 'Rating', <Line data={{
data: d.trend.map(it => {return {x: Date.parse(it.date), y: it.rating}}), datasets: [
borderColor: '#646cff', {
tension: 0.1, label: 'Rating',
data: d.trend.map(it => {return {x: Date.parse(it.date), y: it.rating}}),
borderColor: '#646cff',
tension: 0.1,
// TODO: Set X axis span to 3 months // TODO: Set X axis span to 3 months
} }
] ]
}} options={CHARTJS_OPT} /> }} options={CHARTJS_OPT} />
{/if}
</div> </div>
</div> </div>
@@ -282,6 +286,13 @@ $gap: 20px
> .chartjs-box-reference > .chartjs-box-reference
position: absolute position: absolute
inset: 0 inset: 0
display: flex
align-items: center
justify-content: center
.no-data
opacity: 0.5
user-select: none
@media (max-width: $w-mobile) @media (max-width: $w-mobile)
flex-direction: column flex-direction: column