-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from oxedom/enhance/2
Enhance/2
- Loading branch information
Showing
5 changed files
with
126 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Button from "./Button"; | ||
import { useRecoilValue, } from "recoil"; | ||
import { selectedRoiState } from "./states"; | ||
const DataManger = () => { | ||
|
||
const selectedRois = useRecoilValue(selectedRoiState); | ||
|
||
|
||
|
||
function handleJson() { | ||
|
||
const beforeExport = | ||
{ | ||
title: 'Parkerr.org', | ||
repo: 'https://github.com/oxedom/parker', | ||
timeOfExport: Date.now(), | ||
rois: selectedRois | ||
} | ||
|
||
// Convert the data object to JSON | ||
const jsonData = JSON.stringify(beforeExport); | ||
// Create a Blob with the JSON data | ||
const blob = new Blob([jsonData], { type: 'application/json' }); | ||
// Create a temporary URL for the Blob | ||
const url = URL.createObjectURL(blob); | ||
// Create a link element | ||
const link = document.createElement('a'); | ||
link.href = url; | ||
link.download = 'exported_data.json'; | ||
// Simulate a click on the link element to trigger the file download | ||
link.click(); | ||
// Clean up the temporary URL | ||
URL.revokeObjectURL(url); | ||
} | ||
function handleCsv() {} | ||
|
||
|
||
return ( <> | ||
|
||
<div className="bg-black/60 backdrop-blur-sm pb-3 px-5 flex flex-col max-w-[500px]" > | ||
<h2 className=" text-center text-3xl text-white pt-2 border-b border-orange-500 pb-1" > Data manger </h2> | ||
<p className="text-white text-xl pt-4 "> Selection boxes keep track of events that occur, export that data | ||
locally to perform your own data exploration. | ||
</p> | ||
|
||
<div className="flex flex-col items-center mt-10 gap-y-2"> | ||
<h1 className="text-white text-2xl "> Export as </h1> | ||
<div className="flex justify-center items-center gap-5 "> | ||
|
||
<Button onClick={handleJson}> <span className="text-lg"> JSON</span> </Button> | ||
{/* <Button> <span className="text-lg"> CSV </span> </Button> */} | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
|
||
</> | ||
|
||
); | ||
} | ||
|
||
export default DataManger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
import Button from "./Button"; | ||
const Modal = ({ isOpen, closeModal, children }) => { | ||
if (!isOpen) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="fixed top-1/2 -translate-y-1/2 flex items-center z-[99999] justify-center bg-black bg-opacity-50"> | ||
<div className="bg-filler p-3 rounded-xl "> | ||
{children} | ||
|
||
|
||
<Button intent="destructive" className="mt-2 " onClick={closeModal}> <span className="text-lg "> Close Modal </span> </Button> | ||
|
||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters