feat: better parity in layout for media and preferences

This commit is contained in:
2026-04-26 21:50:31 +02:00
parent c34c7cd3e0
commit 334ffe6f6a
14 changed files with 1786 additions and 340 deletions

View File

@@ -860,6 +860,9 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ ~s(class="editor-content media-editor")
assert html =~ ~s(class="quick-actions-wrapper")
refute html =~ ~s(class="media-editor-form")
assert has_element?(view, "[data-testid='media-editor'] .editor-content.media-editor .media-details")
assert has_element?(view, "[data-testid='media-editor'] .editor-content.media-editor .media-details .media-translations-section")
assert has_element?(view, "[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"})
@@ -870,6 +873,54 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ ~s(name="media_translation[caption]")
end
test "settings and media editors render localized labels when the UI language changes", %{project: project, temp_dir: temp_dir} do
source_path = Path.join(temp_dir, "localized-hero.txt")
File.write!(source_path, "media body")
assert {:ok, media} =
Media.import_media(%{
project_id: project.id,
source_path: source_path,
title: "Lokales Bild",
alt: "Alt",
caption: "Beschriftung",
language: "de"
})
{:ok, view, _html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
html =
view
|> form("[data-testid='status-language-form']", %{ui_language: "de"})
|> render_change()
assert html =~ "Beiträge durchsuchen..."
settings_html =
render_click(view, "pin_sidebar_item", %{
"route" => "settings",
"id" => "settings-editor",
"title" => "Editor",
"subtitle" => "Editor settings"
})
assert settings_html =~ "Standard-Bearbeitungsmodus"
refute settings_html =~ "Default Editor Mode"
media_html =
render_click(view, "pin_sidebar_item", %{
"route" => "media",
"id" => media.id,
"title" => media.title,
"subtitle" => media.original_name
})
assert media_html =~ "Dateiname"
assert media_html =~ "Verknüpfte Beiträge"
refute media_html =~ "File Name"
refute media_html =~ "Linked Posts"
end
test "remaining step-5 routes render dedicated editors instead of the generic shell placeholder", %{project: project} do
assert {:ok, script} =
Scripts.create_script(%{
@@ -965,6 +1016,28 @@ defmodule BDS.Desktop.ShellLiveTest do
refute chat_html =~ "Desktop workbench content routed through the Elixir shell."
end
test "settings sidebar categories render the full old-app section model and target the requested section" do
{:ok, view, _html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
html =
render_click(view, "pin_sidebar_item", %{
"route" => "settings",
"id" => "settings-ai",
"title" => "AI",
"subtitle" => "Assistant settings"
})
assert html =~ ~s(id="settings-section-project")
assert html =~ ~s(id="settings-section-editor")
assert html =~ ~s(id="settings-section-content")
assert html =~ ~s(id="settings-section-ai")
assert html =~ ~s(id="settings-section-technology")
assert html =~ ~s(id="settings-section-publishing")
assert html =~ ~s(id="settings-section-data")
assert html =~ ~s(id="settings-section-mcp")
assert html =~ ~s(data-selected-settings-section="ai")
end
test "template sidebar exposes old-app style delete control and removes template rows", %{project: project} do
assert {:ok, template} =
BDS.Templates.create_template(%{

View File

@@ -218,6 +218,27 @@ defmodule BDS.UI.ShellTest do
assert live_ex =~ "titlebar_menu_item_index"
end
test "desktop shell css keeps the old media editor layout contract" do
css = File.read!("/Users/gb/Projects/bDS2/priv/ui/app.css")
assert css =~ ".media-preview {"
assert css =~ "min-height: 300px;"
assert css =~ ".media-details {"
assert css =~ "width: 320px;"
assert css =~ ".media-details textarea {"
assert css =~ "resize: vertical;"
assert css =~ ".linked-posts-section label {"
assert css =~ "justify-content: space-between;"
assert css =~ ".add-link-btn {"
assert css =~ "font-size: 11px;"
assert css =~ ".post-picker {"
assert css =~ "max-height: 250px;"
assert css =~ ".post-picker-search input {"
assert css =~ "padding: 6px 10px;"
assert css =~ ".linked-post-item:hover .unlink-btn {"
assert css =~ "opacity: 1;"
end
test "desktop shell status task area keeps the compact running-task markup" do
template = File.read!("/Users/gb/Projects/bDS2/lib/bds/desktop/shell_live/index.html.heex")