GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bolt.new changes sync 20241129115435 · aidrivencoder/master-git-github@b32bb1d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • home/project/src
    • app/tutorials/[id]
      • page.tsx
    • components/tutorials
      • CodeBlock.tsx
      • MarkdownContent.tsx
      • ProgressBar.tsx
      • StepNavigation.tsx
      • TutorialViewer.tsx
  • next.config.js
  • package-lock.json
  • package.json
  • src
    • app/tutorials/[id]
      • page.tsx
    • components/tutorials
      • TutorialPage.tsx
    • lib/firebase
      • config
        • index.ts
      • services
        • tutorials.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎home/project/src/app/tutorials/[id]/page.tsx‎

Copy file name to clipboard
+114Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
'use client'
2+
3+
import { useEffect, useState } from 'react'
4+
import { TutorialPage as ClientTutorialPage } from '@/components/tutorials/TutorialPage'
5+
import { getTutorialById } from '@/lib/firebase/services/tutorials'
6+
import { LoadingSpinner } from '@/components/ui/LoadingSpinner'
7+
import Link from 'next/link'
8+
9+
interface TutorialPageProps {
10+
params: { id: string }
11+
}
12+
13+
function LoadingState() {
14+
return (
15+
<div className="min-h-screen flex items-center justify-center bg-white dark:bg-gray-900">
16+
<LoadingSpinner size="lg" />
17+
</div>
18+
)
19+
}
20+
21+
interface ErrorStateProps {
22+
message: string;
23+
onRetry: () => void;
24+
}
25+
26+
function ErrorState({ message, onRetry }: ErrorStateProps) {
27+
return (
28+
<div className="min-h-screen bg-white dark:bg-gray-900">
29+
<div className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
30+
<div className="px-4 py-6 sm:px-0">
31+
<div className="text-center">
32+
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
33+
Error Loading Tutorial
34+
</h2>
35+
<p className="text-red-600 dark:text-red-400">{message}</p>
36+
<button
37+
onClick={onRetry}
38+
className="mt-4 px-4 py-2 bg-primary-600 dark:bg-primary-500 text-white rounded-md hover:bg-primary-700 dark:hover:bg-primary-600 transition-colors"
39+
>
40+
Try Again
41+
</button>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
)
47+
}
48+
49+
function NotFoundState() {
50+
return (
51+
<div className="min-h-screen bg-white dark:bg-gray-900">
52+
<div className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
53+
<div className="px-4 py-6 sm:px-0">
54+
<div className="text-center">
55+
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
56+
Tutorial Not Found
57+
</h2>
58+
<p className="text-gray-600 dark:text-gray-400 mb-4">
59+
The tutorial you're looking for doesn't exist or has been removed.
60+
</p>
61+
<Link
62+
href="/tutorials"
63+
className="inline-block px-4 py-2 bg-primary-600 dark:bg-primary-500 text-white rounded-md hover:bg-primary-700 dark:hover:bg-primary-600 transition-colors"
64+
>
65+
Back to Tutorials
66+
</Link>
67+
</div>
68+
</div>
69+
</div>
70+
</div>
71+
)
72+
}
73+
74+
export default function TutorialPage({ params }: TutorialPageProps) {
75+
const [tutorial, setTutorial] = useState(null)
76+
const [loading, setLoading] = useState(true)
77+
const [error, setError] = useState(null)
78+
79+
const fetchTutorial = async () => {
80+
setLoading(true)
81+
setError(null)
82+
try {
83+
const fetchedTutorial = await getTutorialById(params.id)
84+
setTutorial(fetchedTutorial)
85+
} catch (err) {
86+
setError('Failed to load tutorial')
87+
console.error('Error fetching tutorial:', err)
88+
} finally {
89+
setLoading(false)
90+
}
91+
}
92+
93+
useEffect(() => {
94+
fetchTutorial()
95+
}, [params.id])
96+
97+
if (loading) {
98+
return <LoadingState />
99+
}
100+
101+
if (error) {
102+
return <ErrorState message={error} onRetry={fetchTutorial} />
103+
}
104+
105+
if (!tutorial) {
106+
return <NotFoundState />
107+
}
108+
109+
return (
110+
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
111+
<ClientTutorialPage tutorial={tutorial} />
112+
</div>
113+
)
114+
}
Collapse file

‎home/project/src/components/tutorials/CodeBlock.tsx‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
2+
import { tomorrow } from 'react-syntax-highlighter/dist/cjs/styles/prism'
3+
4+
interface CodeBlockProps {
5+
code: string
6+
language: string
7+
}
8+
9+
export function CodeBlock({ code, language }: CodeBlockProps) {
10+
return (
11+
<div className="rounded-lg overflow-hidden my-4 bg-gray-900 dark:bg-gray-800">
12+
<div className="flex items-center justify-between px-4 py-2 bg-gray-800 dark:bg-gray-700">
13+
<span className="text-xs font-mono text-gray-400">{language}</span>
14+
</div>
15+
<SyntaxHighlighter
16+
language={language}
17+
style={tomorrow}
18+
customStyle={{
19+
margin: 0,
20+
padding: '1.5rem',
21+
backgroundColor: 'transparent',
22+
fontSize: '0.875rem',
23+
lineHeight: '1.5'
24+
}}
25+
>
26+
{code}
27+
</SyntaxHighlighter>
28+
</div>
29+
)
30+
}
Collapse file

‎home/project/src/components/tutorials/MarkdownContent.tsx‎

