Skip to content

Build your personal knowledge base with Trilium Notes

feat(table): integrate footer buttons into collection properties

Elian Doran0c4de9a5e0a2
diff --git a/apps/client/src/widgets/collections/table/index.tsx b/apps/client/src/widgets/collections/table/index.tsx
index d01f293d62..7028bd439b 100644
--- a/apps/client/src/widgets/collections/table/index.tsx
+++ b/apps/client/src/widgets/collections/table/index.tsx
@@ -49,7 +49,15 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
return (
<div className="table-view">
- <CollectionProperties note={note} />
+ <CollectionProperties
+ note={note}
+ rightChildren={note.type !== "search" &&
+ <>
+ <Button triggerCommand="addNewRow" icon="bx bx-plus" text={t("table_view.new-row")} />
+ <Button triggerCommand="addNewTableColumn" icon="bx bx-carousel" text={t("table_view.new-column")} />
+ </>
+ }
+ />
{rowData !== undefined && persistenceProps && (
<>
@@ -59,7 +67,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
columns={columnDefs ?? []}
data={rowData}
modules={[ SortModule, FormatModule, InteractionModule, EditModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule, MoveColumnsModule, MoveRowsModule, DataTreeModule ]}
- footerElement={<TableFooter note={note} />}
events={{
...contextMenuEvents,
...rowEditingEvents
@@ -72,7 +79,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
rowFormatter={rowFormatter}
{...dataTreeProps}
/>
- <TableFooter note={note} />
</>
)}
{attributeDetailWidgetEl}
@@ -80,18 +86,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
);
}
-function TableFooter({ note }: { note: FNote }) {
- return (note.type !== "search" &&
- <div className="tabulator-footer">
- <div className="tabulator-footer-contents">
- <Button triggerCommand="addNewRow" icon="bx bx-plus" text={t("table_view.new-row")} />
- {" "}
- <Button triggerCommand="addNewTableColumn" icon="bx bx-carousel" text={t("table_view.new-column")} />
- </div>
- </div>
- );
-}
-
function usePersistence(viewConfig: TableConfig | null | undefined, saveConfig: (newConfig: TableConfig) => void) {
const [ persistenceProps, setPersistenceProps ] = useState<Pick<Options, "persistenceReaderFunc" | "persistenceWriterFunc">>();
diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.css b/apps/client/src/widgets/note_bars/CollectionProperties.css
index 6332b6b9ad..cd50197c47 100644
--- a/apps/client/src/widgets/note_bars/CollectionProperties.css
+++ b/apps/client/src/widgets/note_bars/CollectionProperties.css
@@ -17,12 +17,12 @@
>div {
display: inline-flex;
align-items: center;
+ gap: 0.5em;
}
.center-container {
flex-grow: 1;
justify-content: center;
- gap: 0.5em;
}
button.btn {