replace admin rail with unified bottom sheet editor
All checks were successful
deploy / deploy (push) Successful in 1m30s
All checks were successful
deploy / deploy (push) Successful in 1m30s
- add editor sheet component anchored bottom (mobile) / right (desktop) - admin cog moves to header, always visible for admins - remove Done button from editor header, keep only Save - add editor_at_defaults tracking to disable Reset when at defaults - sheet collapses on click outside or Escape, stays in edit mode - dirty indicator + beforeunload warning for unsaved changes - keyboard shortcuts: Ctrl+Z undo, Ctrl+Shift+Z redo - WCAG compliant: aria-expanded, live region, focus management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,20 @@ defmodule Berrypod.Pages.Defaults do
|
||||
|> Enum.map(&for_slug/1)
|
||||
end
|
||||
|
||||
@doc "Returns true if the given blocks match the defaults for the slug."
|
||||
def matches_defaults?(slug, current_blocks) when is_list(current_blocks) do
|
||||
default_blocks = blocks(slug)
|
||||
|
||||
length(current_blocks) == length(default_blocks) and
|
||||
Enum.zip(current_blocks, default_blocks)
|
||||
|> Enum.all?(fn {current, default} ->
|
||||
current["type"] == default["type"] and
|
||||
current["settings"] == default["settings"]
|
||||
end)
|
||||
end
|
||||
|
||||
def matches_defaults?(_slug, _blocks), do: false
|
||||
|
||||
# ── Page titles ─────────────────────────────────────────────────
|
||||
|
||||
defp title("home"), do: "Home page"
|
||||
|
||||
Reference in New Issue
Block a user