IO-3431 Jobs Image Gallery

Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
Allan Carr
2026-01-02 14:51:13 -08:00
parent 2eca085284
commit 4a22aeca46
4 changed files with 154 additions and 88 deletions

View File

@@ -6,15 +6,18 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
* Props:
* - images: Array<{ src, fullsize, filename?, isSelected? }>
* - onToggle(index)
* - onClick(index) optional for viewing
*/
export function LocalMediaGrid({
images,
onToggle,
onClick,
thumbSize = 100,
gap = 8,
minColumns = 3,
maxColumns = 12,
context = "default"
context = "default",
expandHeight = false
}) {
const containerRef = useRef(null);
const [cols, setCols] = useState(() => {
@@ -114,8 +117,7 @@ export function LocalMediaGrid({
display: "grid",
gridTemplateColumns,
gap,
maxHeight: 420,
overflowY: "auto",
...(expandHeight ? {} : { maxHeight: 420, overflowY: "auto" }),
overflowX: "hidden",
padding: 4,
justifyContent: justifyMode,
@@ -131,7 +133,7 @@ export function LocalMediaGrid({
role="listitem"
tabIndex={0}
aria-label={img.filename || `image ${idx + 1}`}
onClick={() => onToggle(idx)}
onClick={() => onClick ? onClick(idx) : onToggle(idx)}
onKeyDown={(e) => handleKeyDown(e, idx)}
style={{
position: "relative",
@@ -197,6 +199,23 @@ export function LocalMediaGrid({
}}
/>
)}
{onClick && (
<input
type="checkbox"
checked={img.isSelected}
onChange={(e) => {
e.stopPropagation();
onToggle(idx);
}}
onClick={(e) => e.stopPropagation()}
style={{
position: 'absolute',
top: 5,
right: 5,
zIndex: 2
}}
/>
)}
</div>
))}
{/* No placeholders needed; layout uses auto-fit for non-chat or fixed columns for chat */}