Skip to content

Commit

Permalink
Working
Browse files Browse the repository at this point in the history
  • Loading branch information
parampatil committed Apr 14, 2024
1 parent 0092abe commit c6d025b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 10 deletions.
24 changes: 24 additions & 0 deletions src/Components/Spinner.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import './spinner.css';

const Spinner = () => (
<svg
className="spinner"
width="50px"
height="50px"
viewBox="0 0 66 66"
xmlns="http://www.w3.org/2000/svg"
>
<circle
className="path"
fill="none"
strokeWidth="6"
strokeLinecap="round"
cx="33"
cy="33"
r="30"
></circle>
</svg>
);

export default Spinner;

33 changes: 33 additions & 0 deletions src/Components/spinner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.spinner {
animation: rotate 1s linear infinite;
width: 50px;
height: 50px;
}

.path {
stroke: #333;
stroke-linecap: round;
animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
100% {
transform: rotate(360deg);
}
}

@keyframes dash {
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -124;
}
}

19 changes: 9 additions & 10 deletions src/pages/FileUploadComponent .jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,20 @@ const FileUploadComponent = () => {

const handleSplitAndDownload = async () => {
try {
const response = await axios.post(
"http://manavmandal.pythonanywhere.com/split",
{ file: selectedFile },
{
responseType: "blob",
}
);
// Trigger the split URL with a GET request
const response = await axios.get("http://manavmandal.pythonanywhere.com/split", {
responseType: "blob", // Receive response as a blob (binary data)
});

// Create a download URL for the received blob
const downloadUrl = window.URL.createObjectURL(new Blob([response.data]));
// Create a download link element
const downloadLink = document.createElement("a");
downloadLink.href = downloadUrl;
downloadLink.setAttribute("download", "split_files.zip");
downloadLink.setAttribute("download", "split_files.zip"); // Set download attribute and file name
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
downloadLink.click(); // Simulate click to trigger download
document.body.removeChild(downloadLink); // Remove the download link element after download
} catch (error) {
console.error("Split and download failed:", error);
}
Expand Down

0 comments on commit c6d025b

Please sign in to comment.