Add bundle animation support to the editor and rendering logic
- Introduced a new 'bundleAnim' attribute in the block editor settings and PHP backend. - Updated the editor UI to include a toggle for 'Player + Display Bundle Animation'. - Modified the rendering logic to display the bundle animation structure when 'bundleAnim' is enabled. - Adjusted the visual class names to accommodate the new animation type.
This commit is contained in:
@@ -606,6 +606,7 @@
|
||||
visual: { type: 'string', default: '' },
|
||||
reversed: { type: 'boolean', default: false },
|
||||
cloudAnim: { type: 'boolean', default: false },
|
||||
bundleAnim: { type: 'boolean', default: false },
|
||||
imgId: { type: 'number', default: 0 },
|
||||
imgUrl: { type: 'string', default: '' },
|
||||
imgAlt: { type: 'string', default: '' },
|
||||
@@ -647,7 +648,8 @@
|
||||
el(TC, { label: 'Label', value: a.label, onChange: function (v) { s({ label: v }); } }),
|
||||
el(TC, { label: 'Visual (emoji or text)', value: a.visual, onChange: function (v) { s({ visual: v }); } }),
|
||||
el(TG, { label: 'Reversed layout', checked: a.reversed, onChange: function (v) { s({ reversed: v }); } }),
|
||||
el(TG, { label: 'Cloud Server Animation', checked: a.cloudAnim, onChange: function (v) { s({ cloudAnim: v }); } })
|
||||
el(TG, { label: 'Cloud Server Animation', checked: a.cloudAnim, onChange: function (v) { s({ cloudAnim: v }); } }),
|
||||
el(TG, { label: 'Player + Display Bundle Animation', checked: !!a.bundleAnim, onChange: function (v) { s({ bundleAnim: v }); } })
|
||||
),
|
||||
el(PB, { title: 'Visual Image', initialOpen: false },
|
||||
el(MUC, null,
|
||||
@@ -681,7 +683,7 @@
|
||||
el(RT, { tagName: 'h2', style: { marginBottom: '1.5rem' }, value: a.heading, onChange: function (v) { s({ heading: v }); }, placeholder: 'Heading...' }),
|
||||
el(RT, { tagName: 'p', className: 'lead', value: a.description, onChange: function (v) { s({ description: v }); }, placeholder: 'Description...' })
|
||||
),
|
||||
el('div', { className: 'about-intro-visual' + (a.cloudAnim ? ' has-cloud-anim' : (a.imgUrl ? ' has-img' : '')), style: a.reversed ? { direction: 'ltr' } : {} }, visualContent)
|
||||
el('div', { className: 'about-intro-visual' + (a.cloudAnim ? ' has-cloud-anim' : (a.bundleAnim ? ' has-pkg-anim' : (a.imgUrl ? ' has-img' : ''))), style: a.reversed ? { direction: 'ltr' } : {} }, visualContent)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -340,6 +340,7 @@ add_action('init', function () {
|
||||
'visual' => ['type' => 'string', 'default' => ''],
|
||||
'reversed' => ['type' => 'boolean', 'default' => false],
|
||||
'cloudAnim' => ['type' => 'boolean', 'default' => false],
|
||||
'bundleAnim' => ['type' => 'boolean', 'default' => false],
|
||||
'imgId' => ['type' => 'number', 'default' => 0],
|
||||
'imgUrl' => ['type' => 'string', 'default' => ''],
|
||||
'imgAlt' => ['type' => 'string', 'default' => ''],
|
||||
@@ -1006,7 +1007,7 @@ function oribi_render_intro_section($a)
|
||||
<h2 style="margin-bottom:1.5rem;"><?php echo wp_kses_post($a['heading']); ?></h2>
|
||||
<p class="lead"><?php echo wp_kses_post($a['description']); ?></p>
|
||||
</div>
|
||||
<div class="about-intro-visual<?php echo !empty($a['cloudAnim']) ? ' has-cloud-anim' : ''; ?>"<?php echo $ltr; ?>>
|
||||
<div class="about-intro-visual<?php if (!empty($a['cloudAnim'])) echo ' has-cloud-anim'; elseif (!empty($a['bundleAnim'])) echo ' has-pkg-anim'; ?>"<?php echo $ltr; ?>>
|
||||
<?php
|
||||
if (!empty($a['cloudAnim'])) {
|
||||
echo '<div class="ds-anim-container">';
|
||||
@@ -1015,6 +1016,30 @@ function oribi_render_intro_section($a)
|
||||
echo '<div class="ds-cloud"><i class="fas fa-cloud" aria-hidden="true"></i></div>';
|
||||
echo '</div>';
|
||||
}
|
||||
elseif (!empty($a['bundleAnim'])) {
|
||||
$pkg = '<div class="pkg-stage" aria-hidden="true">';
|
||||
// Player node
|
||||
$pkg .= '<div class="pkg-node pkg-node--player">';
|
||||
$pkg .= '<div class="pkg-player"><div class="pkg-player__body"><div class="pkg-player__led"></div></div><div class="pkg-player__hdmi"></div></div>';
|
||||
$pkg .= '<span class="pkg-node__label">Player</span>';
|
||||
$pkg .= '</div>';
|
||||
// LTR line (player → box)
|
||||
$pkg .= '<div class="pkg-line pkg-line--ltr"><div class="pkg-pkt pkg-pkt--ltr-1"></div><div class="pkg-pkt pkg-pkt--ltr-2"></div><div class="pkg-pkt pkg-pkt--ltr-3"></div></div>';
|
||||
// Box node
|
||||
$pkg .= '<div class="pkg-node pkg-node--box">';
|
||||
$pkg .= '<div class="pkg-box"><div class="pkg-box__lids"><div class="pkg-box__flap pkg-box__flap--l"></div><div class="pkg-box__flap pkg-box__flap--r"></div></div><div class="pkg-box__body"></div></div>';
|
||||
$pkg .= '<span class="pkg-node__label">Bundle</span>';
|
||||
$pkg .= '</div>';
|
||||
// RTL line (display → box)
|
||||
$pkg .= '<div class="pkg-line pkg-line--rtl"><div class="pkg-pkt pkg-pkt--rtl-1"></div><div class="pkg-pkt pkg-pkt--rtl-2"></div><div class="pkg-pkt pkg-pkt--rtl-3"></div></div>';
|
||||
// TV node
|
||||
$pkg .= '<div class="pkg-node pkg-node--tv">';
|
||||
$pkg .= '<div class="pkg-tv"><div class="pkg-tv__body"><div class="pkg-tv__screen"></div></div><div class="pkg-tv__feet"><div class="pkg-tv__foot"></div><div class="pkg-tv__foot"></div></div></div>';
|
||||
$pkg .= '<span class="pkg-node__label">Display</span>';
|
||||
$pkg .= '</div>';
|
||||
$pkg .= '</div>'; // .pkg-stage
|
||||
echo $pkg;
|
||||
}
|
||||
else {
|
||||
echo wp_kses_post($a['visual']);
|
||||
}
|
||||
@@ -2699,12 +2724,46 @@ function oribi_render_platform_row($a)
|
||||
$en .= '<div class="encl-rain__drop"></div>';
|
||||
}
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-unit">';
|
||||
$en .= '<div class="encl-unit__body">';
|
||||
$en .= '<div class="encl-unit__screen"><div class="encl-screen__content">Your Content Here</div></div>';
|
||||
$en .= '<div class="encl-housing">';
|
||||
$en .= '<div class="encl-housing__header">';
|
||||
$en .= '<div class="encl-housing__vents">';
|
||||
for ($i = 0; $i < 5; $i++) { $en .= '<div class="encl-vent"></div>'; }
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-unit__badge">IP65</div>';
|
||||
$en .= '<div class="encl-unit__temp"><span class="encl-temp__icon">🌡</span> <span class="encl-temp__range">-20°C to 50°C</span></div>';
|
||||
$en .= '<div class="encl-housing__badge">IP65</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-housing__screen">';
|
||||
$en .= '<div class="encl-slides">';
|
||||
$en .= '<div class="encl-slide encl-slide--weather">';
|
||||
$en .= '<div class="encl-weather">';
|
||||
$en .= '<div class="encl-weather__top">';
|
||||
$en .= '<div class="encl-weather__venue">Riverside Market</div>';
|
||||
$en .= '<div class="encl-weather__temp"><span class="encl-weather__deg">18°</span><span class="encl-weather__cond">Cloudy</span></div>';
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-weather__items">';
|
||||
$en .= '<div class="encl-weather__row">🕐 Open 8am – 3pm today</div>';
|
||||
$en .= '<div class="encl-weather__row">📍 Victoria Embankment</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-slide encl-slide--promo">';
|
||||
$en .= '<div class="encl-promo">';
|
||||
$en .= '<div class="encl-promo__eyebrow">Today Only</div>';
|
||||
$en .= '<div class="encl-promo__headline">Fresh Catch &<br>Artisan Bread</div>';
|
||||
$en .= '<div class="encl-promo__cta">Stall B3 →</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-housing__footer">';
|
||||
$en .= '<div class="encl-housing__vents">';
|
||||
for ($i = 0; $i < 5; $i++) { $en .= '<div class="encl-vent"></div>'; }
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$en .= '<div class="encl-status">';
|
||||
$en .= '<span class="encl-status__pill encl-status__pill--green">IP65</span>';
|
||||
$en .= '<span class="encl-status__pill encl-status__pill--blue">-20°C to +50°C</span>';
|
||||
$en .= '<span class="encl-status__pill encl-status__pill--amber">Fan Active</span>';
|
||||
$en .= '</div>';
|
||||
$en .= '</div>';
|
||||
$visual_html = $en;
|
||||
@@ -2713,29 +2772,69 @@ function oribi_render_platform_row($a)
|
||||
elseif (!empty($a['brightnessAnim'])) {
|
||||
/* ── High-Brightness Comparison ── */
|
||||
$br = '<div class="bright-stage" aria-hidden="true">';
|
||||
$br .= '<div class="bright-sun"></div>';
|
||||
$br .= '<div class="bright-sun">';
|
||||
$br .= '<div class="bright-sun__core"></div>';
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
$br .= '<div class="bright-sun__ray bright-sun__ray--' . $i . '"></div>';
|
||||
}
|
||||
$br .= '</div>';
|
||||
$br .= '<div class="bright-compare">';
|
||||
$br .= '<div class="bright-panel bright-panel--indoor"><div class="bright-panel__screen bright-panel__screen--dim"><span class="bright-panel__text">Hello World</span></div><div class="bright-panel__label">Indoor 350 nits</div></div>';
|
||||
$br .= '<div class="bright-panel bright-panel--indoor">';
|
||||
$br .= '<div class="bright-panel__screen bright-panel__screen--dim">';
|
||||
$br .= '<div class="bright-panel__content">';
|
||||
$br .= '<div class="bright-panel__eyebrow">Today\'s Special</div>';
|
||||
$br .= '<div class="bright-panel__title">Fish & Chips<br>£8.99</div>';
|
||||
$br .= '<div class="bright-panel__sub">Available until 3pm</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '<div class="bright-panel__glare"></div>';
|
||||
$br .= '</div>';
|
||||
$br .= '<div class="bright-panel__spec">';
|
||||
$br .= '<div class="bright-panel__nits">350 nits</div>';
|
||||
$br .= '<div class="bright-panel__label">Indoor Display</div>';
|
||||
$br .= '<div class="bright-panel__bar"><div class="bright-panel__bar-fill bright-panel__bar-fill--low"></div></div>';
|
||||
$br .= '</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '<div class="bright-vs">vs</div>';
|
||||
$br .= '<div class="bright-panel bright-panel--outdoor"><div class="bright-panel__screen bright-panel__screen--vivid"><span class="bright-panel__text">Hello World</span></div><div class="bright-panel__label">Outdoor 2,500+ nits</div></div>';
|
||||
$br .= '<div class="bright-panel bright-panel--outdoor">';
|
||||
$br .= '<div class="bright-panel__screen bright-panel__screen--vivid">';
|
||||
$br .= '<div class="bright-panel__content">';
|
||||
$br .= '<div class="bright-panel__eyebrow">Today\'s Special</div>';
|
||||
$br .= '<div class="bright-panel__title">Fish & Chips<br>£8.99</div>';
|
||||
$br .= '<div class="bright-panel__sub">Available until 3pm</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '<div class="bright-panel__spec">';
|
||||
$br .= '<div class="bright-panel__nits">2,500+ nits</div>';
|
||||
$br .= '<div class="bright-panel__label">Outdoor Display</div>';
|
||||
$br .= '<div class="bright-panel__bar"><div class="bright-panel__bar-fill bright-panel__bar-fill--high"></div></div>';
|
||||
$br .= '</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '</div>';
|
||||
$br .= '</div>';
|
||||
$visual_html = $br;
|
||||
$visual_cls = 'platform-visual has-brightness';
|
||||
}
|
||||
elseif (!empty($a['cellularAnim'])) {
|
||||
/* ── Cellular Connectivity Tower ── */
|
||||
/* ── Cellular Connectivity — Device Status Card ── */
|
||||
$cl = '<div class="cell-stage" aria-hidden="true">';
|
||||
$cl .= '<div class="cell-tower">';
|
||||
$cl .= '<div class="cell-tower__mast"></div>';
|
||||
$cl .= '<div class="cell-tower__base"></div>';
|
||||
$cl .= '<div class="cell-wave cell-wave--1"></div>';
|
||||
$cl .= '<div class="cell-wave cell-wave--2"></div>';
|
||||
$cl .= '<div class="cell-wave cell-wave--3"></div>';
|
||||
$cl .= '<div class="cell-device">';
|
||||
$cl .= '<div class="cell-device__hdr">';
|
||||
$cl .= '<div class="cell-device__title">Screen Manager</div>';
|
||||
$cl .= '<div class="cell-device__badge">4G Connected</div>';
|
||||
$cl .= '</div>';
|
||||
$cl .= '<div class="cell-device__info">';
|
||||
$cl .= '<div class="cell-device__row"><span class="cell-device__key">Device</span><span class="cell-device__val">Outdoor Display #7</span></div>';
|
||||
$cl .= '<div class="cell-device__row"><span class="cell-device__key">Location</span><span class="cell-device__val">Victoria Square</span></div>';
|
||||
$cl .= '<div class="cell-device__row"><span class="cell-device__key">Network</span><span class="cell-device__val"><span class="cell-signal"><span class="cell-signal__bar"></span><span class="cell-signal__bar"></span><span class="cell-signal__bar"></span><span class="cell-signal__bar"></span></span> 4G · Excellent</span></div>';
|
||||
$cl .= '<div class="cell-device__row"><span class="cell-device__key">Last Sync</span><span class="cell-device__val">2 minutes ago</span></div>';
|
||||
$cl .= '</div>';
|
||||
$cl .= '<div class="cell-device__status">';
|
||||
$cl .= '<span class="cell-device__dot"></span>';
|
||||
$cl .= '<span class="cell-device__online">Online</span>';
|
||||
$cl .= '<span class="cell-device__sep">·</span>';
|
||||
$cl .= '<span class="cell-device__content">Content up to date</span>';
|
||||
$cl .= '</div>';
|
||||
$cl .= '</div>';
|
||||
$cl .= '<div class="cell-badge">4G / 5G</div>';
|
||||
$cl .= '<div class="cell-signal"><div class="cell-signal__bar cell-signal__bar--1"></div><div class="cell-signal__bar cell-signal__bar--2"></div><div class="cell-signal__bar cell-signal__bar--3"></div><div class="cell-signal__bar cell-signal__bar--4"></div></div>';
|
||||
$cl .= '<div class="cell-status">Connected ●</div>';
|
||||
$cl .= '</div>';
|
||||
$visual_html = $cl;
|
||||
$visual_cls = 'platform-visual has-cellular';
|
||||
|
||||
Reference in New Issue
Block a user