Skip to content

Commit 1a7515f

Browse files
committed
feat(spec): add button to go to the continuation documentation
1 parent 0041456 commit 1a7515f

File tree

10 files changed

+111
-15
lines changed

10 files changed

+111
-15
lines changed

spec/astro.config.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,23 @@ export default defineConfig({
152152
{
153153
label: "Book",
154154
items: [
155-
{slug: "book/basics-register-c0-cc-savelist-if-instruction"},
156-
{slug: "book/diving-deeper-exit-points-of-continuations"},
157-
{slug: "book/manual-handling-and-jmp-vs-execute"},
155+
{
156+
label: "Continuations",
157+
items: [
158+
{slug: "book/continuations/basics-register-c0-cc-savelist-if-instruction"},
159+
{slug: "book/continuations/diving-deeper-exit-points-of-continuations"},
160+
{slug: "book/continuations/manual-handling-and-jmp-vs-execute"},
161+
],
162+
},
158163
],
159164
},
160165
],
161166
}),
162167
react(),
163168
],
164169
redirects: {
165-
"/": "/spec/doc/book/basics-register-c0-cc-savelist-if-instruction/",
170+
"/": "/spec/doc/book/continuations/basics-register-c0-cc-savelist-if-instruction/",
171+
"/book/continuations":
172+
"/spec/doc/book/continuations/basics-register-c0-cc-savelist-if-instruction/",
166173
},
167174
})
File renamed without changes.

spec/src/content/docs/book/diving-deeper-exit-points-of-continuations.mdx renamed to spec/src/content/docs/book/continuations/diving-deeper-exit-points-of-continuations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Diving deeper: exit points of continuations"
33
---
44

5-
In the [previous article](/spec/doc/book/basics-register-c0-cc-savelist-if-instruction/), we explored the `c0` register and its role in control flow. In this article, we'll look at the other two control registers: `c1` (alternative return) and `c2` (exception handler).
5+
In the [previous article](/spec/doc/book/continuations/basics-register-c0-cc-savelist-if-instruction/), we explored the `c0` register and its role in control flow. In this article, we'll look at the other two control registers: `c1` (alternative return) and `c2` (exception handler).
66

77
While the first article focused on the normal exit point of a continuation (when its code ends or `RET` is called), every continuation actually has three distinct exit points.
88

spec/src/content/docs/book/manual-handling-and-jmp-vs-execute.mdx renamed to spec/src/content/docs/book/continuations/manual-handling-and-jmp-vs-execute.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Manual handling and JMP vs. EXECUTE"
33
---
44

5-
In the [previous article](/spec/doc/book/diving-deeper-exit-points-of-continuations/), we explored how TVM uses control registers (`c0`, `c1`, `c2`) automatically. In this part of the basics series, we'll see how to manipulate these registers directly using `PUSHCTR` and `POPCTR`, and clarify the crucial difference between the `JMP` and `EXECUTE` families of instructions.
5+
In the [previous article](/spec/doc/book/continuations/diving-deeper-exit-points-of-continuations/), we explored how TVM uses control registers (`c0`, `c1`, `c2`) automatically. In this part of the basics series, we'll see how to manipulate these registers directly using `PUSHCTR` and `POPCTR`, and clarify the crucial difference between the `JMP` and `EXECUTE` families of instructions.
66

77
## Manual register control: PUSHCTR and POPCTR
88

src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
--color-neutral: #8e8e93;
292292
--color-neutral-rgb: 142, 142, 147;
293293
--color-neutral-bg: #3a3a3c;
294-
--color-neutral-bg-hover: #48484a;
294+
--color-neutral-bg-hover: #2f2f30;
295295
--color-neutral-bg-hover-alpha: rgba(var(--color-neutral-rgb), 0.2);
296296
--color-neutral-bg-alpha: rgba(var(--color-neutral-rgb), 0.3);
297297

src/pages/InstructionsPage/InstructionsPage.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,19 @@
183183
margin-left: 0;
184184
}
185185
}
186+
187+
.subCategoryAndDocsContainer {
188+
display: flex;
189+
align-items: flex-start;
190+
justify-content: space-between;
191+
gap: var(--spacing-md);
192+
flex-wrap: wrap;
193+
}
194+
195+
@media (max-width: 768px) {
196+
.subCategoryAndDocsContainer {
197+
flex-direction: column;
198+
align-items: flex-start;
199+
gap: var(--spacing-sm);
200+
}
201+
}

src/pages/InstructionsPage/InstructionsPage.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from "@app/pages/InstructionsPage/settings.ts"
2222

