♻️ (tableComponent): remove unnecessary comma and autoHeight property

✨ (ShortcutsPage): add conditional rendering for TableComponent to handle empty data
This commit is contained in:
cristhianzl 2024-06-14 15:48:52 -03:00 • committed by ogabrielluiz
commit 63497586d8
2 changed files with 14 additions and 13 deletions

View file

@ -141,7 +141,6 @@ const TableComponent = forwardRef<
{...props} {...props}
defaultColDef={{ defaultColDef={{
minWidth: 100, minWidth: 100,
autoHeight: true,
}} }}
animateRows={false} animateRows={false}
columnDefs={colDef} columnDefs={colDef}

View file

@ -40,7 +40,7 @@ export default function ShortcutsPage() {
const combinationToEdit = shortcuts.filter((s) => s.name === selectedRows[0]); const combinationToEdit = shortcuts.filter((s) => s.name === selectedRows[0]);
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const updateUniqueShortcut = useShortcutsStore( const updateUniqueShortcut = useShortcutsStore(
(state) => state.updateUniqueShortcut (state) => state.updateUniqueShortcut,
); );
function handleRestore() { function handleRestore() {
@ -97,17 +97,19 @@ export default function ShortcutsPage() {
</div> </div>
<div className="grid gap-6 pb-8"> <div className="grid gap-6 pb-8">
<div> <div>
<TableComponent {colDefs && nodesRowData.length > 0 && (
suppressRowClickSelection={true} <TableComponent
domLayout="autoHeight" suppressRowClickSelection={true}
pagination={false} domLayout="autoHeight"
columnDefs={colDefs} pagination={false}
rowData={nodesRowData} columnDefs={colDefs}
onCellDoubleClicked={(e) => { rowData={nodesRowData}
setSelectedRows([e.data.name]); onCellDoubleClicked={(e) => {
setOpen(true); setSelectedRows([e.data.name]);
}} setOpen(true);
/> }}
/>
)}
</div> </div>
</div> </div>
</div> </div>