078569cf6c
CI/CD Pipeline / CI Gate (pull_request) CI运行中 [frontend-only]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 9s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 35s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m17s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m21s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 49s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m2s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m49s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 45s
AI Code Review / AI Code Review (pull_request) Successful in 1m23s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 4m4s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 4m51s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 15m46s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 22s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 7s
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1218h30m0s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1219h26m14s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1219h26m16s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1219h26m18s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1219h43m37s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1220h47m18s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1220h59m42s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1221h3m17s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1221h3m21s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 1221h3m25s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1221h20m39s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1221h20m43s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1221h36m5s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1221h53m27s
- Phase 1: 抽 constants(RISK_DESC/RISK_LABEL/ToastState)+ utils(formatTime/formatSize/formatDuration/getRiskLevel) - Phase 2: 抽 4 个 UI 组件(RiskCard/InfoCard/SegmentsSection/SegmentCard) - Phase 3: 抽 useDuplicationDetail 业务 Hook - 主文件 323→110 行,职责清晰
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
/** 根据查重率获取风险等级 */
|
||
export const getRiskLevel = (rate?: number): "low" | "medium" | "high" => {
|
||
if (rate === undefined) return "low"
|
||
if (rate <= 10) return "low"
|
||
if (rate <= 30) return "medium"
|
||
return "high"
|
||
}
|
||
|
||
/** 格式化时间(秒 → mm:ss) */
|
||
export const formatTime = (seconds: number) => {
|
||
const m = Math.floor(seconds / 60)
|
||
const s = Math.floor(seconds % 60)
|
||
return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`
|
||
}
|
||
|
||
/** 格式化文件大小 */
|
||
export const formatSize = (bytes: number) => {
|
||
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`
|
||
if (bytes < 1024 * 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1)} MB`
|
||
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`
|
||
}
|
||
|
||
/** 格式化时长 */
|
||
export const formatDuration = (seconds?: number) => {
|
||
if (!seconds) return "-"
|
||
const totalSec = Math.round(seconds)
|
||
const m = Math.floor(totalSec / 60)
|
||
const s = totalSec % 60
|
||
return m > 0 ? `${m}分${s}秒` : `${s}秒`
|
||
}
|