Skip to content

Commit 988c141

Browse files
authored
refactor: tutorials section (#461)
* refactor: tutorials section * refactor: remove old tutorial section * chore: fix relative link * chore: revert relative path and add ignore pattern * fix: pattern * fix: link attempt 2 * refactor: remove ideas
1 parent 90c8c7d commit 988c141

File tree

9 files changed

+138
-121
lines changed

9 files changed

+138
-121
lines changed

.github/workflows/mlc_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
},
3939
{
4040
"pattern": "^https?://metamask.io"
41-
}
41+
},
42+
{
43+
"pattern": "^/tutorials/"
44+
},
4245
]
4346
}

docs/intro/tutorials-examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1212

1313
## Tutorials
1414

15-
Ready to dive deeper into ink! development? Check out our [tutorials](/tutorials) that will guide you through building real-world decentralised applications step by step.
15+
Ready to dive deeper into ink! development? Check out our [tutorials](/tutorials/overview) that will guide you through building real-world decentralised applications step by step.
1616

1717
### Contribute a Tutorial
1818

1919
Have you built something awesome with ink!? We'd love to feature your tutorial!
2020

2121
**Help the community learn by contributing your own tutorial.** Whether it's a unique use case, an innovative pattern, or a step-by-step guide for beginners, your contribution makes a difference.
2222