2323
import Footer from "./components/Footer"
24+
import ContinuationsDocsBanner from "./components/ContinuationsDocsBanner/ContinuationsDocsBanner.tsx"
2425

2526
import styles from "./InstructionsPage.module.css"
2627

@@ -259,7 +260,7 @@ function InstructionsPage() {
259260

260261
return (
261262
<div className={styles.traceViewWrapper}>
262-
<PageHeader pageTitle="spec" titleBadgeText="Beta" titleBadgeColor="green">
263+
<PageHeader pageTitle="spec" documentationLink={"/spec/doc/"}>
263264
<div className={styles.mainActionContainer}></div>
264265
</PageHeader>
265266

@@ -293,12 +294,15 @@ function InstructionsPage() {
293294
}}
294295
/>
295296
{subCategories.length > 0 && (
296-
<CategoryTabs
297-
categories={subCategories}
298-
selected={selectedSubCategory}
299-
onSelect={setSelectedSubCategory}
300-
label="Subcategory:"
301-
/>
297+
<div className={styles.subCategoryAndDocsContainer}>
298+
<CategoryTabs
299+
categories={subCategories}
300+
selected={selectedSubCategory}
301+
onSelect={setSelectedSubCategory}
302+
label="Subcategory:"
303+
/>
304+
{selectedCategory === "continuation" && <ContinuationsDocsBanner />}
305+
</div>
302306
)}
303307
</div>
304308
<InstructionTable
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.compactBanner {
2+
padding-top: var(--spacing-lg);
3+
}
4+
5+
.compactContent {
6+
display: inline-flex;
7+
align-items: center;
8+
justify-content: flex-end;
9+
gap: var(--spacing-sm);
10+
flex-wrap: wrap;
11+
padding: var(--spacing-xs) var(--spacing-sm);
12+
border-radius: var(--border-radius-md);
13+
background-color: var(--color-neutral-bg-hover);
14+
color: var(--color-text-primary);
15+
font-weight: var(--font-weight-medium);
16+
font-size: var(--font-size-sm);
17+
}
18+
19+
.labelLink {
20+
color: inherit;
21+
font-weight: inherit;
22+
font-size: inherit;
23+
white-space: nowrap;
24+
text-decoration: none;
25+
cursor: pointer;
26+
transition: opacity 0.2s ease;
27+
}
28+
29+
.labelLink:hover {
30+
opacity: 0.8;
31+
text-decoration: underline;
32+
}
33+
34+
@media (max-width: 1200px) {
35+
.compactBanner {
36+
padding-top: 0;
37+
padding-bottom: var(--spacing-sm);
38+
}
39+
40+
.compactContent {
41+
gap: var(--spacing-xs);
42+
}
43+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from "react"
2+
import {FiBookOpen} from "react-icons/fi"
3+
4+
import styles from "./ContinuationsDocsBanner.module.css"
5+
6+
const ContinuationsDocsBanner: React.FC = () => {
7+
return (
8+
<div className={styles.compactBanner} role="note" aria-label="Documentation suggestion">
9+
<div className={styles.compactContent}>
10+
<FiBookOpen size={14} aria-hidden="true" />
11+
<a
12+
href="/spec/doc/book/continuations/"
13+
target="_blank"
14+
rel="noopener noreferrer"
15+
className={styles.labelLink}
16+
>
17+
Learn more about continuations
18+
</a>
19+
</div>
20+
</div>
21+
)
22+
}
23+
24+
export default ContinuationsDocsBanner

src/shared/ui/PageHeader/PageHeader.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface PageHeaderProps {
1313
readonly children?: React.ReactNode
1414
readonly titleBadgeText?: string
1515
readonly titleBadgeColor?: "green" | "red" | "blue" | "gray"
16+
readonly documentationLink?: string
1617
}
1718

1819
const PageHeaderFc: React.FC<PageHeaderProps> = ({
@@ -21,6 +22,7 @@ const PageHeaderFc: React.FC<PageHeaderProps> = ({
2122
children,
2223
titleBadgeText,
2324
titleBadgeColor = "gray",
25+
documentationLink = "https://docs.ton.org/",
2426
}) => {
2527
const isPlayground = pageTitle === "playground"
2628
const isExplorer = pageTitle === "explorer"
@@ -65,7 +67,7 @@ const PageHeaderFc: React.FC<PageHeaderProps> = ({
6567

6668
<nav className={styles.headerLinks} aria-label="External links">
6769
<a
68-
href="https://docs.ton.org/"
70+
href={documentationLink}
6971
target="_blank"
7072
rel="noopener noreferrer"
7173
title="TON Documentation"

0 commit comments

Comments
 (0)