32 lines
922 B
TypeScript
Raw Normal View History

2021-07-22 00:28:58 +03:00
import { useRecoilState, useRecoilValue } from "recoil";
2021-07-22 02:31:01 +03:00
import { useGetFileSize } from "../appLogic";
import { fileCIDState, rpcAddrState } from "../appState";
2021-07-22 02:27:32 +03:00
import { TextInput } from "./TextInput";
2021-07-22 00:28:58 +03:00
export const SizeCalcForm = () => {
const rpcAddr = useRecoilValue(rpcAddrState);
const [fileCID, setFileCID] = useRecoilState(fileCIDState);
const getFileSize = useGetFileSize();
return (
<>
2021-07-22 02:27:32 +03:00
<h2>Get file size</h2>
<div className="article">
<p>
2021-07-22 00:28:58 +03:00
Upload any file to IPFS node
2021-07-22 02:27:32 +03:00
<b>{rpcAddr}</b>
2021-07-22 00:28:58 +03:00
paste CID here and get the size of that file via ProcessFiles service
you have just deployed
</p>
</div>
2021-07-22 02:27:32 +03:00
<TextInput text={"IPFS CID"} value={fileCID} setValue={setFileCID} />
2021-07-22 00:28:58 +03:00
<div className="row">
2021-07-22 02:27:32 +03:00
<button className="btn btn-right" onClick={getFileSize}>
get size
</button>
2021-07-22 00:28:58 +03:00
</div>
</>
);
};