chore(frontend): fix type errors

This commit is contained in:
syuilo 2025-07-06 20:54:02 +09:00
parent c4fdf5a47c
commit c165749a29
1 changed files with 18 additions and 5 deletions

View File

@ -35,6 +35,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { deepClone } from '@/utility/clone.js';
const props = defineProps<{
activity: {
total: number;
@ -44,10 +46,21 @@ const props = defineProps<{
}[]
}>();
for (const d of props.activity) {
d.total = d.notes + d.replies + d.renotes;
}
const peak = Math.max(...props.activity.map(d => d.total));
const activity = deepClone(props.activity).map(d => ({
...d,
total: d.notes + d.replies + d.renotes,
x: 0,
date: {
year: 0,
month: 0,
day: 0,
weekday: 0,
},
v: 0,
color: '',
}));
const peak = Math.max(...activity.map(d => d.total));
const now = new Date();
const year = now.getFullYear();
@ -55,7 +68,7 @@ const month = now.getMonth();
const day = now.getDate();
let x = 20;
props.activity.slice().forEach((d, i) => {
activity.slice().forEach((d, i) => {
d.x = x;
const date = new Date(year, month, day - i);