mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-11 03:09:57 +00:00
* v3 library: song Details drawer + bulk edit — P2 Evolves the per-song editing surface from the legacy modal into a v3 slide-in Details drawer (the filter-drawer idiom, body-appended): catalog fields (title/artist/album/year, written through the existing atomic manifest writer) plus the P1 personal layer - your difficulty (1-5), tags, and notes - with the heart staying the existing favorite system. - Cards badge the personal layer at rest (difficulty pip + tag count, top-right, fading on hover so the action buttons keep that corner); un-annotated cards render byte-identical to before. - Bulk edit from the select-mode batch bar: POST /api/songs/user-meta/batch applies additive tag add/remove and a leave/set/clear difficulty across the selection (mixed-state aware). - The core card action relabels to "Details" and opens the drawer via a feature-detected global, falling back to the legacy modal when the drawer isn't mounted. 16 batch tests new; the P1 user-meta suite stays green. tailwind.min.css rebuilt for the drawer's utility classes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nm7tHs1Yvjjtnnu4nzJgdN * fix(v3): surface bulk-edit / save-details request failures instead of reporting success (PR #703 review) Check the batch/write responses and show an fbNotify error (keeping selection and drawer) instead of unconditionally closing as success. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: byrongamatos <xasiklas@gmail.com>
60 lines
2.4 KiB
JavaScript
60 lines
2.4 KiB
JavaScript
/*
|
|
* fee[dB]ack v0.3.0 — core library-card actions.
|
|
*
|
|
* Registers the built-in Edit-metadata and Retune-to-E-Standard actions
|
|
* through the ui.library-card-injection capability, so core and plugin card
|
|
* actions flow through one pipeline (the Songs grid renders whatever is
|
|
* registered). These call the legacy globals (openEditModal / retuneSong)
|
|
* exposed by app.js in the v3 shell — detection/playback stay on documented
|
|
* globals (design/05). Re-running is a no-op: libraryCardActions.register()
|
|
* rejects duplicate ids, so the first registration stands.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
const sm = window.feedBack;
|
|
if (!sm || !sm.libraryCardActions) return;
|
|
|
|
const STD_RETUNABLE = ['Eb Standard', 'D Standard', 'C# Standard', 'C Standard'];
|
|
const reg = sm.libraryCardActions;
|
|
const hooks = window.__feedBackV3CoreCardActions || (window.__feedBackV3CoreCardActions = {});
|
|
if (hooks.installed) return;
|
|
hooks.installed = true;
|
|
|
|
reg.register({
|
|
id: 'core.edit-metadata',
|
|
pluginId: 'core',
|
|
label: 'Details',
|
|
placement: 'menu',
|
|
order: 10,
|
|
applies: (song) => !!(song && song.filename),
|
|
run: (song) => {
|
|
// Prefer the v3 Details drawer (identity + personal difficulty / tags
|
|
// / notes); fall back to the legacy edit-metadata modal where the v3
|
|
// songs screen hasn't defined the opener (e.g. an older shell).
|
|
if (typeof window.__fbOpenSongDetails === 'function') {
|
|
window.__fbOpenSongDetails(song);
|
|
return;
|
|
}
|
|
if (typeof window.openEditModal !== 'function') return;
|
|
window.openEditModal({
|
|
f: song.filename, t: song.title || '', a: song.artist || '',
|
|
al: song.album || '', y: song.year || '',
|
|
}, null);
|
|
},
|
|
});
|
|
|
|
reg.register({
|
|
id: 'core.retune-estd',
|
|
pluginId: 'core',
|
|
label: 'Convert to E Standard',
|
|
placement: 'menu',
|
|
order: 20,
|
|
applies: (song) => !!(song && song.filename && song.format !== 'sloppak'
|
|
&& song.tuning && !song.has_estd && STD_RETUNABLE.includes(song.tuning)),
|
|
run: (song) => {
|
|
if (typeof window.retuneSong !== 'function') return;
|
|
window.retuneSong(song.filename, song.title || song.filename, song.tuning, 'E Standard');
|
|
},
|
|
});
|
|
})();
|