diff --git a/front/components/Home/File/FileUploadProgressView/FileUploadTotalSpeedView.vue b/front/components/Home/File/FileUploadProgressView/FileUploadTotalSpeedView.vue index db169dc..043f421 100644 --- a/front/components/Home/File/FileUploadProgressView/FileUploadTotalSpeedView.vue +++ b/front/components/Home/File/FileUploadProgressView/FileUploadTotalSpeedView.vue @@ -2,33 +2,52 @@ import dayjs from 'dayjs' import { motion } from 'motion-v' import getFileSize from '~/lib/getFileSize' +import showDrawer from '~/lib/showDrawer' +import FileUploadSpeedInfoView from './FileUploadSpeedInfoView.vue' +import { clamp } from 'lodash-es' const { t } = useI18n() const props = defineProps<{ speedChartData: Record }>() +const speedChartList = ref<{ timestamp: number; value: number }[]>([]) +useIntervalFn(() => { + speedChartList.value.push({ + timestamp: dayjs().unix() - 1, + value: props.speedChartData[dayjs().unix() - 1]?.reduce((acc, curr) => acc + curr.value, 0) ?? 0, + }) + if (speedChartList.value.length > 60) { + speedChartList.value.shift() + } +}, 1000) + +const handleShowSpeedInfo = () => { + showDrawer({ + render: ({ hide }) => h(FileUploadSpeedInfoView, { hide }), + }) +}