Programming Phoenix LiveView B7: Page 345 code error

Same error exists in the code zip under graphics.

  def assign_shapes(%{assigns: %{board: board}} = socket) do
    shape = Board.to_shape(board)
    assign(socket, shapes: [shape])
  end

This only results in a purple board when you try it out unlike the image on page 347.

If instead you use this:

  def assign_shapes(%{assigns: %{board: board}} = socket) do
    shapes = Board.to_shapes(board)
    assign(socket, shapes: shapes)
  end

You’ll see the 3 shapes show up albeit slightly differently that they appear on page 347 as the pink P appears in between C and V instead of after V. To fix that you need to change this line:

active = Pentomino.new(name: :p, location: {3, 2}
to this
active = Pentomino.new(name: :p, location: {7, 2}

Thank you! Will fix in the next release.