chore: convert media to live component

This commit is contained in:
2026-05-03 13:09:27 +02:00
parent 9f17954ce3
commit 5bc2b4a338
7 changed files with 528 additions and 637 deletions

View File

@@ -2444,7 +2444,11 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ ~s(data-testid="media-editor")
html = render_click(view, "toggle_media_editor_quick_actions", %{"id" => media.id})
html =
view
|> element("[data-testid='media-editor'] .quick-actions-btn")
|> render_click()
assert html =~ "quick-actions-menu"
html =
@@ -2705,7 +2709,10 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ "Titelbild"
refute html =~ "Desktop workbench content routed through the Elixir shell."
html = render_click(view, "toggle_media_editor_quick_actions", %{"id" => media.id})
html =
view
|> element("[data-testid='media-editor'] .quick-actions-btn")
|> render_click()
assert html =~ "quick-actions-menu"
assert html =~ "Detect Language"
@@ -2727,7 +2734,10 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ "Updated Cover"
_html = render_click(view, "save_media_editor", %{"id" => media.id})
_html =
view
|> element("[data-testid='media-save-button']")
|> render_click()
saved_media = Repo.get!(BDS.Media.Media, media.id)
assert saved_media.title == "Updated Cover"
@@ -2791,7 +2801,10 @@ defmodule BDS.Desktop.ShellLiveTest do
"[data-testid='media-editor'] .editor-content.media-editor .media-details .linked-posts-section"
)
html = render_click(view, "edit_media_translation", %{"id" => media.id, "language" => "de"})
html =
view
|> element("[phx-click='edit_media_translation'][phx-value-language='de']")
|> render_click()
assert html =~ ~s(class="translation-modal-backdrop")
assert html =~ ~s(class="translation-modal")

View File

@@ -401,8 +401,8 @@ defmodule BDS.UI.ShellTest do
media_editor_ex =
File.read!("/Users/gb/Projects/bDS2/lib/bds/desktop/shell_live/media_editor.ex")
assert template =~ "<MediaEditor.media_editor"
assert media_editor_ex =~ "def build(%{current_tab: %{type: :media, id: media_id}} = assigns)"
assert template =~ "<.live_component module={MediaEditor}"
assert media_editor_ex =~ "defp build_data(socket)"
refute live_ex =~ "defp update_media_editor("
refute live_ex =~ "defp persist_media_editor("