From e4a45a3989a80a0dc3882c45b5767f146301f23c Mon Sep 17 00:00:00 2001 From: Nathaniel Rindlaub Date: Tue, 5 Dec 2023 21:37:07 -0500 Subject: [PATCH] Sketch out context menu on image table rows --- src/features/images/ImagesTable.jsx | 86 +++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/src/features/images/ImagesTable.jsx b/src/features/images/ImagesTable.jsx index 77238020..9b5c1fb1 100644 --- a/src/features/images/ImagesTable.jsx +++ b/src/features/images/ImagesTable.jsx @@ -8,7 +8,7 @@ import React, { import { useSelector, useDispatch } from 'react-redux'; import { DateTime } from 'luxon'; import { green, orange } from '@radix-ui/colors'; -import { CheckIcon, Cross2Icon, TriangleUpIcon, TriangleDownIcon } from '@radix-ui/react-icons' +import { CheckIcon, Cross2Icon, TriangleUpIcon, TriangleDownIcon, LockOpen1Icon, Pencil1Icon } from '@radix-ui/react-icons' import useScrollbarSize from 'react-scrollbar-size'; import { useEffectAfterMount } from '../../app/utils'; import { styled } from '../../theme/stitches.config.js'; @@ -34,6 +34,14 @@ import { Image } from '../../components/Image'; import LabelPills from './LabelPills'; import { SimpleSpinner, SpinnerOverlay } from '../../components/Spinner'; import { selectProjectsLoading } from '../projects/projectsSlice'; +import { + ContextMenu, + ContextMenuTrigger, + ContextMenuContent, + ContextMenuItem, + ContextMenuSeparator, + ContextMenuItemIconLeft +} from '../../components/ContextMenu'; // TODO: make table horizontally scrollable on smaller screens @@ -400,25 +408,67 @@ const ImagesTable = ({ workingImages, hasNext, loadNextPage }) => { if (isImageLoaded(index)) { const row = rows[index]; prepareRow(row); + const selected = selectedRows.includes(index); return ( - handleRowClick(e, row.id)} - selected={selectedRows.includes(index)} - > - {row.cells.map(cell => ( - 3 - } + + + handleRowClick(e, row.id)} + selected={selected} > - {cell.render('Cell')} - - ))} - + {row.cells.map(cell => ( + 3 + } + > + {cell.render('Cell')} + + ))} + + + + console.log('Validate all labels')} + disabled={false} + css={{ + color: '$successText', + '&[data-highlighted]': { + backgroundColor: '$successBase', + color: '$successBg', + }, + }} + > + + + + Validate + + console.log('Invalidate all labels')} + disabled={false} + css={{ + color: '$errorText', + '&[data-highlighted]': { + backgroundColor: '$errorBase', + color: '$errorBg', + }, + }} + > + + + + Invalidate + + + ); } else {