mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
Allow spool assignment to empty AMS slots and fix profile label (#717)
Previously the "Assign Spool" button only appeared on configured slots, forcing users to manually configure first — redundant since assignment auto-configures the slot. Now shows on empty slots too. Also fixed the AMS hover card showing generic material type instead of the spool's slicer preset name after assignment.
This commit is contained in:
@@ -467,12 +467,13 @@ interface EmptySlotHoverCardProps {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
configureSlot?: ConfigureSlotConfig;
|
||||
inventory?: InventoryConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for empty slots - shows "Empty" on hover with optional configure button
|
||||
*/
|
||||
export function EmptySlotHoverCard({ children, className = '', configureSlot }: EmptySlotHoverCardProps) {
|
||||
export function EmptySlotHoverCard({ children, className = '', configureSlot, inventory }: EmptySlotHoverCardProps) {
|
||||
const { t } = useTranslation();
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
@@ -529,6 +530,21 @@ export function EmptySlotHoverCard({ children, className = '', configureSlot }:
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{/* Assign spool button - allows assigning inventory spool to empty slot */}
|
||||
{inventory?.onAssignSpool && (
|
||||
<div className="px-2 pb-2">
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
inventory.onAssignSpool?.();
|
||||
}}
|
||||
className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/30 text-bambu-blue"
|
||||
>
|
||||
<Package className="w-3.5 h-3.5" />
|
||||
{t('inventory.assignSpool')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="
|
||||
absolute left-1/2 -translate-x-1/2 top-full w-0 h-0
|
||||
|
||||
Reference in New Issue
Block a user