openreplay/frontend/app/player-ui/PlayTime.tsx
Andrey Babushkin fd5c0c9747
Add lokalisation (#3092)
* applied eslint

* add locales and lint the project

* removed error boundary

* updated locales

* fix min files

* fix locales
2025-03-06 17:43:15 +01:00

43 lines
866 B
TypeScript

import React from 'react';
import { Duration } from 'luxon';
import { getTimeFromMill } from 'App/date';
const styles = {
padding: '0 12px',
width: '70px',
'text-align': 'center',
};
interface IProps {
/** current time in ms */
time: number;
isCustom?: boolean;
format?: string;
}
/** Play time timer */
export function PlayTime({ time, isCustom, format = 'm:ss' }: IProps) {
return (
<div
style={!isCustom ? styles : undefined}
className={!isCustom ? 'color-gray-medium' : undefined}
>
{Duration.fromMillis(time).toFormat(format)}
</div>
);
}
/** Displays current time during replay */
export function RealPlayTime({
time,
sessionStart,
tz,
}: {
time: number;
sessionStart: number;
tz: string;
}) {
return <div>{getTimeFromMill(time + sessionStart, tz)}</div>;
}
PlayTime.displayName = 'PlayTime';