Jelajahi Sumber

Color names in the frontend

Ard 5 tahun lalu
induk
melakukan
73d91ad40a

+ 2 - 1
frontend/keezen-frontend/src/Game.js

@@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
 import Hand from "./Hand";
 import { SiteState } from "./StateRouter";
 import { Card } from "./Card";
+import { colorToText } from "./util/colors";
 
 export default function Game({ message, swapCard, playCard, confirmPlay, undoPlay }) {
     console.log(message);
@@ -30,7 +31,7 @@ export default function Game({ message, swapCard, playCard, confirmPlay, undoPla
             break;
         case SiteState.PLAY_CARD_OTHER:
             card = play_card;
-            text = `${current_player.color}(${current_player.name}) is een kaart aan het spelen`;
+            text = `${colorToText(current_player.color)} is aan de beurt`;
             break;
     }
 

+ 14 - 1
frontend/keezen-frontend/src/util/colors.js

@@ -5,4 +5,17 @@ const Colors = {
     GREEN: "green",
 }
 
-export default Colors;
+export default Colors;
+
+export function colorToText(color) {
+    switch (color) {
+        case Colors.RED:
+            return "Rood"
+        case Colors.BLUE:
+            return "Blauw"
+        case Colors.YELLOW:
+            return "Geel"
+        case  Colors.GREEN:
+            return "Groen"
+    }
+}