Skip to content

Commit fd78737

Browse files
feat(flashforge): F5 — manual filament edit bottom-sheet
Clone the Snapmaker filament-edit UX with the ffe* / ffgFilEdit* prefix so both flows coexist. The Snapmaker code path is left untouched. HTML (inventory.html): • #ffgFilEditBackdrop / #ffgFilEditSheet — summary screen with Filaments + Color rows and the Apply button • #ffgFilamentSheet — vendor + material picker (stacks on top) • #ffgColorSheet — 24-preset palette + custom slot (stacks on top) All three reuse the existing .sfe-* CSS classes — no new styles. JS: • openFlashforgeFilamentEdit / closeFlashforgeFilamentEdit • Stacked filament + colour sub-sheets (ffeOpen/Close*Sheet) • ffgFilRenderVendorList / ffgFilRenderMaterialList — curated catalogue with Generic / FlashForge / Bambu Lab / eSun / Polymaker / Sunlu vendors. Sort priority: PLA / PETG / ABS / TPU. • ffeRenderColorGrid — same 24-preset palette as Snapmaker (FFG_FIL_COLOR_PRESETS aliased to SNAP_FIL_COLOR_PRESETS) + custom-color slot with the inline OS picker overlay trick. • Click delegation on the panel body picks up data-ffg-fil-edit independently of Snapmaker's data-snap-fil-edit, so a click on a FlashForge slot opens the right sheet. Apply (POST /control): • matlStation: { cmd: "msConfig_cmd", args: { slot, mt, rgb } } • independent: { cmd: "ipdMsConfig_cmd", args: { mt, rgb } } Auth body is the standard { serialNumber, checkCode } pair. After success we patch conn.data optimistically so the colour square updates immediately — the next /detail poll (≤ 2 s) will echo the printer's authoritative state. closePrinterDetail closes the FlashForge sheet too so it doesn't stay floating after the side-card slides out (mirror of the existing Snapmaker handling). i18n: ffgFilEditTitle, ffgFilEditApply, ffgErrNetwork added in 9 locales. Sub-screen titles reuse snapFilSelectFilament / snapFilSelectColor (already exist).
1 parent 6fbde1b commit fd78737

11 files changed

Lines changed: 490 additions & 9 deletions

File tree

‎renderer/inventory.html‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,88 @@
454454
</div>
455455
</aside>
456456

457+
<!-- ════════════════════════════════════════════════════════════════════
458+
FlashForge filament-edit bottom-sheet (mirrors Snapmaker's layout —
459+
same .sfe-* CSS classes, distinct ffe* IDs so both flows can
460+
coexist without clobbering each other).
461+
──────────────────────────────────────────────────────────────────── -->
462+
<div class="sfe-backdrop" id="ffgFilEditBackdrop"></div>
463+
<aside class="sfe-sheet" id="ffgFilEditSheet" aria-hidden="true">
464+
<div class="sfe-grip" aria-hidden="true"></div>
465+
466+
<!-- Screen 1: SUMMARY -->
467+
<section class="sfe-screen sfe-screen--summary" id="ffgScreenSummary">
468+
<header class="sfe-screen-head sfe-screen-head--right">
469+
<div class="sfe-screen-head-text">
470+
<div class="sfe-title" id="ffgFilEditTitle" data-i18n="ffgFilEditTitle">Change filament</div>
471+
<div class="sfe-sub" id="ffgFilEditSub"></div>
472+
</div>
473+
<button class="modal-close" id="ffgFilEditClose">✕</button>
474+
</header>
475+
476+
<div class="sfe-body">
477+
<button type="button" class="sfe-line" id="ffgOpenFilament">
478+
<span class="sfe-line-lbl" data-i18n="snapFilEditPickFilament">Filaments</span>
479+
<span class="sfe-line-val" id="ffgFilSummaryVal">—</span>
480+
<span class="sfe-line-chev icon icon-chevron-r icon-13"></span>
481+
</button>
482+
483+
<button type="button" class="sfe-line" id="ffgOpenColor">
484+
<span class="sfe-line-lbl" data-i18n="snapFilEditColor">Color</span>
485+
<span class="sfe-line-color-dot" id="ffgColorSummaryDot"></span>
486+
<span class="sfe-line-chev icon icon-chevron-r icon-13"></span>
487+
</button>
488+
489+
<input type="hidden" id="ffgVendor"/>
490+
<input type="hidden" id="ffgMaterial"/>
491+
<input type="hidden" id="ffgColorInput" value="#ff5722"/>
492+
493+
<div class="sfe-error" id="ffgError" hidden></div>
494+
</div>
495+
496+
<div class="sfe-footer">
497+
<button class="adf-btn adf-btn--primary sfe-apply" id="ffgFilEditSave">
498+
<span class="label" data-i18n="ffgFilEditApply">Apply</span>
499+
<span class="spinner"></span>
500+
</button>
501+
</div>
502+
</section>
503+
</aside>
504+
505+
<!-- FlashForge filament-picker sheet (stacks ON TOP of the summary). -->
506+
<aside class="sfe-sheet sfe-sheet--filament" id="ffgFilamentSheet" aria-hidden="true">
507+
<div class="sfe-grip" aria-hidden="true"></div>
508+
<header class="sfe-screen-head">
509+
<button type="button" class="sfe-back" id="ffgFilamentBack" aria-label="Back">
510+
<span class="icon icon-chevron-l icon-14"></span>
511+
</button>
512+
<span class="sfe-title" data-i18n="snapFilSelectFilament">Select Filament</span>
513+
<button class="modal-close" id="ffgFilamentClose">✕</button>
514+
</header>
515+
<div class="sfe-body sfe-body--picker">
516+
<div class="sfe-fil-picker">
517+
<div class="sfe-fil-vendors" id="ffgVendorList" role="listbox" aria-label="Vendors"></div>
518+
<div class="sfe-fil-divider" aria-hidden="true"></div>
519+
<div class="sfe-fil-materials" id="ffgMaterialList" role="listbox" aria-label="Materials"></div>
520+
</div>
521+
</div>
522+
</aside>
523+
524+
<!-- FlashForge colour-picker sheet (stacks ON TOP of the summary). -->
525+
<aside class="sfe-sheet sfe-sheet--color" id="ffgColorSheet" aria-hidden="true">
526+
<div class="sfe-grip" aria-hidden="true"></div>
527+
<header class="sfe-screen-head">
528+
<button type="button" class="sfe-back" id="ffgColorBack" aria-label="Back">
529+
<span class="icon icon-chevron-l icon-14"></span>
530+
</button>
531+
<span class="sfe-title" data-i18n="snapFilSelectColor">Select Color</span>
532+
<button class="modal-close" id="ffgColorClose">✕</button>
533+
</header>
534+
<div class="sfe-body sfe-body--picker">
535+
<div class="sfe-color-grid" id="ffgColorGrid"></div>
536+
</div>
537+
</aside>
538+
457539
<!-- Add printer — step 1: brand picker -->
458540
<div class="modal-overlay" id="printerBrandPickerOverlay">
459541
<div class="modal-card pba-card">

0 commit comments

Comments
 (0)