Skip to content

Commit

Permalink
feat:Add file name to downloaded file
Browse files Browse the repository at this point in the history
  • Loading branch information
YongZL committed Aug 9, 2024
1 parent eab5f81 commit 0327fb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/ATable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ATable: FC<ATableProps> = ({ header = [], data = [], loading }) => {


const onDownloadFile = (item: data) => {
const host = ` https://ton-gateway.crust.network/gateway/${item.bagId}`
const host = ` https://ton-gateway.crust.network/gateway/${item.bagId}?filename=${item.fileName}`
const link = document.createElement("a");
link.href = host;
link.click();
Expand All @@ -32,7 +32,7 @@ const ATable: FC<ATableProps> = ({ header = [], data = [], loading }) => {
loading ? <Loading /> :
data.length > 0 && data.map((item, i) => {
return <tr className="bg-[#FFFFFF] border-b odd:bg-slate-50 pl-3" key={`col_${i}`}>
<td><div className="w-[300px] pl-2 h-[40px] flex items-center">{truncateMiddle(item.fileName, 10, 10)}</div></td>
<td><div className="w-[200px] pl-2 h-[40px] flex items-center">{truncateMiddle(item.fileName, 5, 5)}</div></td>
<td><div className="w-[130px] flex items-center justify-between mr-5 ">{truncateMiddle(item.bagId, 5, 5)}
<button onClick={() => copyTextToClipboard(item.bagId)}>
<img src='/copy.svg' className=" w-5" />
Expand Down
4 changes: 1 addition & 3 deletions src/pages/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const Files = () => {
// const userFriendlyAddress = tonAdd?.account.address && toUserFriendlyAddress(tonAdd.account.address, false)

const getCurrentUserInfo = async () => {

const url = `https://tonbags-api.crust.network/users?address=${add.address}&page=${pgNum}&pageSize=10`
if (!add?.address) return
fetch(url, {
Expand Down Expand Up @@ -74,9 +73,8 @@ const Files = () => {
}, [add?.address, pgNum])



return (
<div className=' mb-[100px] h-[800px]'>
<div className=' mb-[100px] h-[700px]'>
<div className=' flex justify-center'>
{/* <TonConnectButton /> */}
</div>
Expand Down

0 comments on commit 0327fb2

Please sign in to comment.