23-
[Learn how to contribute tutorials →](https://github.com/use-ink/ink-alliance/tree/main/tutorials)
23+
[Learn how to contribute tutorials →](/tutorials/guide)
2424

2525
## Smart Contract Examples
2626

docusaurus.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ module.exports = {
121121
},
122122
],
123123
plugins: [
124+
[
125+
'@docusaurus/plugin-content-docs',
126+
{
127+
id: 'tutorials',
128+
path: 'tutorials',
129+
routeBasePath: 'tutorials',
130+
sidebarPath: require.resolve('./tutorials/sidebar.js'),
131+
showLastUpdateAuthor: true,
132+
showLastUpdateTime: true,
133+
editUrl: 'https://github.com/use-ink/ink-docs/edit/master/',
134+
},
135+
],
124136
[
125137
'@docusaurus/plugin-client-redirects',
126138
{

src/pages/tutorials.tsx

Lines changed: 10 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,15 @@
11
import React from 'react'
2-
import Layout from './layout'
3-
import { ArrowCircleDown } from '@phosphor-icons/react/dist/ssr'
4-
import { tutorials } from '../data/tutorials'
5-
import { TutorialCard } from '../components/tutorials/tutorial-card'
6-
import { motion } from 'motion/react'
7-
8-
import Rocket from '@site/static/img/rocket.svg'
9-
import { Button } from '../components/ui/button'
10-
import Link from '@docusaurus/Link'
11-
import useBaseUrl from '@docusaurus/useBaseUrl'
12-
import { StarryBackground } from '../components/starry-background'
13-
import { useCurrentVersion } from '../hooks/use-current-version'
14-
const head = (
15-
<>
16-
<title>Tutorials | ink!</title>
17-
<meta
18-
name="description"
19-
content="Access tutorials to help you get started with ink! smart contracts and deploy them on Polkadot and beyond."
20-
/>
21-
<meta name="keywords" content="tutorials, learning, ink!, guides, Polkadot" />
22-
<meta name="author" content="ink! Alliance" />
23-
<meta property="og:title" content="Tutorials | ink!" />
24-
<meta
25-
property="og:description"
26-
content="Access tutorials to help you get started with ink! smart contracts and deploy them on Polkadot and beyond."
27-
/>
28-
<meta property="og:image" content="https://use-ink.com/img/opengraph-home.png" />
29-
<meta property="og:url" content="https://use-ink.com" />
30-
<meta property="og:type" content="website" />
31-
<meta property="og:site_name" content="ink!" />
32-
<meta property="og:locale" content="en_US" />
33-
<meta property="og:image:width" content="1200" />
34-
<meta property="og:image:height" content="630" />
35-
<meta property="og:image:alt" content="ink! logo" />
36-
<meta property="og:image:type" content="image/png" />
37-
</>
38-
)
39-
40-
export default function PageTutorials() {
41-
const currentVersion = useCurrentVersion()
42-
const versionedTutorials = tutorials.map((tutorial) => {
43-
return {
44-
...tutorial,
45-
link: tutorial.link.replace('docs/', `docs/${currentVersion?.label ?? 'v5'}/`),
46-
}
47-
})
2+
import { Redirect } from '@docusaurus/router'
3+
import Head from '@docusaurus/Head'
484

5+
export default function TutorialsRedirect() {
496
return (
50-
<Layout className="container overflow-hidden" head={head}>
51-
<div
52-
style={{
53-
width: '100vw',
54-
height: '200vh',
55-
position: 'absolute',
56-
top: 0,
57-
left: 0,
58-
zIndex: -1,
59-
overflow: 'hidden',
60-
}}
61-
>
62-
<StarryBackground />
63-
</div>
64-
<div className="flex flex-col items-center justify-center max-w-[540px] mx-auto text-center mt-[10vh]">
65-
<img
66-
src={useBaseUrl('/img/Constellation.svg')}
67-
alt="constellation"
68-
className="w-[246px] h-[246px] lg:w-[450px] lg:h-[450px] absolute left-[2vw] lg:left-[18vw] top-10"
69-
/>
70-
<motion.div
71-
className="w-[246px] h-[246px] rotate-[25deg]"
72-
initial={{ opacity: 0, scale: 0.7, translateY: 200, translateX: -100, rotate: 30 }}
73-
animate={{ opacity: 1, scale: 1, translateY: 0, translateX: 0, rotate: 25 }}
74-
transition={{
75-
duration: 1,
76-
opacity: { visualDuration: 0.1 },
77-
translateY: { type: 'spring', visualDuration: 0.9, bounce: 0.5 },
78-
translateX: { type: 'spring', visualDuration: 0.9, bounce: 0.5 },
79-
rotate: { type: 'tween', duration: 2 },
80-
}}
81-
>
82-
<Rocket style={{ filter: 'drop-shadow(0 10px 10px #0005' }} className="w-full h-full animate-float" />
83-
</motion.div>
84-
<motion.div
85-
initial={{ opacity: 0, translateY: 100 }}
86-
animate={{ opacity: 1, translateY: 0 }}
87-
transition={{ duration: 1.5 }}
88-
>
89-
<h1 className="font-bold text-[64px]">ink! Tutorials</h1>
90-
</motion.div>
91-
<motion.div
92-
initial={{ opacity: 0, translateY: 100 }}
93-
animate={{ opacity: 1, translateY: 0 }}
94-
transition={{ duration: 1.2, delay: 0.4 }}
95-
>
96-
<p className="text-[18px] font-semibold">
97-
Explore step-by-step tutorials and learn how to build a dApp with ink! smart contracts.
98-
</p>
99-
</motion.div>
100-
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 1, delay: 1 }}>
101-
<a href="#tutorials" className="scroll-m-60">
102-
<ArrowCircleDown size={32} weight="duotone" fill="rgb(140, 124, 247)" />
103-
</a>
104-
</motion.div>
105-
</div>
106-
<section id="tutorials" className="flex flex-col items-center justify-center max-w-[900px] mx-auto pt-20">
107-
<div className="grid grid-cols-1 gap-[36px] md:grid-cols-2">
108-
{versionedTutorials.map((tutorial) => (
109-
<TutorialCard key={tutorial.title} {...tutorial} />
110-
))}
111-
</div>
112-
<div className="flex flex-col items-center justify-center gap-4 my-16 md:flex-row">
113-
<p className="m-0">Do you have an idea or need for a tutorial?</p>
114-
<Link href="https://t.me/inkathon" className="text-blue-500">
115-
<Button size="lg" variant="secondary">
116-
Request a topic
117-
</Button>
118-
</Link>
119-
</div>
120-
</section>
121-
</Layout>
7+
<>
8+
<Head>
9+
<link rel="canonical" href={'https://use.ink/tutorials/guide'} />
10+
<meta name="robots" content="noindex, follow" />
11+
</Head>
12+
<Redirect to={'/tutorials/guide'} />
13+
</>
12214
)
12315
}

tutorials/guide.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Guide
3+
sidebar_position: 1
4+
---
5+
6+
Welcome to the ink! tutorial contribution guide. We're excited to have you share your knowledge with the community!
7+
8+
### Why Contribute?
9+
10+
By contributing a tutorial you're helping other developers learn to build with ink! and get rewarded for your work. In this way we hope to build a thriving developer community where people get recognized for their work.
11+
12+
### How to Contribute
13+
14+
1. **Choose a Topic**: Check out the list of tutorial [ideas](ideas.md) for inspiration, suggest an idea by [submitting a PR](https://github.com/use-ink/ink-docs/edit/main/tutorials/ideas.md), or start right away!
15+
2. **Follow the Template**: Use the provided [template](template) to structure your tutorial. This ensures consistency and ensures a certain level of quality that is required.
16+
3. **Write Your Tutorial**: Create your tutorial and submit a pull request to this repository. Check out this example of how to add a tutorial (TODO: add link to tutorial added).
17+
18+
### Reward System
19+
20+
Each accepted tutorial will be rewarded with a fixed amount of **$100**. This initiative is new to the ink! Alliance, and we're very much looking for feedback on whether this reward is incentivizing enough. Please share your feedback in our [community channel](https://t.me/inkathon/2357)!
21+
22+
### Guidelines
23+
24+
- Keep the language simple and concise.
25+
- Include code examples where appropriate.
26+
- Include images to create a fun experience!
27+
- Make sure to test any code snippets to ensure they work.
28+
29+
### Questions?
30+
31+
For any questions, refer to the [Ink Alliance Telegram](https://t.me/inkathon/2357) or open an issue in this repository.
32+
33+
Thank you for your contribution!

tutorials/ideas.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Ideas
3+
sidebar_position: 2
4+
---
5+
6+
**Do you have good idea for a tutorial?** [Add it to the list!](https://github.com/use-ink/ink-docs/edit/main/tutorials/ideas.md)
7+
8+
- **Writing Your First Smart Contract**
9+
Step-by-step instructions on creating a simple ink! contract, explaining key concepts like storage and messages.
10+
11+
- **Cross Contract Calling**
12+
This tutorial covers the multiple syntax options for calling one contract from another, their workflows, and best practices, with examples to clarify setup, execution, and common pitfalls.
13+
14+
- **Ink! and XCM**
15+
An introduction to using ink! with Cross-Consensus Messaging (XCM) for cross-chain interactions, based on [ink!'s XCM basics](https://use.ink/basics/xcm). Covers what XCM is, how ink! contracts can send or receive XCM messages, and a simple example of cross-chain communication.
16+
17+
- **Using Papi with ink! Smart Contracts**
18+
Guide the developer how to integrate Papi (Polkadot API) with ink! smart contracts. This tutorial covers setup, basic usage, and an example.
19+
20+
- **Using Dedot with ink! Smart Contracts**
21+
Guide the developer how to integrate Dedot with ink! smart contracts. This tutorial covers setup, basic usage, and an example.
22+
23+
- **Using Subxt to Interact with ink! Smart Contracts**
24+
Guide the developer how to integrate Subxt with ink! smart contracts. This tutorial covers setup, basic usage, and an example.
25+

tutorials/overview.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Overview
3+
sidebar_position: 1
4+
---
5+
6+
Welcome to the ink! tutorials! These resources are here to help you create decentralized applications (dApps) using ink! smart contracts. Whether you’re just starting with your first contract or working on connecting it to a full-stack dApp, these tutorials will walk you through each step.
7+
8+
If you want to make a tutorial, take a look at our [contribution guide](./guide.md)!
9+
10+
We’re excited to have you here, happy learning :)

tutorials/sidebar.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
tutorials: [
3+
'overview',
4+
{
5+
type: 'category',
6+
label: 'Contribute',
7+
items: [
8+
'guide',
9+
'ideas',
10+
'template',
11+
],
12+
},
13+
],
14+
}

tutorials/template.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Template
3+
sidebar_position: 3
4+
---
5+
6+
*Feel free to add more sections or adjust as needed for your tutorial!*
7+
8+
---
9+
### Tutorial Title
10+
11+
What is this tutorial about? What will the reader learn?
12+
13+
### Prerequisites
14+
15+
What should the reader know or have before starting?
16+
17+
### Body
18+
19+
Describe the first step. Include code, explanations, or images as needed.
20+
Describe the next step. Add more steps as needed.
21+
22+
### Conclusion
23+
24+
Summarize the key takeaways from the tutorial. Suggest next steps, further reading, or related tutorials.
25+
26+
### Author _(optional)_
27+
28+
Write a short bio and link to your profile, blog, or project.

0 commit comments

Comments
 (0)