) => (
+
+ Hello
+
+
+ ),
+ })
+
+ const openDialog = useCallback(async () => {
+ await open()
+ setData([{ id: 1 }])
+ }, [open])
+
+ const table = useReactTable({
+ data,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getRowId: (row) => row.id.toString(),
+ })
+
+ const dataIds = useMemo(() => data.map((d) => d.id.toString()), [data])
+
+ // reorder rows after drag & drop
+ function handleDragEnd(event: DragEndEvent) {
+ const { active, over } = event
+ if (active && over && active.id !== over.id) {
+ const oldIndex = dataIds.indexOf(active.id.toString())
+ const newIndex = dataIds.indexOf(over.id.toString())
+ const newData = arrayMove(data, oldIndex, newIndex) //this is just a splice util
+ setData(newData)
+ }
+ }
+
+ const sensors = useSensors(useSensor(MouseSensor, {}), useSensor(TouchSensor, {}), useSensor(KeyboardSensor, {}))
+
+ return (
+ <>
+
+ {/* */}
+
+
+
+
+ {table.getHeaderGroups().map((headerGroup) => (
+
+
+ {headerGroup.headers.map((header) => {
+ return (
+
+ {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
+
+ )
+ })}
+
+ ))}
+
+
+ {table.getRowModel().rows?.length ? (
+ table.getRowModel().rows.map((row) => )
+ ) : (
+
+
+
+ No transactions.
+
+
+
+ )}
+
+
+
+
+ {dialog}
+ >
+ )
+}
+
+const columns: ColumnDef<{ id: number }>[] = [
+ {
+ id: 'index',
+ cell: (c) => {
+ return c.row.original.id
+ },
+ },
+ {
+ id: 'actions',
+ cell: () => {
+ return (
+ {
+ console.log('here!!')
+ }}
+ >
+
+
+
+
+ Item 1
+ Item 2
+ Item 3
+
+
+ )
+ },
+ },
+]
+
+function DataRow({ row }: { row: Row<{ id: number }> }) {
+ const { transform, transition, setNodeRef, isDragging } = useSortable({
+ id: row.id,
+ })
+
+ const style: CSSProperties = {
+ transform: CSS.Translate.toString(transform), //let dnd-kit do its thing
+ transition: transition,
+ opacity: isDragging ? 0.8 : 1,
+ zIndex: isDragging ? 1 : 0,
+ position: 'relative',
+ }
+
+ return (
+
+
+
+
+
+ {row.getVisibleCells().map((cell) => (
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
+ ))}
+
+
+ )
+}
diff --git a/src/features/transaction-wizard/components/transactions-table.tsx b/src/features/transaction-wizard/components/transactions-table.tsx
index 876398b2..6a74d2b4 100644
--- a/src/features/transaction-wizard/components/transactions-table.tsx
+++ b/src/features/transaction-wizard/components/transactions-table.tsx
@@ -109,7 +109,10 @@ export function TransactionsTable({
}: Props) {
const transactionPositions = useMemo(() => calculatePositions(data), [data])
- const columns = getTableColumns({ onEditTransaction, onEditResources, onDelete, nonDeletableTransactionIds, transactionPositions })
+ const columns = useMemo(
+ () => getTableColumns({ onEditTransaction, onEditResources, onDelete, nonDeletableTransactionIds, transactionPositions }),
+ [nonDeletableTransactionIds, onDelete, onEditResources, onEditTransaction, transactionPositions]
+ )
const table = useReactTable({
data,
@@ -237,24 +240,37 @@ const getTableColumns = ({
id: 'actions',
meta: { className: 'w-14' },
cell: ({ row }) => (
-
-
- } />
-
-
- onEditTransaction(row.original)}>Edit
- {(row.original.type === BuildableTransactionType.AppCall || row.original.type === BuildableTransactionType.MethodCall) && (
- onEditResources(row.original as BuildAppCallTransactionResult | BuildMethodCallTransactionResult)}
- >
- Edit Resources
+ <>
+ {
+ console.log('here!!')
+ }}
+ >
+
+ } />
+
+
+ onEditTransaction(row.original)}>Edit
+ {(row.original.type === BuildableTransactionType.AppCall || row.original.type === BuildableTransactionType.MethodCall) && (
+ onEditResources(row.original as BuildAppCallTransactionResult | BuildMethodCallTransactionResult)}
+ >
+ Edit Resources
+
+ )}
+ onDelete(row.original)} disabled={nonDeletableTransactionIds.includes(row.original.id)}>
+ Delete
- )}
- onDelete(row.original)} disabled={nonDeletableTransactionIds.includes(row.original.id)}>
- Delete
-
-
-
+
+
+
+ >
),
},
]
@@ -337,9 +353,21 @@ const getSubTransactionsTableColumns = ({
meta: { className: 'w-14' },
cell: ({ row }) =>
row.original.type !== BuildableTransactionType.Placeholder ? (
-
+ {
+ console.log('HERE!!!')
+ }}
+ >
- } />
+ }
+ onClick={() => {
+ console.log('CLICKED!!')
+ }}
+ />
onEditTransaction(row.original)}>Edit
diff --git a/vite.config.ts b/vite.config.ts
index 24a125f4..ff73000a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -35,6 +35,8 @@ export default defineConfig({
INDEXER_SERVER: 'http://localhost',
INDEXER_PORT: '8980',
},
+ disableConsoleIntercept: false,
+ reporters: 'basic',
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`