Skip to content

Commit

Permalink
chore: leave comment for export-more-params-and-format
Browse files Browse the repository at this point in the history
  • Loading branch information
avevotsira committed Jul 17, 2024
1 parent ba3665f commit e368ddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/gui/export/export-result-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default function ExportResultButton({
}) {
const [format, setFormat] = useState<string>("sql");

//do we want to make them something like this or just string?
// is we use the as const , where should i move it to?

const OutputTargetType = {
File: "file",
Clipboard: "clipboard",
Expand Down Expand Up @@ -65,7 +68,8 @@ export default function ExportResultButton({
exportSelection === ExportSelectionType.Complete
? data.getAllRows()
: data.getSelectedRows()
).map((row) => headers.map((header) => row.raw[header]));
) // i need more instruction on how to do this getSelectedRows
.map((row) => headers.map((header) => row.raw[header]));

const exportTableName = tableName.trim() || "UnknownTable";
const formatHandlers = getFormatHandlers(
Expand All @@ -80,6 +84,7 @@ export default function ExportResultButton({

const content = handler();

//should we move this to a seperate function by now?
if (outputTarget === OutputTargetType.File) {
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
const url = URL.createObjectURL(blob);
Expand Down
1 change: 1 addition & 0 deletions src/components/lib/export-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function truncateText(text: string, limit: number): string {
return `${text.slice(0, limit)}...`;
}

//i think it cleaner to move this somewhere but i dont know where should i
function calculateColumnWidths(
headers: string[],
records: unknown[][],
Expand Down

0 comments on commit e368ddc

Please sign in to comment.