From a5b65061f0b97959be0d440812a1cf8ed4e726f7 Mon Sep 17 00:00:00 2001 From: Kieran Date: Fri, 6 Dec 2024 10:37:15 -0800 Subject: [PATCH] [Housekeeping] Bump Phoenix LiveView to 1.0.0 (#495) * bumped liveview to 1.0.0 * Converted interpolation to new syntax --- lib/pinchflat/utils/string_utils.ex | 11 +++ lib/pinchflat_web.ex | 1 + .../components/core_components.ex | 92 +++++++++---------- .../custom_components/button_components.ex | 8 +- .../custom_components/tab_components.ex | 6 +- .../custom_components/table_components.ex | 4 +- .../custom_components/text_components.ex | 14 +-- lib/pinchflat_web/components/layouts.ex | 4 +- .../components/layouts/app.html.heex | 2 +- .../components/layouts/onboarding.html.heex | 2 +- .../layouts/partials/sidebar.html.heex | 4 +- .../layouts/partials/upgrade_modal.heex | 2 +- .../components/layouts/root.html.heex | 4 +- .../media_item_html/edit.html.heex | 2 +- .../media_item_html/show.html.heex | 12 +-- .../media_profile_html/edit.html.heex | 2 +- .../media_profile_html/index.html.heex | 4 +- .../output_template_help.html.heex | 24 +++-- .../media_profile_html/show.html.heex | 6 +- .../controllers/pages/page_html.ex | 2 +- .../pages/page_html/history_table_live.ex | 10 +- .../pages/page_html/home.html.heex | 4 +- .../pages/page_html/job_table_live.ex | 8 +- .../controllers/searches/search_html.ex | 2 +- .../searches/search_html/show.html.heex | 4 +- .../setting_html/setting_form.html.heex | 4 +- .../sources/source_html/edit.html.heex | 2 +- .../sources/source_html/index.html.heex | 2 +- .../sources/source_html/index_table_live.ex | 4 +- .../source_html/media_item_table_live.ex | 4 +- .../sources/source_html/show.html.heex | 20 ++-- mix.exs | 4 +- mix.lock | 12 +-- test/pinchflat/utils/string_utils_test.exs | 6 ++ 34 files changed, 157 insertions(+), 135 deletions(-) diff --git a/lib/pinchflat/utils/string_utils.ex b/lib/pinchflat/utils/string_utils.ex index d96d6c1..bee23b5 100644 --- a/lib/pinchflat/utils/string_utils.ex +++ b/lib/pinchflat/utils/string_utils.ex @@ -41,4 +41,15 @@ defmodule Pinchflat.Utils.StringUtils do string end end + + @doc """ + Wraps a string in double braces. Useful as a UI helper now that + LiveView 1.0.0 allows `{}` for interpolation so now we can't use braces + directly in the view. + + Returns binary() + """ + def double_brace(string) do + "{{ #{string} }}" + end end diff --git a/lib/pinchflat_web.ex b/lib/pinchflat_web.ex index ef58d00..28d5807 100644 --- a/lib/pinchflat_web.ex +++ b/lib/pinchflat_web.ex @@ -100,6 +100,7 @@ defmodule PinchflatWeb do import PinchflatWeb.CustomComponents.TextComponents import PinchflatWeb.CustomComponents.TableComponents import PinchflatWeb.CustomComponents.ButtonComponents + import Pinchflat.Utils.StringUtils, only: [double_brace: 1] alias Pinchflat.Settings alias Pinchflat.Utils.StringUtils diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 8f5ff75..e66e236 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -82,7 +82,7 @@ defmodule PinchflatWeb.CoreComponents do
- <%= render_slot(@inner_block) %> + {render_slot(@inner_block)}
@@ -126,9 +126,9 @@ defmodule PinchflatWeb.CoreComponents do ]}>
- <%= @title %> + {@title}
-

<%= msg %>

+

{msg}