import View from './View'

export default class RoomView extends View {
	constructor() {
		super();

		this.title = 'Room';
		this.templateUrl = 'templates/room';
	}

  afterInit() {
    const roomId = 'test';

    [1, 2].forEach(playerId => {
      const joinArea = this.find(`.join-area:nth-child(${playerId})`);
      const qrCodeHolder = joinArea.querySelector('.code-holder');
      const clearCode = joinArea.querySelector('.clear-code');

      new QRCode(qrCodeHolder, `${roomId}-${playerId}`);
      clearCode.value = `${roomId}-${playerId}`;
    });
  }

  joinLeft() {
    CastleCrush.ViewManager.load('game');
  }

  joinRight() {
    CastleCrush.ViewManager.load('game');
  }
}

@@ -202,16 +202,77 @@
  'test';
+%0A    const joinUrl = location.href.split('#')%5B0%5D + '#/join/';
 %0A%0A    %5B1
@@ -530,24 +530,34 @@
 eHolder, %60$%7B
+joinUrl%7D$%7B
 roomId%7D-$%7Bpl

Add a correct url to the qr-code to allow scanning with other apps