- for (let i = 0; i < V.RESERVE_PIECES.length; i++) {
- const qty = this.vr.reserve[playingColor][V.RESERVE_PIECES[i]];
- myReservePiecesArray.push(
- h(
- "div",
- {
- "class": { board: true, ["board" + reserveSquareNb]: true },
- attrs: { id: getSquareId({ x: sizeX + shiftIdx, y: i }) },
- style: { opacity: qty > 0 ? 1 : 0.35 }
- },
- [
- h("img", {
- "class": { piece: true, reserve: true },
- attrs: {
- src:
- "/images/pieces/" +
- this.vr.getReservePpath(i, playingColor, orientation) +
- ".svg"
- }
- }),
- h("sup", { "class": { "reserve-count": true } }, [ qty ])
- ]
- )
- );
+ if (!!this.vr.reserve[playingColor]) {
+ for (let i = 0; i < V.RESERVE_PIECES.length; i++) {
+ const qty = this.vr.reserve[playingColor][V.RESERVE_PIECES[i]];
+ myReservePiecesArray.push(
+ h(
+ "div",
+ {
+ "class": { board: true, ["board" + reserveSquareNb]: true },
+ attrs: { id: getSquareId({ x: sizeX + shiftIdx, y: i }) },
+ style: { opacity: qty > 0 ? 1 : 0.35 }
+ },
+ [
+ h("img", {
+ // NOTE: class "reserve" not used currently
+ "class": { piece: true, reserve: true },
+ attrs: {
+ src:
+ "/images/pieces/" +
+ this.vr.getReservePpath(i, playingColor, orientation) +
+ ".svg"
+ }
+ }),
+ h(
+ "sup",
+ {
+ "class": { "reserve-count": true },
+ style: { top: "calc(100% + 5px)" }
+ },
+ [ qty ]
+ )
+ ]
+ )
+ );
+ }