- 键盘控制:数字按名次选车、方向键移动光标、出/收字幕、圈数 +/-、计时器、 名次脚本、快捷键总表;在输入框里打字时不触发,每次按键都有 Toast 反馈 - 车手名单编辑器(E):姓名/缩写/车号/国籍/车队/性能/黄T摄/头像均可改, 支持调整发车顺位、单条重置、全部重置、JSON 导入导出,localStorage 持久化 - LAP 可手动 +/-,LAP 旁新增 mm:ss.mmm 计时器(零点=计时榜出现的瞬间) - 名次脚本(J):JSON 预设,以计时器为零点,支持 swap/move/retire/restore/lap 与 order * 改脚本即时生效并从零重播,修掉"改完之后过期事件被一次性爆发"的问题 * order 立即铺回赛道;写错会在状态条里报出具体原因,不再静默失败 * localStorage 持久化,刷新不再丢失 - 合并 feature/standalone-output:OBS 透明输出页 /output 与 WebSocket 中继 server/relayServer.js * 修复中继晚连接的输出页只能收到最后一片补丁(缓存改为合并累加) - 修复 react-spring 缺少 deps 导致进场动画被每次渲染重启 (chyron、百叶窗、wipe、计时塔名次描边) - 界面中文化(上屏的转播图形保持英文),F1 字体栈补 CJK 回退 - 新增「启动开发服务器.cmd」一键启动,.gitignore 排除本地工具目录
151 lines
4.9 KiB
TypeScript
151 lines
4.9 KiB
TypeScript
import styled from "styled-components/macro";
|
|
import { BGStatusIndicatorModes } from "../../../../types/state";
|
|
|
|
import { DirectionalTransitionProps } from "../../../../types/style";
|
|
import { commonDirectionalTransition } from "../../../../utils/styling";
|
|
|
|
export const StatusIndicatorBase = styled.div<DirectionalTransitionProps>`
|
|
background-color: black;
|
|
border-top-right-radius: ${p => p.theme.design.statusIndicator.roundedCornerRadiusPx}px;
|
|
height: ${p => p.theme.design.statusIndicator.heightNormalPx}px;
|
|
width: ${({ theme: { design: { timingTower: ttTheme } }, open }) => open
|
|
? ttTheme.rowLeftHalfWidthPx + ttTheme.rowRightHalfWidthPx
|
|
: ttTheme.rowLeftHalfWidthPx}px;
|
|
|
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
|
`;
|
|
|
|
|
|
export const StatusIndicatorLayout = styled.div`
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
`;
|
|
|
|
type IndicatorModeProps = {
|
|
mode: BGStatusIndicatorModes,
|
|
};
|
|
|
|
|
|
////// Lap Indicator Mode Styles //////
|
|
type LapLineProps = DirectionalTransitionProps & IndicatorModeProps;
|
|
export const LapLine = styled.div<LapLineProps>`
|
|
position: absolute;
|
|
top: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 33 : mode === BGStatusIndicatorModes.LapWide ? 5 : 0}px;
|
|
left: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 30 : mode === BGStatusIndicatorModes.LapWide ? 128 : 0}px;
|
|
|
|
opacity: ${({ open }) => open ? 1 : 0};
|
|
|
|
width: ${({ mode, open }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? (90 * (open ? 1 : 0.3)) : mode === BGStatusIndicatorModes.LapWide ? 3 : 0}px;
|
|
height: ${({ mode, open }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 3 : mode === BGStatusIndicatorModes.LapWide ? (60 * (open ? 1 : 0.3)) : 0}px;
|
|
|
|
background-color: ${p => p.theme.colors.textWhite};
|
|
border: 1px solid ${p => p.theme.colors.dimGrey};
|
|
mask-image: linear-gradient(
|
|
to ${({ mode }) => mode === BGStatusIndicatorModes.LapNarrow ? "left" : "bottom"},
|
|
transparent 0,
|
|
#000000cc 40%,
|
|
#000000cc 50%,
|
|
#000000cc 60%,
|
|
transparent 100%
|
|
);
|
|
|
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
|
`;
|
|
|
|
|
|
type LapLabelProps = DirectionalTransitionProps & IndicatorModeProps;
|
|
export const LapLabel = styled.span<LapLabelProps>`
|
|
position: absolute;
|
|
top: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 6 : mode === BGStatusIndicatorModes.LapWide ? 22 : 0}px;
|
|
left: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 33 : mode === BGStatusIndicatorModes.LapWide ? 25 : 0}px;
|
|
|
|
font-family: ${p => p.theme.fonts.f1Wide};
|
|
font-size: ${p => p.theme.fontSizes.indicatorLapLabel};
|
|
color: ${p => p.theme.colors.textWhite};
|
|
|
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
|
`;
|
|
|
|
|
|
////// Show Clock //////
|
|
|
|
type ClockChipProps = {
|
|
running: boolean,
|
|
};
|
|
/**
|
|
* The stopwatch that hangs off the right edge of the LAP box. It is positioned
|
|
* against the status indicator rather than inside it so it never competes with
|
|
* the lap readout for space, whatever mode the indicator is in.
|
|
*/
|
|
export const ClockChip = styled.div<ClockChipProps>`
|
|
position: absolute;
|
|
left: 100%;
|
|
top: 23px;
|
|
margin-left: 8px;
|
|
padding: 4px 8px;
|
|
border-radius: 3px;
|
|
background-color: black;
|
|
|
|
font-family: ${p => p.theme.fonts.f1Regular};
|
|
font-size: 16px;
|
|
line-height: 1;
|
|
letter-spacing: 0.03em;
|
|
white-space: nowrap;
|
|
font-feature-settings: 'tnum' 1;
|
|
min-width: 8.4ch;
|
|
text-align: center;
|
|
|
|
color: ${({ running, theme }) => running
|
|
? theme.colors.textWhite : theme.colors.dimGrey};
|
|
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
|
|
transition: color 250ms;
|
|
`;
|
|
|
|
|
|
type LapCountProps = DirectionalTransitionProps & IndicatorModeProps;
|
|
export const LapCount = styled.div<LapCountProps>`
|
|
position: absolute;
|
|
top: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 41 : mode === BGStatusIndicatorModes.LapWide ? 24 : 0}px;
|
|
left: ${({ mode }) =>
|
|
mode === BGStatusIndicatorModes.LapNarrow
|
|
? 72 : mode === BGStatusIndicatorModes.LapWide ? 185 : 0}px;
|
|
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
|
|
width: 0;
|
|
height: ${p => p.theme.fontSizes.indicatorLapCount};
|
|
overflow-y: clip;
|
|
|
|
> span {
|
|
font-family: ${p => p.theme.fonts.f1Regular};
|
|
font-size: ${p => p.theme.fontSizes.indicatorLapCount};
|
|
color: ${p => p.theme.colors.textWhite};
|
|
|
|
font-feature-settings: 'tnum' 1;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
|
`;
|