Skip to content

Commit d300821

Browse files
Copilot0xrinegade
andcommitted
feat: Separate Tutorials and Docs pages with cross-navigation
Co-authored-by: 0xrinegade <[email protected]>
1 parent c0a430b commit d300821

File tree

5 files changed

+905
-1602
lines changed

5 files changed

+905
-1602
lines changed

website/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import './index.css'
22
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
33
import { LandingPage } from './pages/LandingPage'
44
import { DocsPage } from './pages/DocsPage'
5+
import { TutorialsPage } from './pages/TutorialsPage'
56
import { DemoPage } from './pages/DemoPage'
67
import { ExamplesPage } from './pages/ExamplesPage'
78
import { PricingPage } from './pages/PricingPage'
@@ -24,6 +25,7 @@ function App() {
2425
<Routes>
2526
<Route path="/" element={<LandingPage />} />
2627
<Route path="/docs/*" element={<DocsPage />} />
28+
<Route path="/tutorials/*" element={<TutorialsPage />} />
2729
<Route path="/demo" element={<DemoPage />} />
2830
<Route path="/examples" element={<ExamplesPage />} />
2931
<Route path="/pricing" element={<PricingPage />} />

website/src/components/Navigation.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link, useLocation } from 'react-router-dom'
22
import { motion } from 'framer-motion'
3-
import { Book, PlayCircle, Home, Menu, X } from 'lucide-react'
3+
import { Book, PlayCircle, Home, Menu, X, Code } from 'lucide-react'
44
import { useState } from 'react'
55

66
export function Navigation() {
@@ -9,7 +9,8 @@ export function Navigation() {
99

1010
const navigation = [
1111
{ name: 'Home', href: '/', icon: Home },
12-
{ name: 'Documentation', href: '/docs', icon: Book },
12+
{ name: 'Documentation', href: '/docs', icon: Code },
13+
{ name: 'Tutorials', href: '/tutorials', icon: Book },
1314
{ name: 'Demo', href: '/demo', icon: PlayCircle },
1415
]
1516

@@ -29,7 +30,8 @@ export function Navigation() {
2930
<div className="hidden md:flex items-center space-x-8">
3031
{navigation.map((item) => {
3132
const isActive = location.pathname === item.href ||
32-
(item.href === '/docs' && location.pathname.startsWith('/docs'))
33+
(item.href === '/docs' && location.pathname.startsWith('/docs')) ||
34+
(item.href === '/tutorials' && location.pathname.startsWith('/tutorials'))
3335
return (
3436
<Link
3537
key={item.name}
@@ -76,7 +78,8 @@ export function Navigation() {
7678
>
7779
{navigation.map((item) => {
7880
const isActive = location.pathname === item.href ||
79-
(item.href === '/docs' && location.pathname.startsWith('/docs'))
81+
(item.href === '/docs' && location.pathname.startsWith('/docs')) ||
82+
(item.href === '/tutorials' && location.pathname.startsWith('/tutorials'))
8083
return (
8184
<Link
8285
key={item.name}

website/src/components/TutorialSections.tsx

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,85 @@
11
import { motion } from 'framer-motion'
22

3+
// E-commerce Tutorials
4+
export function EcommerceTutorials() {
5+
const tutorials = [
6+
{
7+
title: "Online Store Integration",
8+
description: "Complete e-commerce store with Solana payments",
9+
level: "Beginner",
10+
time: "30 minutes",
11+
code: `// E-commerce checkout with SVM-Pay
12+
import { SVMPay, PaymentForm } from '@svm-pay/sdk'
13+
14+
const EcommerceCheckout = ({ cartItems, total }) => {
15+
const handlePayment = async (paymentData) => {
16+
const payment = SVMPay.createPayment({
17+
recipient: process.env.STORE_WALLET,
18+
amount: total,
19+
token: 'USDC',
20+
metadata: {
21+
orderId: generateOrderId(),
22+
items: cartItems,
23+
customerEmail: paymentData.email
24+
}
25+
})
26+
27+
const result = await payment.execute()
28+
29+
if (result.status === 'SUCCESS') {
30+
// Update inventory
31+
await updateInventory(cartItems)
32+
// Send confirmation email
33+
await sendOrderConfirmation(paymentData.email, result.transactionId)
34+
// Redirect to success page
35+
router.push('/order-success')
36+
}
37+
}
38+
39+
return <PaymentForm onSubmit={handlePayment} amount={total} />
40+
}`
41+
}
42+
]
43+
44+
return (
45+
<div className="pt-20 p-8 max-w-6xl">
46+
<motion.div
47+
initial={{ opacity: 0, y: 20 }}
48+
animate={{ opacity: 1, y: 0 }}
49+
transition={{ duration: 0.5 }}
50+
>
51+
<h1 className="text-4xl font-bold text-slate-900 mb-6">E-commerce Tutorials</h1>
52+
<p className="text-xl text-slate-600 mb-8">
53+
Build sophisticated e-commerce solutions with Solana payments
54+
</p>
55+
56+
<div className="space-y-8">
57+
{tutorials.map((tutorial, index) => (
58+
<div key={index} className="bg-white border border-slate-200 rounded-lg p-6">
59+
<div className="flex items-start justify-between mb-4">
60+
<div>
61+
<h3 className="text-xl font-semibold text-slate-900 mb-2">{tutorial.title}</h3>
62+
<p className="text-slate-600 mb-2">{tutorial.description}</p>
63+
<div className="flex space-x-4 text-sm text-slate-500">
64+
<span>Level: {tutorial.level}</span>
65+
<span>Time: {tutorial.time}</span>
66+
</div>
67+
</div>
68+
</div>
69+
70+
<div className="bg-slate-900 rounded-lg p-4">
71+
<pre className="text-sm text-slate-100 overflow-x-auto">
72+
<code>{tutorial.code}</code>
73+
</pre>
74+
</div>
75+
</div>
76+
))}
77+
</div>
78+
</motion.div>
79+
</div>
80+
)
81+
}
82+
383
// Gaming & NFT Tutorials
484
export function GamingTutorials() {
585
const tutorials = [

0 commit comments

Comments
 (0)