setStackPanelHover(true)}
+ onMouseLeave={() => setStackPanelHover(false)}
+ style={{
+ height: '100%',
+ width: '100%',
+ background: '#1f2428',
+ color: '#fff',
+ boxShadow: '0 2px 14px rgba(0,0,0,0.45)',
+ borderLeft: '1px solid #2f3336',
+ transform: 'translateX(0)',
+ transition: 'transform 220ms ease',
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden',
+ }}
+ >
+
+
Stacks
+
+
+
+
+
+
+ {availableStacks.length === 0 ? (
+
No stacks available
+ ) : (
+
+ {availableStacks.map((stack, idx) => {
+ const imageIds = Array.isArray(stack.imageIds) ? stack.imageIds : [];
+ const label = stack.name || (stack.caseId ? `Case: ${stack.caseId}` : `Stack ${idx + 1}`);
+ const count = imageIds.length;
+ const invalid = !Array.isArray(imageIds) || count === 0;
+ const isSelected = selectedStackIdx.includes(idx);
+ return (
+
{
+ if (invalid) return;
+ e.dataTransfer.setData('text/stack-idx', String(idx));
+ e.dataTransfer.effectAllowed = 'copy';
+ }}
+ onClick={() => { if (!invalid) handleLoadStack(0, idx); }}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ padding: '8px 10px',
+ background: isSelected ? '#1976d2' : 'transparent',
+ color: isSelected ? '#fff' : '#ddd',
+ borderRadius: 6,
+ cursor: invalid ? 'not-allowed' : 'pointer',
+ }}
+ >
+
+
{label}
+
{count} img{count === 1 ? '' : 's'}
+
+
{stack.studyId || ''}
+
+ );
+ })}
+
+ )}
+
+