Copy file name to clipboard
+50Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import dynamic from 'next/dynamic'
2+
import '@uiw/react-markdown-preview/markdown.css'
3+
import { CodeBlock } from './CodeBlock'
4+
5+
const MarkdownPreview = dynamic(
6+
() => import('@uiw/react-markdown-preview'),
7+
{ ssr: false }
8+
)
9+
10+
interface MarkdownContentProps {
11+
content: string
12+
}
13+
14+
export function MarkdownContent({ content }: MarkdownContentProps) {
15+
return (
16+
<div className="prose prose-lg dark:prose-invert max-w-none p-6">
17+
<MarkdownPreview
18+
source={content}
19+
wrapperElement={{
20+
"data-color-mode": "auto"
21+
}}
22+
components={{
23+
code: ({ inline, children = '', className }) => {
24+
if (inline) {
25+
return (
26+
<code className="bg-gray-100 dark:bg-gray-800 px-1 py-0.5 rounded text-sm">
27+
{children}
28+
</code>
29+
)
30+
}
31+
32+
const language = className?.replace(/language-/, '') || 'text'
33+
const code = Array.isArray(children) ? children.join('') : children.toString()
34+
35+
return (
36+
<CodeBlock
37+
code={code.replace(/\n$/, '')}
38+
language={language}
39+
/>
40+
)
41+
}
42+
}}
43+
style={{
44+
backgroundColor: 'transparent',
45+
padding: '1.5rem'
46+
}}
47+
/>
48+
</div>
49+
)
50+
}
Collapse file

‎home/project/src/components/tutorials/ProgressBar.tsx‎

Copy file name to clipboard
+66Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
interface ProgressBarProps {
2+
currentStep: number
3+
totalSteps: number
4+
completedSteps: string[]
5+
onStepClick?: (step: number) => void
6+
}
7+
8+
export function ProgressBar({
9+
currentStep,
10+
totalSteps,
11+
completedSteps,
12+
onStepClick
13+
}: ProgressBarProps) {
14+
const progress = Math.min((completedSteps.length / totalSteps) * 100, 100)
15+
16+
return (
17+
<div className="relative pt-1">
18+
<div className="flex mb-2 items-center justify-between">
19+
<div>
20+
<span className="text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-primary-600 bg-primary-200 dark:text-primary-200 dark:bg-primary-900">
21+
Progress
22+
</span>
23+
</div>
24+
<div className="text-right">
25+
<span className="text-xs font-semibold inline-block text-primary-600 dark:text-primary-400">
26+
{Math.round(progress)}%
27+
</span>
28+
</div>
29+
</div>
30+
31+
<div className="flex h-2 mb-4 overflow-hidden bg-primary-200 rounded dark:bg-primary-900 transition-all duration-300">
32+
<div
33+
style={{ width: `${progress}%` }}
34+
className="flex flex-col justify-center overflow-hidden bg-primary-500 dark:bg-primary-600 transition-all duration-300"
35+
/>
36+
</div>
37+
38+
<div className="flex justify-between">
39+
{Array.from({ length: totalSteps }).map((_, index) => {
40+
const isCompleted = completedSteps.includes(`step-${index + 1}`)
41+
const isCurrent = index === currentStep
42+
43+
return (
44+
<button
45+
key={index}
46+
onClick={() => onStepClick?.(index)}
47+
disabled={!isCompleted && index > currentStep}
48+
className={`w-4 h-4 rounded-full transition-all duration-300 ${
49+
isCompleted
50+
? 'bg-primary-500 dark:bg-primary-600'
51+
: isCurrent
52+
? 'bg-primary-400 dark:bg-primary-500'
53+
: 'bg-primary-200 dark:bg-primary-900'
54+
} ${
55+
!isCompleted && index > currentStep
56+
? 'cursor-not-allowed opacity-50'
57+
: 'cursor-pointer hover:ring-2 hover:ring-primary-400 dark:hover:ring-primary-500'
58+
}`}
59+
aria-label={`Go to step ${index + 1}`}
60+
/>
61+
)
62+
})}
63+
</div>
64+
</div>
65+
)
66+
}
Collapse file

‎home/project/src/components/tutorials/StepNavigation.tsx‎

Copy file name to clipboard
+56Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use client'
2+
3+
interface StepNavigationProps {
4+
currentStep: number
5+
totalSteps: number
6+
onNext: () => void
7+
onPrevious: () => void
8+
loading?: boolean
9+
isStepCompleted?: boolean
10+
}
11+
12+
export function StepNavigation({
13+
currentStep,
14+
totalSteps,
15+
onNext,
16+
onPrevious,
17+
loading = false,
18+
isStepCompleted = false
19+
}: StepNavigationProps) {
20+
const isFirstStep = currentStep === 0
21+
const isLastStep = currentStep === totalSteps - 1
22+
23+
return (
24+
<div className="flex justify-between mt-8">
25+
<button
26+
onClick={onPrevious}
27+
disabled={isFirstStep || loading}
28+
className="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
29+
>
30+
Previous
31+
</button>
32+
33+
<div className="flex items-center space-x-2">
34+
{!isLastStep && (
35+
<button
36+
onClick={onNext}
37+
disabled={loading || !isStepCompleted}
38+
className="px-4 py-2 text-sm font-medium text-white bg-primary-600 dark:bg-primary-500 border border-transparent rounded-md hover:bg-primary-700 dark:hover:bg-primary-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
39+
>
40+
Next Step
41+
</button>
42+
)}
43+
44+
{isLastStep && isStepCompleted && (
45+
<button
46+
onClick={onNext}
47+
disabled={loading}
48+
className="px-4 py-2 text-sm font-medium text-white bg-green-600 dark:bg-green-500 border border-transparent rounded-md hover:bg-green-700 dark:hover:bg-green-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
49+
>
50+
Complete Tutorial
51+
</button>
52+
)}
53+
</div>
54+
</div>
55+
)
56+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.