feat: v0.2.0 — UI rebuilt to WordPress admin standards
v0.1.0 worked but felt like a third-party React widget bolted on
top of WordPress. v0.2.0 makes the player visually native to the
WP admin: postbox container, standard Play/Pause button with text
label, admin-colour-scheme aware accents, dashboard widget no
longer renders a card inside a card.
CHANGES
- inc/admin-page.php: main page now wraps the player in a
.postbox > .postbox-header (with h2.hndle) > .inside structure.
Custom rounded card / shadow stripped.
- inc/dashboard-widget.php: bare .radio-player content; WP already
wraps dashboard widgets in a postbox, was double-card before.
- inc/about.php: version-history card promotes v0.2.0 to latest,
demotes v0.1.0.
- assets/css/radio.css: rewrite. Strip custom shadows + oversized
typography. Adopt WP body-text defaults. Use
var(--wp-admin-theme-color, #2271b1) for volume-slider accent +
link colours so the plugin picks up whichever admin colour
scheme the user has chosen. About-page cards now use the
postbox-style gray header + 1px border pattern.
- assets/js/radio.js: setPlayIcon() also flips the visible text
label ("Play" ↔ "Pause"), not just the icon class. mirrorSelection()
also updates the [data-radio-genre] element so the genre label
stays in sync across surfaces.
- radio.php: Version: 0.1.0 -> 0.2.0; BUDDY_VERSION constant
bumped likewise.
- CHANGELOG.md: new [0.2.0] entry explaining the visual overhaul.
NET EFFECT
- Same 44 stations, same audio path, same persistence, same
updater, same AJAX endpoint. Pure visual change.
- The plugin now looks like part of WordPress admin instead of a
guest widget.
- Closer to WP.org submission criteria — plugin reviewers look
for native-styled plugins.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-3
@@ -42,11 +42,16 @@
|
||||
}).catch(function () { /* swallow — local UI already updated */ });
|
||||
}
|
||||
|
||||
/** Update play/pause button icon to reflect current audio state. */
|
||||
/** Update play/pause button icon + label to reflect current audio state. */
|
||||
function setPlayIcon(btn, playing) {
|
||||
var icon = btn.querySelector('.dashicons');
|
||||
if (!icon) { return; }
|
||||
icon.className = 'dashicons ' + (playing ? 'dashicons-controls-pause' : 'dashicons-controls-play');
|
||||
var label = btn.querySelector('[data-radio-play-label]');
|
||||
if (icon) {
|
||||
icon.className = 'dashicons ' + (playing ? 'dashicons-controls-pause' : 'dashicons-controls-play');
|
||||
}
|
||||
if (label) {
|
||||
label.textContent = playing ? (cfg.strings.pause || 'Pause') : (cfg.strings.play || 'Play');
|
||||
}
|
||||
btn.setAttribute('title', playing ? (cfg.strings.pause || 'Pause') : (cfg.strings.play || 'Play'));
|
||||
}
|
||||
|
||||
@@ -122,6 +127,8 @@
|
||||
audio.load();
|
||||
if (nameEl) { nameEl.textContent = s.name; }
|
||||
if (descEl) { descEl.textContent = s.description || ''; }
|
||||
var genreEl = player.querySelector('[data-radio-genre]');
|
||||
if (genreEl) { genreEl.textContent = s.genre || ''; }
|
||||
// Mirror selection to any OTHER .radio-player surfaces on the page.
|
||||
mirrorSelection(player, newId);
|
||||
saveState({ station_id: newId });
|
||||
@@ -157,8 +164,10 @@
|
||||
if (s) {
|
||||
var nm = other.querySelector('[data-radio-name]');
|
||||
var dc = other.querySelector('[data-radio-desc]');
|
||||
var gn = other.querySelector('[data-radio-genre]');
|
||||
if (nm) { nm.textContent = s.name; }
|
||||
if (dc) { dc.textContent = s.description || ''; }
|
||||
if (gn) { gn.textContent = s.genre || ''; }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user