add nav editors to Site tab with live preview
All checks were successful
deploy / deploy (push) Successful in 3m27s

- Add header and footer nav editors to Site tab with drag-to-reorder,
  add/remove items, and destination picker (pages, collections, external)
- Live preview updates as you edit nav items
- Remove legacy /admin/navigation page and controller (was saving to
  Settings table, now uses nav_items table)
- Update error_html.ex and pages/editor.ex to load nav from nav_items table
- Update link_scanner to read from nav_items table, edit path now /?edit=site
- Add Site.default_header_nav/0 and default_footer_nav/0 for previews/errors
- Remove fallback logic from theme_hook.ex (database is now source of truth)
- Seed default nav items and social links during setup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-28 22:19:48 +00:00
parent 5a5103bc42
commit 7c07805df8
24 changed files with 1068 additions and 1130 deletions

View File

@@ -126,15 +126,8 @@ defmodule BerrypodWeb.PageRenderer do
settings_form={Map.get(assigns, :settings_form)}
settings_dirty={Map.get(assigns, :settings_dirty, false)}
settings_save_status={Map.get(assigns, :settings_save_status, :idle)}
site_header_nav={Map.get(assigns, :site_header_nav, [])}
site_footer_nav={Map.get(assigns, :site_footer_nav, [])}
site_social_links={Map.get(assigns, :site_social_links, [])}
site_announcement_text={Map.get(assigns, :site_announcement_text, "")}
site_announcement_link={Map.get(assigns, :site_announcement_link, "")}
site_announcement_style={Map.get(assigns, :site_announcement_style, "info")}
site_footer_about={Map.get(assigns, :site_footer_about, "")}
site_footer_copyright={Map.get(assigns, :site_footer_copyright, "")}
site_footer_show_newsletter={Map.get(assigns, :site_footer_show_newsletter, true)}
site_state={Map.get(assigns, :site_state)}
site_nav_pages={Map.get(assigns, :site_nav_pages, [])}
/>
</.editor_sheet>
"""
@@ -172,15 +165,8 @@ defmodule BerrypodWeb.PageRenderer do
attr :settings_form, :map, default: nil
attr :settings_dirty, :boolean, default: false
attr :settings_save_status, :atom, default: :idle
attr :site_header_nav, :list, default: []
attr :site_footer_nav, :list, default: []
attr :site_social_links, :list, default: []
attr :site_announcement_text, :string, default: ""
attr :site_announcement_link, :string, default: ""
attr :site_announcement_style, :string, default: "info"
attr :site_footer_about, :string, default: ""
attr :site_footer_copyright, :string, default: ""
attr :site_footer_show_newsletter, :boolean, default: true
attr :site_state, :any, default: nil
attr :site_nav_pages, :list, default: []
defp editor_panel_content(%{editor_active_tab: :page} = assigns) do
~H"""
@@ -238,15 +224,8 @@ defmodule BerrypodWeb.PageRenderer do
defp editor_panel_content(%{editor_active_tab: :site} = assigns) do
~H"""
<BerrypodWeb.ShopComponents.SiteEditor.site_editor
site_header_nav={@site_header_nav}
site_footer_nav={@site_footer_nav}
site_social_links={@site_social_links}
site_announcement_text={@site_announcement_text}
site_announcement_link={@site_announcement_link}
site_announcement_style={@site_announcement_style}
site_footer_about={@site_footer_about}
site_footer_copyright={@site_footer_copyright}
site_footer_show_newsletter={@site_footer_show_newsletter}
site_state={@site_state}
site_nav_pages={@site_nav_pages}
/>
"""
end