aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx
blob: 332cb3c173a4b32db2700279eafb7a0515a53751 (plain)
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
export default function GolfPlayAppGaming({
  problem,
  onCodeChange,
  currentScore,
}: {
  problem: string;
  onCodeChange: (code: string) => void;
  currentScore: number | null;
}) {
  const handleTextChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
    onCodeChange(e.target.value);
  };

  return (
    <div style={{ display: "flex" }}>
      <div style={{ flex: 1, padding: "10px", borderRight: "1px solid #ccc" }}>
        <div>{problem}</div>
        <div>
          {currentScore == null ? "Score: -" : `Score: ${currentScore}`}
        </div>
      </div>
      <div style={{ flex: 1, padding: "10px" }}>
        <textarea
          style={{ width: "100%", height: "100%" }}
          onChange={handleTextChange}
        />
      </div>
    </div>
  );
}