Skip to content

Commit

Permalink
feat(upload folder): use alpha, update to upload folder or files PE-4643
Browse files Browse the repository at this point in the history
  • Loading branch information
fedellen committed Aug 14, 2024
1 parent 435a108 commit d1a6409
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "echo \"TODO: add tests\" && exit 0"
},
"dependencies": {
"@ardrive/turbo-sdk": "link:../ardrive-turbo-sdk",
"@ardrive/turbo-sdk": "alpha",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.20.1"
Expand Down
20 changes: 14 additions & 6 deletions src/pages/UploadPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { InputHTMLAttributes, useEffect, useState } from "react";
import { ErrMsgCallbackAsProps } from "../types";
import { ardriveAppUrl, turboConfig } from "../constants";
import { Page } from "./Page";
Expand All @@ -10,6 +10,10 @@ import {
import { getArconnect } from "../utils/arconnect";
import { NewToArDriveInfo } from "../components/NewToArDriveInfo";

interface ExtendedFileInputProps extends InputHTMLAttributes<HTMLInputElement> {
webkitdirectory?: boolean;
}

function UploadForm({ errorCallback }: ErrMsgCallbackAsProps) {
const [selectedFiles, setSelectedFiles] = useState<FileList | null>(null);

Expand Down Expand Up @@ -77,22 +81,26 @@ function UploadForm({ errorCallback }: ErrMsgCallbackAsProps) {
<form className="form">
<div className="form-section">
{/* TODO: Current balance of wallet in AR and Turbo Credits */}
{/* TODO: Inputs for manifest options, concurrent uploads, etc. */}

<label className="form-label">Upload</label>
<label className="form-label">Upload Folder</label>
<input
type="file"
multiple
webkitdirectory="true"
onChange={(e) => setSelectedFiles(e.target.files)}
{...({} as ExtendedFileInputProps)} // This line is a workaround for declaring webkitdirectory in TypeScript
/>
{/* <input
<br />
<label className="form-label">Upload Files</label>
<input
// webkitdirectory
type="file"
multiple
onChange={(e) => setSelectedFiles(e.target.files)}
/> */}
/>
</div>

{sending && <p>Now Sending Fund Transaction...</p>}
{sending && <p>Now Uploading...</p>}

{/* TODO: Estimate price */}
<button
Expand Down
44 changes: 35 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,23 @@
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@ardrive/turbo-sdk@link:../ardrive-turbo-sdk":
version "0.0.0"
uid ""
"@ardrive/turbo-sdk@alpha":
version "1.10.0-alpha.3"
resolved "https://registry.yarnpkg.com/@ardrive/turbo-sdk/-/turbo-sdk-1.10.0-alpha.3.tgz#886f077c73b71792ae15c84419c5a59637a48145"
integrity sha512-CWqk533A38nCBNJSWBvnfBuGI0Dzlh7Q4XEfqHPmLSWX6o3JKIHfZfujOc7MmY3u+47LeUmiaejIKvLVXTs/wg==
dependencies:
"@irys/arweave" "0.0.3"
"@solana/web3.js" "^1.91.7"
arbundles "0.9.9"
axios "^1.4.0"
axios-retry "^3.7.0"
bignumber.js "^9.1.2"
bs58 "^5.0.0"
ethers "^6.12.0"
mime-types "^2.1.35"
plimit-lit "^3.0.1"
tweetnacl "^1.0.3"
winston "^3.14.1"

"@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5":
version "7.23.5"
Expand Down Expand Up @@ -2634,7 +2648,7 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

logform@^2.3.2, logform@^2.4.0:
logform@^2.3.2:
version "2.6.0"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.6.0.tgz#8c82a983f05d6eaeb2d75e3decae7a768b2bf9b5"
integrity sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==
Expand All @@ -2646,6 +2660,18 @@ logform@^2.3.2, logform@^2.4.0:
safe-stable-stringify "^2.3.1"
triple-beam "^1.3.0"

logform@^2.6.0:
version "2.6.1"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.6.1.tgz#71403a7d8cae04b2b734147963236205db9b3df0"
integrity sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA==
dependencies:
"@colors/colors" "1.6.0"
"@types/triple-beam" "^1.3.2"
fecha "^4.2.0"
ms "^2.1.1"
safe-stable-stringify "^2.3.1"
triple-beam "^1.3.0"

loose-envify@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
Expand Down Expand Up @@ -3605,16 +3631,16 @@ winston-transport@^4.7.0:
readable-stream "^3.6.0"
triple-beam "^1.3.0"

winston@^3.10.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/winston/-/winston-3.13.0.tgz#e76c0d722f78e04838158c61adc1287201de7ce3"
integrity sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==
winston@^3.14.1:
version "3.14.2"
resolved "https://registry.yarnpkg.com/winston/-/winston-3.14.2.tgz#94ce5fd26d374f563c969d12f0cd9c641065adab"
integrity sha512-CO8cdpBB2yqzEf8v895L+GNKYJiEq8eKlHU38af3snQBQ+sdAIUepjMSguOIJC7ICbzm0ZI+Af2If4vIJrtmOg==
dependencies:
"@colors/colors" "^1.6.0"
"@dabh/diagnostics" "^2.0.2"
async "^3.2.3"
is-stream "^2.0.0"
logform "^2.4.0"
logform "^2.6.0"
one-time "^1.0.0"
readable-stream "^3.4.0"
safe-stable-stringify "^2.3.1"
Expand Down

0 comments on commit d1a6409

Please sign in to comment.