Skip to content

Commit 5f73975

Browse files
committed
refactor: arrange component
1 parent 9ce4cf8 commit 5f73975

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

src/files/FilesPage.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ import InfoBoxes from './info-boxes/InfoBoxes.js'
1313
import FilePreview from './file-preview/FilePreview.js'
1414
import FilesList from './files-list/FilesList.js'
1515
import { getJoyrideLocales } from '../helpers/i8n.js'
16-
import Button from '../components/button/button'
1716

1817
// Icons
1918
import Modals, { DELETE, NEW_FOLDER, ADD_BY_CAR, SHARE, RENAME, ADD_BY_PATH, BULK_CID_IMPORT, CLI_TUTOR_MODE, PINNING, PUBLISH } from './modals/Modals.js'
2019
import Header from './header/Header.js'
2120
import FileImportStatus from './file-import-status/FileImportStatus.js'
2221
import { useExplore } from 'ipld-explorer-components/providers'
23-
import GlyphAttention from '../icons/GlyphAttention.js'
22+
import { FileNotFound } from './file-not-found/FileNotFound.js'
2423

2524
const FilesPage = ({
2625
doFetchPinningServices, doFilesFetch, doPinsFetch, doFilesSizeGet, doFilesDownloadLink, doFilesDownloadCarLink, doFilesWrite, doAddCarFile, doFilesBulkCidImport, doFilesAddPath, doUpdateHash,
@@ -272,25 +271,7 @@ const Preview = ({ files, path, onDownload }) => {
272271
}
273272

274273
return (
275-
<div
276-
className='mb3 pa4-l pa2 mw9 center'
277-
style={{ background: 'rgba(251, 251, 251)' }}
278-
>
279-
<div className='flex flex-row items-center mb3'>
280-
<GlyphAttention style={{ height: 76 }} className='fill-red mr' role='presentation' />
281-
<div className='red fw6 truncate'>IPFS can't find this item</div>
282-
</div>
283-
<div className='mb3 charcoal fw6 truncate'>{path}</div>
284-
<div className='mb3'>These are common troubleshooting steps might help:</div>
285-
<ul>
286-
<li>Are there typos in the path you entered?</li>
287-
<li>Was the file moved, renamed, or deleted?</li>
288-
<li>Did you copy a URL or bookmark from another computer? If so, you'll need to <a href="#/peers">point this instance at that computer's node</a>.</li>
289-
</ul>
290-
<a href="#/files">
291-
<Button className='ma2 tc' bg='bg-teal'>Go to Home</Button>
292-
</a>
293-
</div>
274+
<FileNotFound path={path} />
294275
)
295276
}
296277

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react'
2+
3+
import Button from '../../components/button/button'
4+
5+
import GlyphAttention from '../../icons/GlyphAttention.js'
6+
7+
const FileNotFound = ({ path }) => {
8+
return (
9+
<div
10+
className='mb3 pa4-l pa2 mw9 center'
11+
style={{ background: 'rgba(251, 251, 251)' }}
12+
>
13+
<div className='flex flex-row items-center mb3'>
14+
<GlyphAttention style={{ height: 76 }} className='fill-red mr' role='presentation' />
15+
<div className='red fw6 truncate'>IPFS can't find this item</div>
16+
</div>
17+
<div className='mb3 charcoal fw6 truncate'>{path}</div>
18+
<div className='mb3'>These are common troubleshooting steps might help:</div>
19+
<ul>
20+
<li>Are there typos in the path you entered?</li>
21+
<li>Was the file moved, renamed, or deleted?</li>
22+
<li>Did you copy a URL or bookmark from another computer? If so, you'll need to <a href="#/peers">point this instance at that computer's node</a>.</li>
23+
</ul>
24+
<a href="#/files">
25+
<Button className='ma2 tc' bg='bg-teal'>Go to Home</Button>
26+
</a>
27+
</div>
28+
)
29+
}
30+
31+
export { FileNotFound }

0 commit comments

Comments
 (0)