Skip to content

Commit

Permalink
feat: show a preview of the url in the cid page.
Browse files Browse the repository at this point in the history
Very cheap preview of the gateway view in the cid page via an iframe.

Disable interaction on the iframe with the `inert` attributes. No clicking through, that way lies madness.

We probably don't want to do this, but it does show how useful a visual preview of the contnet would be.

License: MIT
Signed-off-by: Oli Evans <oli@protocol.ai>
  • Loading branch information
olizilla committed Jan 19, 2024
1 parent 2ded489 commit 1c8aad9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/app/space/[did]/root/[cid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ export default function ItemPage ({ params }: PageProps): JSX.Element {
{root.toString()}
<CopyIcon text={root.toString()} />
</div>
<H2>URL</H2>
<div className="pb-5 overflow-hidden no-wrap text-ellipsis">
<a href={url} className="font-mono text-sm underline m-0 p-0">{url}</a>
<CopyIcon text={url} />
</div>
<H2>Shards</H2>
<div className='pb-5'>
{upload.isLoading
? <DefaultLoader className='w-5 h-5 inline-block' />
: upload.data?.shards?.map(link => <Shard space={space.did()} root={root} shard={link} key={link.toString()} />)}
</div>
<H2>URL</H2>
<div className='bg-white bg-opacity-30 rounded max-w-4xl shadow-inner'>
<div className="p-2 overflow-hidden no-wrap text-ellipsis">
<a href={url} className="font-mono text-sm underline m-0 p-0">{url}</a>
<CopyIcon text={url} />
</div>
<iframe src={url} className='w-full h-72 bg-white' inert='inert'></iframe>
</div>
</div>
)
}
Expand Down

0 comments on commit 1c8aad9

Please sign in to comment.