add Site context with social links editor and site-wide settings
Some checks failed
deploy / deploy (push) Has been cancelled

- Add Site context for managing site-wide content (social links, nav items,
  announcement bar, footer content)
- Add SocialLink schema with URL normalization and platform auto-detection
  supporting 40+ platforms via host and 25+ via URI scheme
- Add NavItem schema for header/footer navigation (editor UI coming next)
- Add SiteEditor component with collapsible sections for each content type
- Wire social links card block and footer to use database data
- Filter empty URLs from display in shop components
- Add DetailsPreserver hook to preserve collapsible section state
- Add comprehensive tests for Site context and SocialLink functions
- Remove unused helper functions from onboarding to fix compiler warnings
- Move sync_edit_url_param helper to group handle_editor_event clauses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-28 10:09:33 +00:00
parent 0b86cd66ce
commit 638bb4fb70
24 changed files with 3121 additions and 195 deletions

View File

@@ -3093,6 +3093,58 @@
border-bottom-color: var(--t-accent, oklch(0.6 0.15 250));
}
.editor-tab-dirty-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--t-status-warning, oklch(0.75 0.18 85));
margin-left: 4px;
vertical-align: middle;
}
/* ── Navigation warning modal ── */
.editor-nav-modal {
position: fixed;
inset: 0;
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
background: oklch(0 0 0 / 0.5);
border: none;
padding: 1rem;
}
.editor-nav-modal-content {
background: white;
border-radius: 8px;
padding: 1.5rem;
max-width: 400px;
width: 100%;
box-shadow: 0 4px 24px oklch(0 0 0 / 0.2);
& h3 {
margin: 0 0 0.5rem;
font-size: 1.125rem;
font-weight: 600;
color: oklch(20% 0 0);
}
& p {
margin: 0 0 1.25rem;
color: oklch(40% 0 0);
font-size: 0.875rem;
}
}
.editor-nav-modal-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: flex-end;
}
/* ── Panel content ── */
.editor-panel-content {
flex: 1;
@@ -3158,6 +3210,146 @@
overflow-y: auto;
}
/* ── Site editor ────────────────────────────────────────────────── */
.editor-site-content {
padding: 0.5rem;
}
.site-editor-section {
border: 1px solid var(--t-surface-sunken);
border-radius: 0.5rem;
margin-bottom: 0.5rem;
background: var(--t-surface-base);
}
.site-editor-section-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
font-size: 0.8125rem;
font-weight: 600;
cursor: pointer;
user-select: none;
color: var(--t-text-primary);
}
.site-editor-section-header::-webkit-details-marker {
display: none;
}
.site-editor-section-header .size-4 {
width: 1rem;
height: 1rem;
flex-shrink: 0;
opacity: 0.6;
}
.site-editor-chevron {
margin-left: auto;
transition: transform 0.15s;
}
.site-editor-section[open] .site-editor-chevron {
transform: rotate(180deg);
}
.site-editor-section-content {
padding: 0 1rem 1rem;
}
.site-editor-placeholder {
padding: 0.75rem;
background: var(--t-surface-sunken);
border-radius: 0.375rem;
}
.site-editor-form {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.site-editor-radio-group {
display: flex;
gap: 1rem;
}
.site-editor-nav-list,
.site-editor-social-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.site-editor-nav-items,
.site-editor-social-items {
display: flex;
flex-direction: column;
gap: 0.25rem;
list-style: none;
padding: 0;
margin: 0;
}
.site-editor-nav-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0.75rem;
background: var(--t-surface-sunken);
border-radius: 0.375rem;
font-size: 0.8125rem;
}
.site-editor-nav-label {
font-weight: 500;
}
.site-editor-nav-url {
font-size: 0.75rem;
opacity: 0.6;
}
/* Social links editor item */
.site-editor-social-item {
display: flex;
gap: 0.5rem;
align-items: center;
padding: 0.5rem;
background: var(--t-surface-sunken);
border-radius: 0.375rem;
}
.site-editor-social-item-content {
display: flex;
gap: 0.5rem;
flex: 1;
min-width: 0;
& select {
width: 7rem;
flex-shrink: 0;
}
& input {
flex: 1;
min-width: 0;
}
}
.site-editor-social-item-actions {
display: flex;
gap: 0.125rem;
flex-shrink: 0;
}
.site-editor-add-button {
align-self: flex-start;
margin-top: 0.25rem;
}
/* ═══════════════════════════════════════════════════════════════════
Image field (block editor)
═══════════════════════════════════════════════════════════════════ */