Skip to content

Commit

Permalink
fix: handle image link on shared presentations (#595)
Browse files Browse the repository at this point in the history
Signed-off-by: Urban Vidovič <urbanfoundit@gmail.com>
  • Loading branch information
pseudobun committed Mar 20, 2024
1 parent 6bb9bb7 commit 695790f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DIDDisplay } from '@/components/DIDDisplay';
import JsonModal from '@/components/JsonModal';
import { getFirstWord } from '@/utils/format';
import { convertTypes, copyToClipboard } from '@/utils/string';
import { ImageLink } from '@/components/ImageLink';

interface FormattedPanelProps {
credential: VerifiableCredential;
Expand Down Expand Up @@ -93,11 +94,11 @@ const CredentialSubject = ({
}

if (key === 'address') return <AddressDisplay address={value} />;
if (key === 'image') return <ImageLink value={value} />;

const isObject = !(
typeof value === 'string' || typeof value === 'number'
);
// key is a string camel case, seperate it with spaces, e.g. CamelCase should be Camel Case
key = key.replace(/([A-Z])/g, ' $1').trim();
return (
<div
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions packages/dapp/src/components/ImageLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export const ImageLink = ({ value }: { value: string }) => {
</h2>
<div className="flex flex-row">
<a
href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY}/ipfs/${value
.toString()
.slice('ipfs://'.length)}`}
href={`${
process.env.NEXT_PUBLIC_IPFS_GATEWAY || 'https://ipfs.io'
}/ipfs/${value.toString().slice('ipfs://'.length)}`}
target="_blank"
rel="noopener noreferrer"
className="text-md animated-transition dark:text-navy-blue-300 cursor-pointer font-normal text-gray-700 underline underline-offset-2"
Expand Down

0 comments on commit 695790f

Please sign in to comment.