mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-19 07:33:18 +02:00
When a spool ran out mid-print and the printer carried on from the backup spool, the queue card still named the original slot and marked it Empty. The printer status now carries the print's tray change log, and the card shows the tray that took over: one outside the job's mapping, right after the mapped tray it replaced, followed through a backup that ran out in turn. Queued jobs still warn about an empty slot.
1 line
5.1 KiB
JavaScript
1 line
5.1 KiB
JavaScript
import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n}from"./client-DnySrlFv.js";import{t as r}from"./createLucideIcon-DvBYJlWL.js";import{t as i}from"./search-0n0CBc74.js";import{Mn as a}from"./index-Cxa-KVmA.js";var o=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),s=e(n(),1),c=t();function l({items:e,searchPlaceholder:t,onClose:n,className:r,onMouseEnter:a,onMouseLeave:o}){let[l,u]=(0,s.useState)(``),d=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(t){let e=window.setTimeout(()=>d.current?.focus(),0);return()=>window.clearTimeout(e)}},[t]);let f=l.trim().toLowerCase(),p=t&&f?e.filter(e=>e.label.toLowerCase().includes(f)):e;return(0,c.jsxs)(`div`,{className:r,onMouseEnter:a,onMouseLeave:o,children:[t&&(0,c.jsx)(`div`,{className:`sticky top-0 z-[1] px-2 py-1.5 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary`,children:(0,c.jsxs)(`div`,{className:`relative`,children:[(0,c.jsx)(i,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray pointer-events-none`}),(0,c.jsx)(`input`,{ref:d,type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){let e=p.find(e=>!e.disabled);e&&(e.onClick(),n())}},placeholder:t,className:`w-full pl-7 pr-2 py-1 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})}),p.map((e,t)=>(0,c.jsxs)(`button`,{onClick:()=>{e.disabled||(e.onClick(),n())},disabled:e.disabled,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e.disabled?`text-bambu-gray cursor-not-allowed`:e.danger?`text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-400/10`:`text-white hover:bg-bambu-dark-tertiary`}`,children:[e.icon&&(0,c.jsx)(`span`,{className:`w-4 h-4 flex-shrink-0 flex items-center justify-center`,children:e.icon}),(0,c.jsx)(`span`,{className:`flex-1 truncate`,children:e.label})]},t)),t&&p.length===0&&(0,c.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray text-center italic`,children:`—`})]})}function u({x:e,y:t,items:n,onClose:r,anchorRef:i}){let o=(0,s.useRef)(null),[u,d]=(0,s.useState)(null),f=(0,s.useRef)(null),[p,m]=(0,s.useState)({x:e,y:t,visible:!1}),[h,g]=(0,s.useState)(!1),[_,v]=(0,s.useState)({});(0,s.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||i?.current?.contains(t)||r()},t=e=>{e.key===`Escape`&&r()},n=e=>{o.current&&o.current.contains(e.target)||r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),f.current&&clearTimeout(f.current)}},[r,i]),(0,s.useLayoutEffect)(()=>{if(o.current){o.current.style.visibility=`hidden`,o.current.style.display=`block`;let n=o.current.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e,s=t;e+n.width>r-8&&(a=Math.max(8,r-n.width-8)),a<8&&(a=8),t+n.height>i-8&&(s=Math.max(8,i-n.height-8)),s<8&&(s=8),g(r-a-n.width<180&&a>180),m({x:a,y:s,visible:!0})}},[e,t]);let y=(e,t)=>{f.current&&=(clearTimeout(f.current),null);let n=t.getBoundingClientRect(),r=window.innerHeight-n.top-8<300&&n.top>300;v(t=>({...t,[e]:r?`bottom`:`top`})),d(e)},b=()=>{f.current=window.setTimeout(()=>{d(null)},150)};return(0,c.jsx)(`div`,{ref:o,className:`fixed z-50 min-w-[180px] max-w-[280px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1`,style:{left:p.x,top:p.y,visibility:p.visible?`visible`:`hidden`},children:n.map((e,t)=>{if(e.divider)return(0,c.jsx)(`div`,{className:`my-1 border-t border-bambu-dark-tertiary`},t);let n=e.submenu&&e.submenu.length>0;return(0,c.jsxs)(`div`,{className:`relative`,onMouseEnter:e=>n&&y(t,e.currentTarget),onMouseLeave:()=>n&&b(),children:[(0,c.jsxs)(`button`,{onMouseEnter:e=>n&&y(t,e.currentTarget.parentElement),onClick:()=>{n?d(u===t?null:t):e.disabled||(e.onClick(),r())},disabled:e.disabled,title:e.title,className:`group w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e.disabled?`text-bambu-gray cursor-not-allowed`:e.danger?`text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-400/10`:`text-white hover:bg-bambu-dark-tertiary`} ${n&&u===t?`bg-bambu-dark-tertiary`:``}`,children:[e.icon&&(0,c.jsx)(`span`,{className:`w-4 h-4 flex-shrink-0 flex items-center justify-center`,children:e.icon}),(0,c.jsx)(`span`,{className:`flex-1`,children:e.label}),n&&(0,c.jsx)(a,{className:`w-4 h-4 text-bambu-gray`})]}),n&&u===t&&(0,c.jsx)(l,{items:e.submenu,searchPlaceholder:e.submenuSearchPlaceholder,onClose:r,className:`absolute min-w-[200px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 overflow-hidden max-h-[300px] overflow-y-auto z-[60] ${h?`right-full mr-1`:`left-full ml-1`} ${_[t]===`bottom`?`bottom-0`:`top-0`}`,onMouseEnter:()=>{f.current&&=(clearTimeout(f.current),null)},onMouseLeave:()=>b()})]},t)})})}export{o as n,u as t}; |