Skip to content

Commit

Permalink
Upgrade to Phoenix 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyc committed Aug 6, 2023
1 parent 1cee995 commit 22aa8b0
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 61 deletions.
3 changes: 2 additions & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
import_deps: [:phoenix],
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"],
locals_without_parens: [extract: 2, extract: 3]
locals_without_parens: [extract: 2, extract: 3],
plugins: [Phoenix.LiveView.HTMLFormatter]
]
6 changes: 4 additions & 2 deletions lib/open890_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ defmodule Open890Web do
def live_view do
quote do
use Phoenix.LiveView,
layout: {Open890Web.LayoutView, "live.html"}
layout: {Open890Web.LayoutView, :live}

alias Open890Web.Components
alias Open890Web.RadioViewHelpers
Expand Down Expand Up @@ -85,7 +85,7 @@ defmodule Open890Web do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML

import Phoenix.LiveView.Helpers
import Phoenix.Component

# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
Expand All @@ -95,6 +95,8 @@ defmodule Open890Web do

import Open890Web.RadioViewHelpers

alias Open890.RadioConnection

import Phoenix.LiveView
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/open890_web/components/audio_scope.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ defmodule Open890Web.Components.AudioScope do
triangle_points = "-5,5 0,18 5,5"
# triangle_points = "0,#{tri_ofs+13} #{-tri_ofs},5 #{tri_ofs},5"

assigns = assign(assigns, :triangle_points, triangle_points)

~H"""
<g id="notchIndicatorGroup" transform={notch_transform(@active_mode, @filter_mode, @filter_state, @notch_state)}>
<line id="notchLocationIndicator" class="" x1="0" y1="5" x2="0" y2="45" />
<polyline id="notchTriangle" points={triangle_points} />
<polyline id="notchTriangle" points={@triangle_points} />
<line id="notchTriangleFill" x1="-4" y1="5" x2="4" y2="5" />
</g>
"""
Expand Down
37 changes: 28 additions & 9 deletions lib/open890_web/components/band_scope.ex
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ defmodule Open890Web.Components.BandScope do
def auto_scroll_mode_vertical_grid(assigns) do
values = 1..9 |> Enum.map(fn x -> x * 64 end)

assigns = assign(assigns, :values, values)

~H"""
<%= for value <- values do %>
<%= for value <- @values do %>
<line class="bandscopeGrid vertical" x1={value} y1="0" x2={value} y2="640" />
<% end %>
"""
Expand Down Expand Up @@ -172,11 +174,16 @@ defmodule Open890Web.Components.BandScope do
x = project_to_bandscope_limits(marker.freq, assigns.band_scope_edges)
classes = "marker user vertical #{marker.color}"

assigns = assign(assigns, %{
x: x,
classes: classes
})

~H"""
<g class="user_marker_group" transform="translate(0 0)">
<line id="marker-#{marker.id}" phx-hook="Marker" class={classes} x1={x} y1="0" x2={x+2} y2={"640"} pointer-events="visibleStroke" phx-click="marker_clicked" phx-value-id={marker.id} />
<line id="marker-#{@marker.id}" phx-hook="Marker" class={@classes} x1={@x} y1="0" x2={@x+2} y2={"640"} pointer-events="visibleStroke" phx-click="marker_clicked" phx-value-id={@marker.id} />
<rect class="marker_delete" x={x-3} y="-2" height="4" width="6" pointer-events="visibleFill" phx-click="delete_user_marker" phx-value-id={marker.id}/>
<rect class="marker_delete" x={@x-3} y="-2" height="4" width="6" pointer-events="visibleFill" phx-click="delete_user_marker" phx-value-id={@marker.id}/>
</g>
"""
end
Expand Down Expand Up @@ -222,9 +229,11 @@ defmodule Open890Web.Components.BandScope do
def band_scope_horizontal_grid(assigns) do
offset = 140 / 8

assigns = assign(assigns, :offset, offset)

~H"""
<%= for i <- (0..7) do %>
<line class="bandscopeGrid horizontal" x1="0" y1={i * offset} x2="640" y2={i * offset} />
<line class="bandscopeGrid horizontal" x1="0" y1={i * @offset} x2="640" y2={i * @offset} />
<% end %>
"""
end
Expand Down Expand Up @@ -258,8 +267,11 @@ defmodule Open890Web.Components.BandScope do
""
end


assigns = assign(assigns, :points, points)

~H"""
<polygon id="passband" points={points} />
<polygon id="passband" points={@points} />
"""
end

Expand Down Expand Up @@ -382,11 +394,18 @@ defmodule Open890Web.Components.BandScope do
_ -> "R"
end

assigns = assign(assigns, %{
loc: loc,
label: label,
label_translate: label_translate,
triangle_points: triangle_points,
tri_text_x: tri_text_x
})
~H"""
<line class={add_mode(mode, "carrier")} x1={loc} y1="0" x2={loc} y2="150" />
<g class={add_mode(mode, "triangleGroup")} transform={label_translate}>
<polygon class={add_mode(mode, "triangle")} points={triangle_points} />
<text class={add_mode(mode, "triangleText")} x={tri_text_x} y="7"><%= label %></text>
<line class={add_mode(@mode, "carrier")} x1={@loc} y1="0" x2={@loc} y2="150" />
<g class={add_mode(@mode, "triangleGroup")} transform={@label_translate}>
<polygon class={add_mode(@mode, "triangle")} points={@triangle_points} />
<text class={add_mode(@mode, "triangleText")} x={@tri_text_x} y="7"><%= @label %></text>
</g>
"""
end
Expand Down
Loading

0 comments on commit 22aa8b0

Please sign in to comment.