37d0694b68
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m45s
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Validate - Code Quality (push) Failing after 1m28s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 1m3s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m6s
CI/CD Pipeline / Unit Tests (push) Failing after 6m46s
CI/CD Pipeline / Integration Tests (push) Successful in 2m9s
CI/CD Pipeline / Frontend Lint (push) Failing after 39s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 2m20s
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 6m35s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m55s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 2m54s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (push) Failing after 14s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 1m9s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m21s
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
28 lines
868 B
TypeScript
28 lines
868 B
TypeScript
import React from "react"
|
|
import { getRulerStep, MIN_TRACK_WIDTH } from "../../constants/timeline"
|
|
import { generateRulerMarks } from "../../utils/timeline"
|
|
|
|
interface TimeRulerProps {
|
|
totalDuration: number
|
|
pps: number
|
|
onClick: (e: React.MouseEvent<HTMLDivElement>) => void
|
|
}
|
|
|
|
export const TimeRuler: React.FC<TimeRulerProps> = ({ totalDuration, pps, onClick }) => {
|
|
const trackWidth = Math.max(totalDuration * pps, MIN_TRACK_WIDTH)
|
|
const step = getRulerStep(totalDuration)
|
|
const marks = generateRulerMarks(totalDuration, step)
|
|
|
|
return (
|
|
<div className="ep-time-ruler" onClick={onClick}>
|
|
<div className="ep-time-ruler-inner" style={{ width: trackWidth }}>
|
|
{marks.map((t) => (
|
|
<span key={t} className="ep-time-mark" style={{ left: `${t * pps}px` }}>
|
|
{t}s
|
|
</span>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|