diff --git a/public/locales/en/explore.json b/public/locales/en/explore.json
index b6422f5d..86c790f9 100644
--- a/public/locales/en/explore.json
+++ b/public/locales/en/explore.json
@@ -70,5 +70,8 @@
},
"errors": {
"BlockFetchTimeoutError": "Failed to fetch content in {timeout}s. Please refresh the page to retry or try a different CID."
+ },
+ "docLinks": {
+ "viewInDocs": "View in IPFS Documentation"
}
}
diff --git a/src/components/ExplorePage.tsx b/src/components/ExplorePage.tsx
index 9985f873..a4578d08 100644
--- a/src/components/ExplorePage.tsx
+++ b/src/components/ExplorePage.tsx
@@ -45,7 +45,8 @@ export const ExplorePage = ({
}
return (
-
+ //
+
{t('ExplorePage.title')}
diff --git a/src/components/cid-info/CidInfo.tsx b/src/components/cid-info/CidInfo.tsx
index 0d906736..8c500abb 100644
--- a/src/components/cid-info/CidInfo.tsx
+++ b/src/components/cid-info/CidInfo.tsx
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import extractInfo, { type ExtractedInfo } from '../../lib/extract-info.js'
+import { DocLink } from '../common/DocLink'
export interface CidInfoProps extends React.HTMLAttributes
{
cid: string | null
@@ -31,9 +32,9 @@ export const CidInfo: React.FC = ({ cid, className, ...props }) =>
return (
{(cidInfo == null)
? null
@@ -48,12 +49,9 @@ export const CidInfo: React.FC = ({ cid, className, ...props }) =>
-
+
{t('multihash')}
-
+
0x
@@ -68,10 +66,10 @@ export const CidInfo: React.FC
= ({ cid, className, ...props }) =>
{t('CidInfo.hashDigest')}
-
+
0x
{cidInfo.hashFnCode} = {cidInfo.hashFn}
-
+
0x
{cidInfo.hashLengthCode} = {cidInfo.hashLengthInBits} bits
diff --git a/src/components/common/DocLink.stories.tsx b/src/components/common/DocLink.stories.tsx
new file mode 100644
index 00000000..7b61d873
--- /dev/null
+++ b/src/components/common/DocLink.stories.tsx
@@ -0,0 +1,46 @@
+import React from 'react'
+import { DocLink } from './DocLink'
+import type { Meta, StoryObj } from '@storybook/react'
+
+const meta: Meta
= {
+ title: 'Common/DocLink',
+ component: DocLink,
+ args: {
+ term: 'cid',
+ className: 'ma2'
+ }
+}
+
+export default meta
+type Story = StoryObj
+
+export const Default: Story = {
+ args: {
+ term: 'cid'
+ }
+}
+
+export const WithCustomText: Story = {
+ args: {
+ term: 'cid',
+ children: 'Content Identifier'
+ }
+}
+
+export const WithCustomPath: Story = {
+ args: {
+ term: 'cid',
+ glossaryPath: 'concepts/content-addressing'
+ }
+}
+
+export const MultipleLinks: Story = {
+ render: () => (
+
+ CID
+ Multibase
+ Multicodec
+ Multihash
+
+ )
+}
diff --git a/src/components/common/DocLink.tsx b/src/components/common/DocLink.tsx
new file mode 100644
index 00000000..4b8644bf
--- /dev/null
+++ b/src/components/common/DocLink.tsx
@@ -0,0 +1,52 @@
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+
+export interface DocLinkProps extends React.AnchorHTMLAttributes {
+ term: string
+ glossaryPath?: string
+ children?: React.ReactNode
+}
+
+/**
+ * A component for rendering documentation links.
+ * Links to the IPFS documentation glossary by default.
+ */
+export const DocLink: React.FC = ({
+ term,
+ glossaryPath = 'concepts/glossary',
+ children,
+ className = '',
+ ...props
+}) => {
+ const { t } = useTranslation('explore')
+ const baseUrl = 'https://docs.ipfs.io'
+ const href = `${baseUrl}/${glossaryPath}/#${term.toLowerCase()}`
+
+ return (
+
+ {children ?? term}
+
+
+ )
+}
+
+export default DocLink
diff --git a/src/components/object-info/ObjectInfo.tsx b/src/components/object-info/ObjectInfo.tsx
index 54e3a2a0..22e86aa9 100644
--- a/src/components/object-info/ObjectInfo.tsx
+++ b/src/components/object-info/ObjectInfo.tsx
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next'
import { ObjectInspector, chromeLight } from 'react-inspector'
import getCodecNameFromCode from '../../lib/get-codec-name-from-code'
import { type NormalizedDagNode, type UnixFsNodeDataWithNumbers } from '../../types.js'
+import { DocLink } from '../common/DocLink.js'
import LargeLinksTable, { type LinkObject, type LargeLinksTableProps } from './links-table'
const humansize = partial({ round: 0 })
@@ -138,7 +139,7 @@ export const ObjectInfo: React.FC = ({ className, type, cid, lo
{format === 'unixfs'
? (
- UnixFS
+ UnixFS
)
: null}
{isUnixFs