From d92d7cf989547390b7fa01bc8d06e7478e488d3c Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 5 Apr 2022 17:08:09 +0100 Subject: [PATCH] fix: temporarily hide upload name column (#1770) This allows us to release the blog posts. API can then be deployed separately, and then the frontend (with this change reverted). --- packages/website/pages/files.js | 75 +++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/packages/website/pages/files.js b/packages/website/pages/files.js index d1ffa150f2..4bd9a23f20 100644 --- a/packages/website/pages/files.js +++ b/packages/website/pages/files.js @@ -1,7 +1,8 @@ import { API, getNfts, getToken } from '../lib/api.js' import { useQuery, useQueryClient } from 'react-query' import { CID } from 'multiformats/cid' -import { VscQuestion, VscEdit, VscLoading, VscSave } from 'react-icons/vsc' +// import { VscQuestion, VscEdit, VscLoading, VscSave } from 'react-icons/vsc' +import { VscQuestion } from 'react-icons/vsc' import Button from '../components/button.js' import Tooltip from '../components/tooltip.js' import Loading from '../components/loading' @@ -111,10 +112,10 @@ export default function Files({ user }) { */ const TableItem = ({ nft }) => { // to do, add actual types - const [isRenaming, setRenaming] = useState(false) - const [isLoading, setLoading] = useState(false) - const [renameError, setError] = useState('') - const [renamedValue, setRenamedValue] = useState('') + // const [isRenaming, setRenaming] = useState(false) + // const [isLoading, setLoading] = useState(false) + // const [renameError, setError] = useState('') + // const [renamedValue, setRenamedValue] = useState('') const [showAllDeals, setShowAllDeals] = useState(false) const deals = nft.deals .filter((/** @type {any} */ d) => d.status !== 'queued') @@ -198,37 +199,37 @@ export default function Files({ user }) { } /** @param {import('react').ChangeEvent} ev */ - const handleRename = async (ev) => { - ev.preventDefault() - const data = new FormData(ev.target) - const fileName = data.get('fileName') + // const handleRename = async (ev) => { + // ev.preventDefault() + // const data = new FormData(ev.target) + // const fileName = data.get('fileName') - if (!fileName || typeof fileName !== 'string') return - if (fileName === nft.name) return setRenaming(false) + // if (!fileName || typeof fileName !== 'string') return + // if (fileName === nft.name) return setRenaming(false) - try { - setLoading(true) - await fetch(`${API}/upload/${nft.cid}`, { - method: 'PATCH', - body: JSON.stringify({ - name: fileName, - }), - headers: { - 'Content-type': 'application/json; charset=UTF-8', - Authorization: `Bearer ${await getToken()}`, - }, - }) - setError('') - } catch (e) { - console.error(e) - // @ts-ignore Catch clause variable type annotation must be 'any' or 'unknown' if specified.ts(1196) - setError(e.message) - } + // try { + // setLoading(true) + // await fetch(`${API}/upload/${nft.cid}`, { + // method: 'PATCH', + // body: JSON.stringify({ + // name: fileName, + // }), + // headers: { + // 'Content-type': 'application/json; charset=UTF-8', + // Authorization: `Bearer ${await getToken()}`, + // }, + // }) + // setError('') + // } catch (e) { + // console.error(e) + // // @ts-ignore Catch clause variable type annotation must be 'any' or 'unknown' if specified.ts(1196) + // setError(e.message) + // } - setLoading(false) - setRenaming(false) - setRenamedValue(fileName) - } + // setLoading(false) + // setRenaming(false) + // setRenamedValue(fileName) + // } return ( @@ -236,7 +237,7 @@ export default function Files({ user }) { {/* {nft.created.split('T')[0]} */} {formatTimestamp(nft.created)} - + {/* {!isRenaming ? (
)} - + */} Date - + {/* Label - + */} CID