replace admin rail with unified bottom sheet editor
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:
jamey
2026-03-07 09:30:07 +00:00
parent dbcecc7878
commit f4f036b84b
12 changed files with 1232 additions and 474 deletions

View File

@@ -631,33 +631,23 @@
/* ── Feedback ── */
.admin-toast {
position: fixed;
top: 1rem;
inset-inline-end: 1rem;
z-index: 100;
.admin-banner {
/* document flow — pushes content down, no overlay */
}
/* Hide connection error banners during intentional navigation */
.navigating-away #flash-group { display: none; }
.admin-alert {
display: flex;
align-items: flex-start;
gap: 0.75rem;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
font-size: 0.875rem;
line-height: 1.5;
width: 20rem;
max-width: 20rem;
overflow-wrap: break-word;
}
@media (min-width: 640px) {
.admin-alert {
width: 24rem;
max-width: 24rem;
}
}
.admin-alert-title {
font-weight: 600;
}
@@ -669,13 +659,13 @@
.admin-alert-info {
background-color: color-mix(in oklch, var(--t-status-info) 12%, var(--t-surface-base));
color: var(--t-status-info);
border: 1px solid color-mix(in oklch, var(--t-status-info) 25%, var(--t-surface-base));
border-bottom: 1px solid color-mix(in oklch, var(--t-status-info) 25%, var(--t-surface-base));
}
.admin-alert-error {
background-color: color-mix(in oklch, var(--t-status-error) 12%, var(--t-surface-base));
color: var(--t-status-error);
border: 1px solid color-mix(in oklch, var(--t-status-error) 25%, var(--t-surface-base));
border-bottom: 1px solid color-mix(in oklch, var(--t-status-error) 25%, var(--t-surface-base));
}
.admin-alert-close {
@@ -686,6 +676,27 @@
&:hover { opacity: 0.7; }
}
.admin-inline-feedback {
display: inline-flex;
align-items: center;
gap: 0.375rem;
font-size: 0.875rem;
line-height: 1.5;
}
.admin-inline-feedback-saving {
color: var(--admin-text-soft);
}
.admin-inline-feedback-saved {
color: var(--t-status-success, oklch(0.55 0.15 145));
}
.admin-inline-feedback-error {
color: var(--t-status-error);
font-weight: 600;
}
.admin-banner-warning {
display: flex;
align-items: center;
@@ -2020,8 +2031,12 @@
.block-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-top: 1.5rem;
gap: 0.375rem;
margin-top: 0;
@media (min-width: 768px) {
gap: 0.5rem;
}
}
.block-list-empty {
@@ -2034,35 +2049,50 @@
}
.block-card {
padding: 0.5rem 0.75rem;
padding: 0.375rem 0.5rem;
border: 1px solid var(--t-border-default);
border-radius: 0.5rem;
border-radius: 0.375rem;
background: var(--t-surface-base);
transition: box-shadow 150ms;
&:focus-within {
box-shadow: 0 0 0 2px color-mix(in oklch, var(--t-text-primary) 20%, transparent);
}
@media (min-width: 768px) {
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
}
}
.block-card-position {
display: flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
width: 1.25rem;
height: 1.25rem;
border-radius: 0.25rem;
font-size: 0.75rem;
font-size: 0.6875rem;
font-weight: 600;
color: var(--admin-text-faint);
flex-shrink: 0;
@media (min-width: 768px) {
width: 1.5rem;
height: 1.5rem;
font-size: 0.75rem;
}
}
.block-card-icon {
display: flex;
display: none;
align-items: center;
color: var(--admin-text-muted);
flex-shrink: 0;
@media (min-width: 768px) {
display: flex;
}
}
.block-card-info {
@@ -2072,20 +2102,28 @@
.block-card-name {
display: block;
font-size: 0.875rem;
font-size: 0.8125rem;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@media (min-width: 768px) {
font-size: 0.875rem;
}
}
.block-card-preview {
display: block;
display: none;
font-size: 0.75rem;
color: var(--admin-text-faint);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@media (min-width: 768px) {
display: block;
}
}
.block-card-controls {
@@ -2233,6 +2271,11 @@
gap: 0.25rem 0.5rem;
flex-wrap: wrap;
width: 100%;
/* Desktop: single row with truncating text */
@media (min-width: 768px) {
flex-wrap: nowrap;
}
}
.block-card-expanded {
@@ -2334,115 +2377,275 @@
border-style: dashed;
}
/* ── Live editor layout (sidebar on shop pages) ── */
/* ══════════════════════════════════════════════════════════════════════════
Editor sheet (unified bottom/right sheet for page editing)
══════════════════════════════════════════════════════════════════════════ */
.page-editor-live {
display: flex;
min-height: 100vh;
}
.page-editor-sidebar {
.editor-sheet {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 360px;
z-index: 1000;
background: var(--t-surface-base);
border-right: 1px solid var(--t-border-default);
overflow-y: auto;
z-index: 40;
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
padding: 1rem;
transition: transform 0.25s ease;
transform: translateX(0);
box-shadow: var(--t-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.15));
transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
display: flex;
flex-direction: column;
}
/* Hidden sidebar — slides off-screen */
[data-sidebar-open="false"] .page-editor-sidebar {
transform: translateX(-100%);
box-shadow: none;
@media (prefers-reduced-motion: reduce) {
.editor-sheet {
transition: none;
}
}
.page-editor-sidebar-header {
/* ── Mobile: bottom-anchored ── */
@media (max-width: 767px) {
.editor-sheet {
bottom: 0;
left: 0;
right: 0;
height: 85dvh;
border-radius: var(--t-radius-lg, 12px) var(--t-radius-lg, 12px) 0 0;
transform: translateY(calc(100% - 48px));
}
.editor-sheet[data-state="open"] {
transform: translateY(0);
}
}
/* ── Desktop: right-anchored ── */
@media (min-width: 768px) {
.editor-sheet {
top: 0;
right: 0;
bottom: 0;
border-radius: var(--t-radius-lg, 12px) 0 0 var(--t-radius-lg, 12px);
width: 420px;
max-width: 90vw;
transform: translateX(calc(100% - 48px));
flex-direction: column;
}
.editor-sheet[data-state="open"] {
transform: translateX(0);
}
}
/* ── Edit button in collapsed state ── */
.editor-sheet-edit-btn {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.375rem 0.75rem;
background: var(--t-accent);
color: #fff;
border: none;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: filter 0.15s;
}
.editor-sheet-edit-btn:hover {
filter: brightness(1.1);
}
.editor-sheet-edit-btn svg {
width: 16px;
height: 16px;
flex-shrink: 0;
}
/* Desktop collapsed: icon-only button with tooltip */
@media (min-width: 768px) {
.editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn {
padding: 0.5rem;
position: relative;
}
.editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn span {
/* Visually hidden but accessible to screen readers */
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* Tooltip on hover - dark tooltip for visibility on any theme */
.editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn::after {
content: "Edit page";
position: absolute;
right: calc(100% + 8px);
top: 50%;
transform: translateY(-50%);
padding: 0.375rem 0.5rem;
background: #1a1a1a;
color: #fff;
font-size: 0.75rem;
font-weight: 500;
border-radius: 4px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.15s;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
z-index: 10;
}
.editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn:hover::after,
.editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn:focus::after {
opacity: 1;
}
}
/* ── Dirty indicator ── */
.editor-sheet-dirty {
display: flex;
align-items: center;
gap: 0.25rem;
color: var(--t-status-warning, oklch(0.75 0.18 85));
font-size: 0.75rem;
font-weight: 500;
}
.editor-sheet-dirty-dot {
width: 8px;
height: 8px;
border-radius: 9999px;
background: currentColor;
}
/* Desktop collapsed: hide "Unsaved" text, show only dot */
@media (min-width: 768px) {
.editor-sheet[data-state="collapsed"] .editor-sheet-dirty span:not(.editor-sheet-dirty-dot) {
/* Visually hidden but accessible to screen readers */
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.editor-sheet[data-state="collapsed"] .editor-sheet-dirty {
position: relative;
}
}
/* ── Sheet header (when expanded) ── */
.editor-sheet-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--t-border-default);
flex-shrink: 0;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.page-editor-sidebar-title {
font-size: 1rem;
font-weight: 600;
flex: 1;
.editor-sheet-header-left {
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.page-editor-sidebar-actions {
.editor-sheet-title {
font-size: 0.875rem;
font-weight: 600;
color: var(--t-text-primary);
}
.editor-sheet-header-actions {
display: flex;
align-items: center;
gap: 0.25rem;
flex-shrink: 0;
}
.page-editor-sidebar-dirty {
margin-bottom: 0.5rem;
/* ── Sheet content ── */
.editor-sheet-content {
flex: 1;
overflow-y: auto;
overscroll-behavior: contain;
padding: 0.75rem;
@media (min-width: 768px) {
padding: 1rem;
}
}
/* Picker inside the editor sidebar — grid scrolls within a capped height */
.page-editor-sidebar .block-picker-overlay {
/* ── Hide content when collapsed ── */
.editor-sheet[data-state="collapsed"] .editor-sheet-content {
display: none;
}
/* Collapsed header doesn't need bottom border */
.editor-sheet[data-state="collapsed"] .editor-sheet-header {
border-bottom: none;
}
/* ── Page header inside sheet ── */
.editor-sheet-page-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
margin-bottom: 0.5rem;
@media (min-width: 768px) {
margin-bottom: 0.75rem;
}
}
.editor-sheet-page-title {
font-size: 0.9375rem;
font-weight: 600;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@media (min-width: 768px) {
font-size: 1rem;
}
}
.editor-sheet-undo-redo {
display: flex;
align-items: center;
gap: 0.25rem;
flex-shrink: 0;
}
/* Picker inside the editor sheet — grid scrolls within a capped height */
.editor-sheet .block-picker-overlay {
position: static;
background: none;
}
.page-editor-sidebar .block-picker {
.editor-sheet .block-picker {
border-radius: 0;
max-height: none;
padding: 0;
}
.page-editor-sidebar .block-picker-grid {
.editor-sheet .block-picker-grid {
max-height: 45dvh;
overflow-y: auto;
}
.page-editor-content {
flex: 1;
margin-left: 360px;
min-width: 0;
transition: margin-left 0.25s ease;
}
/* Content goes full-width when sidebar is hidden */
[data-sidebar-open="false"] .page-editor-content {
margin-left: 0;
}
/* Clickable backdrop to dismiss the sidebar */
.page-editor-backdrop {
position: fixed;
inset: 0;
z-index: 39;
background: rgba(0, 0, 0, 0.15);
cursor: pointer;
}
/* Mobile: sidebar overlays content, no margin push */
@media (max-width: 63.99em) {
.page-editor-sidebar {
width: 85%;
max-width: 360px;
padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px) + 1rem);
}
.page-editor-content {
margin-left: 0;
}
}
/* ═══════════════════════════════════════════════════════════════════
Image field (block editor)
═══════════════════════════════════════════════════════════════════ */