Browse Source

update TODOs, Refactoring

master
GAM 4 years ago
parent
commit
617241cd38
3 changed files with 11 additions and 9 deletions
  1. +1
    -0
      src/main/java/app/gameimage/GameImageGenerator.java
  2. +8
    -7
      src/main/java/app/views/match/components/GameCard.java
  3. +2
    -2
      src/main/java/app/views/match/components/utils/GameCardUtils.java

+ 1
- 0
src/main/java/app/gameimage/GameImageGenerator.java View File

@ -6,6 +6,7 @@ import java.util.Objects;
import java.util.Set; import java.util.Set;
public class GameImageGenerator { public class GameImageGenerator {
// TODO: mark squares of the last move using PGN
private static final int FIELD_SIZE = 150; private static final int FIELD_SIZE = 150;
private static final Set<Character> WHITE_PIECES = Set.of('B', 'K', 'N', 'P', 'Q', 'R'); private static final Set<Character> WHITE_PIECES = Set.of('B', 'K', 'N', 'P', 'Q', 'R');


+ 8
- 7
src/main/java/app/views/match/components/GameCard.java View File

@ -2,7 +2,7 @@ package app.views.match.components;
import app.data.entity.Game; import app.data.entity.Game;
import app.gameimage.GameImageService; import app.gameimage.GameImageService;
import app.views.match.components.utils.GameComponentUtils;
import app.views.match.components.utils.GameCardUtils;
import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Image; import com.vaadin.flow.component.html.Image;
@ -13,6 +13,7 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
public class GameCard extends Div { public class GameCard extends Div {
// TODO: display reason for loss/draw
private final GameImageService gameImageService; private final GameImageService gameImageService;
@ -47,12 +48,12 @@ public class GameCard extends Div {
} }
private void defineLeft() { private void defineLeft() {
Label header = GameComponentUtils.getHeader(game);
Div timeControlDiv = GameComponentUtils.getTimeControlDiv(game);
Div blackDiv = GameComponentUtils.getPlayerDiv(game, false);
Label vsLabel = GameComponentUtils.getVsLabel();
Div whiteDiv = GameComponentUtils.getPlayerDiv(game, true);
Button button = GameComponentUtils.getChessComButton(game);
Label header = GameCardUtils.getHeader(game);
Div timeControlDiv = GameCardUtils.getTimeControlDiv(game);
Div blackDiv = GameCardUtils.getPlayerDiv(game, false);
Label vsLabel = GameCardUtils.getVsLabel();
Div whiteDiv = GameCardUtils.getPlayerDiv(game, true);
Button button = GameCardUtils.getChessComButton(game);
left.add(header, timeControlDiv, blackDiv, vsLabel, whiteDiv, button); left.add(header, timeControlDiv, blackDiv, vsLabel, whiteDiv, button);
left.addClassName("game-info-div"); left.addClassName("game-info-div");


src/main/java/app/views/match/components/utils/GameComponentUtils.java → src/main/java/app/views/match/components/utils/GameCardUtils.java View File

@ -24,8 +24,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
public class GameComponentUtils {
private GameComponentUtils() {
public class GameCardUtils {
private GameCardUtils() {
} }
public static int getGameNumber(Game game) { public static int getGameNumber(Game game) {

Loading…
Cancel
Save