Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | 1x 44x 44x 1x 44x 44x 1x 11x 11x 11x 44x 11x 11x 11x 44x 44x 44x | /**
* VitalPointTrainingHTML - Html overlay for vital point selection
*
*/
import React, { useMemo } from "react";
import { KOREAN_VITAL_POINTS } from "../../../systems/vitalpoint/KoreanVitalPoints";
import { VitalPointSeverity } from "../../../types/common";
import { FONT_FAMILY } from "../../../types/constants";
import "../training.css";
/**
* Props for VitalPointTrainingHTML component
*/
export interface VitalPointTrainingHTMLProps {
/** Currently selected vital point ID */
readonly selectedVitalPoint: string | null;
/** Callback when vital point is selected */
readonly onVitalPointSelect: (vitalPointId: string) => void;
/** Whether on mobile device */
readonly isMobile: boolean;
}
/**
* Get color hex string from severity
*/
const getSeverityColorHex = (severity: VitalPointSeverity): string => {
const colorMap: Record<VitalPointSeverity, string> = {
[VitalPointSeverity.MINOR]: "#00ff88",
[VitalPointSeverity.MODERATE]: "#ffaa00",
[VitalPointSeverity.MAJOR]: "#ffd700",
[VitalPointSeverity.CRITICAL]: "#ff4444",
[VitalPointSeverity.LETHAL]: "#ff0000",
};
return colorMap[severity] ?? "#999999";
};
/**
* Get difficulty stars
*/
const getDifficultyStars = (difficulty: number): string => {
const stars = Math.ceil(difficulty * 5);
return "★".repeat(Math.min(stars, 5)) + "☆".repeat(5 - Math.min(stars, 5));
};
/**
* VitalPointTrainingHTML Component
* Html overlay for vital point selection and information
*/
export const VitalPointTrainingHTML: React.FC<VitalPointTrainingHTMLProps> = ({
selectedVitalPoint,
onVitalPointSelect,
isMobile,
}) => {
// Use first 8 vital points for training panel
const availableVitalPoints = useMemo(
() => KOREAN_VITAL_POINTS.slice(0, isMobile ? 4 : 8),
[isMobile]
);
const selectedPoint = useMemo(
() => availableVitalPoints.find((p) => p.id === selectedVitalPoint),
[availableVitalPoints, selectedVitalPoint]
);
const panelWidth = isMobile ? 240 : 280;
const maxHeight = isMobile ? 300 : 400;
return (
<div
style={{
width: `${panelWidth}px`,
maxHeight: `${maxHeight}px`,
background: "rgba(26, 26, 26, 0.85)",
border: "2px solid rgba(255, 0, 255, 0.9)",
borderRadius: "12px",
padding: "15px",
fontFamily: FONT_FAMILY.KOREAN,
color: "#ffffff",
boxShadow: "0 4px 20px rgba(0, 0, 0, 0.5)",
overflow: "auto",
}}
data-testid="vital-point-training-html"
>
{/* Header */}
<div style={{ marginBottom: "15px" }}>
<div
style={{
fontSize: isMobile ? "14px" : "16px",
fontWeight: "bold",
color: "#ff00ff",
}}
>
급소 선택
</div>
<div
style={{
fontSize: isMobile ? "10px" : "12px",
color: "#999999",
fontStyle: "italic",
}}
>
Vital Point Selection
</div>
</div>
{/* Vital Points List */}
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
{availableVitalPoints.map((point) => {
const isSelected = point.id === selectedVitalPoint;
const severityColor = getSeverityColorHex(point.severity);
return (
<button
key={point.id}
onClick={() => onVitalPointSelect(point.id)}
className={`vital-point-button ${isSelected ? "selected" : ""}`}
style={{
borderColor: isSelected ? "#ffd700" : severityColor,
}}
data-testid={`vital-point-${point.id}`}
>
<div
style={{
fontSize: isMobile ? "11px" : "12px",
fontWeight: "bold",
color: severityColor,
}}
>
{point.names.korean}
</div>
<div
style={{
fontSize: isMobile ? "9px" : "10px",
color: "#999999",
}}
>
{point.names.english}
</div>
<div
style={{
fontSize: isMobile ? "8px" : "9px",
color: "#ffd700",
marginTop: "4px",
}}
>
{getDifficultyStars(point.targetingDifficulty ?? 0.5)}
</div>
</button>
);
})}
</div>
{/* Selected Point Details */}
{selectedPoint && (
<div
style={{
marginTop: "15px",
paddingTop: "15px",
borderTop: "1px solid rgba(255, 255, 255, 0.2)",
}}
>
<div
style={{
fontSize: isMobile ? "11px" : "12px",
fontWeight: "bold",
color: "#00ffff",
marginBottom: "8px",
}}
>
선택된 급소 | Selected Point
</div>
<div
style={{
fontSize: isMobile ? "10px" : "11px",
color: "#ffffff",
lineHeight: "1.4",
}}
>
<div style={{ marginBottom: "4px" }}>
<span style={{ color: "#ffd700" }}>위치:</span>{" "}
{selectedPoint.category}
</div>
<div style={{ marginBottom: "4px" }}>
<span style={{ color: "#ffd700" }}>심각도:</span>{" "}
{selectedPoint.severity}
</div>
<div
style={{
fontSize: isMobile ? "9px" : "10px",
color: "#888888",
marginTop: "8px",
}}
>
{selectedPoint.description.korean} | {selectedPoint.description.english}
</div>
</div>
</div>
)}
</div>
);
};
export default VitalPointTrainingHTML;
|