Repository navigation
Expand file tree
/
Copy pathHudSurface.tsx
More file actions
54 lines (53 loc) · 1.58 KB
/
Copy pathHudSurface.tsx
File metadata and controls
54 lines (53 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import type { RefObject } from "react";
import { HUD_PAGES } from "./canvas-hud";
import type { HudControllerModes } from "./hud-controller-types";
import { translatePhone } from "./phone-i18n";
import type { PhoneLocale } from "./phone-types";
export function HudSurface({
canvasRef,
modes,
locale,
}: {
readonly canvasRef: RefObject<HTMLCanvasElement | null>;
readonly modes: HudControllerModes;
readonly locale: PhoneLocale;
}) {
const renderer = modes.fastCanvas
? "canvas-fast"
: modes.layeredHybrid
? "hybrid-z"
: modes.hybrid
? "hybrid"
: modes.canvas
? "canvas"
: modes.calibration
? "calibration"
: "image";
return (
<section
className="hud-frame"
data-testid="hud-frame"
dir="ltr"
data-logical-size="576x288"
data-renderer={renderer}
data-layering={modes.layeredHybrid ? "explicit" : undefined}
data-layout={modes.fastCanvas
? "static-left-dynamic-right"
: modes.layeredHybrid ? "map-text-console" : undefined}
data-update-tiles={modes.fastCanvas ? "2" : undefined}
data-text-containers={modes.diagnostic ? "2" : "1"}
data-image-containers={modes.diagnostic ? "1" : "4"}
data-pages={modes.canvas || modes.hybrid ? HUD_PAGES.length : undefined}
aria-label={translatePhone(locale, "hudRasterPreview")}
>
<canvas
ref={canvasRef}
width="576"
height="288"
dir="ltr"
role="img"
aria-label={translatePhone(locale, "hudGlassesFrame")}
/>
</section>
);
}