Skip to content

Commit

Permalink
feat: impl importing json files when templating xlsx
Browse files Browse the repository at this point in the history
  • Loading branch information
iyxan23 committed Sep 23, 2024
1 parent 4a0025a commit 2e2d755
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions site/src/components/xlsx/DataInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,26 @@ export default function DataInput() {
<p className="text-sm text-muted-foreground">
Note: This is all happening on the client! (≧▽≦)
</p>
<Button disabled={isPending || !file} onClick={() => doTemplate()}>
Template
</Button>
<div className="flex flex-row gap-4">
<Button
variant="outline"
onClick={() => {
const input = document.createElement("input");
input.type = "file";
input.accept = "application/json";
input.onchange = () => {
input.files?.[0] &&
input.files[0].text().then(setData);
};
input.click();
}}
>
Import JSON
</Button>
<Button disabled={isPending || !file} onClick={() => doTemplate()}>
Template
</Button>
</div>
</div>

<Textarea
Expand Down

0 comments on commit 2e2d755

Please sign in to comment.