Skip to content

Commit d046446

Browse files
authored
feat(instructions): show link for instruction version since v4 (#149)
1 parent 4e54b4d commit d046446

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

src/pages/InstructionsPage/components/InstructionTable/InstructionDetail.module.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@
227227
font-size: var(--font-size-sm);
228228
}
229229

230+
.versionLink {
231+
color: var(--color-link);
232+
text-decoration: none;
233+
font-size: var(--font-size-sm);
234+
display: inline-flex;
235+
align-items: center;
236+
gap: var(--spacing-xs);
237+
}
238+
239+
.versionLink svg {
240+
width: 12px;
241+
height: 12px;
242+
}
243+
230244
@media (width <= 768px) {
231245
.implementationsGridContainer {
232246
grid-template-columns: 1fr;

src/pages/InstructionsPage/components/InstructionTable/InstructionDetail.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from "react"
22

33
import ReactMarkdown from "react-markdown"
44

5+
import {FiExternalLink} from "react-icons/fi"
6+
57
import {Category, type DocsLink, type Instruction} from "@features/spec/tvm-specification.types"
68

79
import {prettySubCategoryName} from "@app/pages/InstructionsPage/lib/formatCategory.ts"
@@ -90,7 +92,22 @@ const InstructionDetail: React.FC<InstructionDetailProps> = ({
9092
<div className={styles.metadataContainer}>
9193
<div className={styles.metadataItem}>
9294
<span className={styles.metadataLabel}>Since Version:</span>
93-
<span className={styles.metadataValue}>{version}</span>
95+
<span className={styles.metadataValue}>
96+
{version >= 4 ? (
97+
<a
98+
href={`https://github.com/ton-blockchain/ton/blob/master/doc/GlobalVersions.md#version-${version}`}
99+
target="_blank"
100+
rel="noopener noreferrer"
101+
className={styles.versionLink}
102+
title={`View TVM version ${version} documentation`}
103+
>
104+
{version}
105+
<FiExternalLink />
106+
</a>
107+
) : (
108+
version
109+
)}
110+
</span>
94111
</div>
95112

96113
<div className={styles.metadataItem}>
@@ -177,8 +194,12 @@ const InstructionDetail: React.FC<InstructionDetailProps> = ({
177194
<ReactMarkdown components={markdownComponents}>{description.short}</ReactMarkdown>
178195
)}
179196

180-
<h3 className={styles.detailSectionTitle}>Details</h3>
181-
<ReactMarkdown components={markdownComponents}>{description.long}</ReactMarkdown>
197+
{description.long && (
198+
<>
199+
<h3 className={styles.detailSectionTitle}>Details</h3>
200+
<ReactMarkdown components={markdownComponents}>{description.long}</ReactMarkdown>
201+
</>
202+
)}
182203
</div>
183204
</div>
184205

0 commit comments

Comments
 (0)