style: fix pre-existing formatting drift across codebase

This commit is contained in:
2026-05-30 09:00:29 +02:00
parent 7045b10738
commit 2bed225133
44 changed files with 452 additions and 194 deletions

View File

@@ -103,7 +103,9 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
socket
) do
next_data = Map.put(socket.assigns.surface_data, surface_id, fields)
{:noreply, assign(socket, :surface_data, next_data) |> schedule_surface_state_persist() |> build_data()}
{:noreply,
assign(socket, :surface_data, next_data) |> schedule_surface_state_persist() |> build_data()}
end
def handle_event(
@@ -227,8 +229,11 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
build_data(socket)
socket.assigns.offline_mode ->
Notify.output(dgettext("ui", "Chat"),
dgettext("ui", "Automatic AI actions stay gated by airplane mode."), "info")
Notify.output(
dgettext("ui", "Chat"),
dgettext("ui", "Automatic AI actions stay gated by airplane mode."),
"info"
)
build_data(socket)

View File

@@ -35,14 +35,28 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
known_refs = MapSet.new(tasks, & &1.ref)
drain_tasks(
remaining, tasks, known_refs, project_id, post_id, language, translate_targets, parent
remaining,
tasks,
known_refs,
project_id,
post_id,
language,
translate_targets,
parent
)
send(parent, {:add_images_complete, length(paths)})
end
defp drain_tasks(
[], tasks, _known_refs, _project_id, _post_id, _language, _translate_targets, _parent
[],
tasks,
_known_refs,
_project_id,
_post_id,
_language,
_translate_targets,
_parent
) do
Enum.each(tasks, fn task -> Task.await(task, :infinity) end)
end
@@ -65,7 +79,12 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
new_task =
Task.async(fn ->
process_single_image(
next_path, project_id, post_id, language, translate_targets, parent
next_path,
project_id,
post_id,
language,
translate_targets,
parent
)
end)
@@ -81,8 +100,14 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
)
else
drain_tasks(
[next_path | rest], tasks, known_refs,
project_id, post_id, language, translate_targets, parent
[next_path | rest],
tasks,
known_refs,
project_id,
post_id,
language,
translate_targets,
parent
)
end
@@ -93,7 +118,12 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
new_task =
Task.async(fn ->
process_single_image(
next_path, project_id, post_id, language, translate_targets, parent
next_path,
project_id,
post_id,
language,
translate_targets,
parent
)
end)
@@ -109,8 +139,14 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
)
else
drain_tasks(
[next_path | rest], tasks, known_refs,
project_id, post_id, language, translate_targets, parent
[next_path | rest],
tasks,
known_refs,
project_id,
post_id,
language,
translate_targets,
parent
)
end
end
@@ -124,16 +160,22 @@ defmodule BDS.Desktop.ShellLive.GalleryImport do
end
defp process_single_image(
path, project_id, post_id, language, translate_targets, parent
path,
project_id,
post_id,
language,
translate_targets,
parent
) do
with {:ok, media} <- Media.import_media(%{project_id: project_id, source_path: path}),
true <- String.starts_with?(media.mime_type || "", "image/"),
{:ok, result} <- AI.analyze_image(media.id, language: language),
{:ok, _updated} <- Media.update_media(media.id, %{
title: result.title,
alt: result.alt,
caption: result.caption
}),
{:ok, _updated} <-
Media.update_media(media.id, %{
title: result.title,
alt: result.alt,
caption: result.caption
}),
{:ok, _link} <- Media.link_media_to_post(media.id, post_id) do
translate_media_translations(media.id, translate_targets)
title = result.title || media.original_name

View File

@@ -642,7 +642,10 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
defp maybe_update_tab_meta(socket, name) do
title = name || dgettext("ui", "Untitled Import")
Notify.tab_meta(:import, socket.assigns.definition_id, title,
Notify.tab_meta(
:import,
socket.assigns.definition_id,
title,
dgettext(
"ui",
"Select a WordPress export file (WXR) and an uploads folder to analyze what would be imported."

View File

@@ -126,8 +126,12 @@ defmodule BDS.Desktop.ShellLive.MediaEditor do
Notify.dirty(:media, media.id, false)
Notify.tab_meta(:media, media.id, display_title(updated_media),
updated_media.original_name || updated_media.mime_type || "")
Notify.tab_meta(
:media,
media.id,
display_title(updated_media),
updated_media.original_name || updated_media.mime_type || ""
)
{:noreply, socket}
@@ -484,8 +488,12 @@ defmodule BDS.Desktop.ShellLive.MediaEditor do
Notify.dirty(:media, media.id, false)
Notify.tab_meta(:media, media.id, display_title(updated_media),
updated_media.original_name || updated_media.mime_type || "")
Notify.tab_meta(
:media,
media.id,
display_title(updated_media),
updated_media.original_name || updated_media.mime_type || ""
)
notify_output(socket, dgettext("ui", "Media"), dgettext("ui", "Media saved"))
socket

View File

@@ -471,8 +471,12 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
|> assign(:dirty?, false)
|> build_data()
Notify.tab_meta(:post, post.id, record_title(record, refreshed_post),
Atom.to_string(record_status(record)))
Notify.tab_meta(
:post,
post.id,
record_title(record, refreshed_post),
Atom.to_string(record_status(record))
)
Notify.dirty(:post, post.id, false)
Notify.cancel_auto_save(:post, post.id)
@@ -511,8 +515,12 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
|> assign(:dirty?, false)
|> build_data()
Notify.tab_meta(:post, post.id, record_title(record, refreshed_post),
Atom.to_string(record_status(record)))
Notify.tab_meta(
:post,
post.id,
record_title(record, refreshed_post),
Atom.to_string(record_status(record))
)
Notify.dirty(:post, post.id, false)
notify_output(socket, dgettext("ui", "Post"), dgettext("ui", "Post published"))
@@ -546,9 +554,12 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
|> assign(:dirty?, false)
|> build_data()
Notify.tab_meta(:post, post.id,
Notify.tab_meta(
:post,
post.id,
restored_post.title || restored_post.slug || restored_post.id,
Atom.to_string(restored_post.status || :draft))
Atom.to_string(restored_post.status || :draft)
)
Notify.dirty(:post, post.id, false)
socket

View File

@@ -271,10 +271,10 @@ defmodule BDS.Desktop.ShellLive.TagsEditor do
end
end
attr :color, :string, default: nil
attr :presets, :list, required: true
attr :pick_event, :string, required: true
attr :target, :any, required: true
attr(:color, :string, default: nil)
attr(:presets, :list, required: true)
attr(:pick_event, :string, required: true)
attr(:target, :any, required: true)
defp colour_picker(assigns) do
~H"""