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