Skip to content

Commit 60f8891

Browse files
authored
[FEAT] client migration vocs (#190)
* feat: initialize project structure with essential configuration files and documentation * Add design system, global styles, and partner logos - Introduced a comprehensive design system including design tokens, theme configuration, and global styles for Dojo by Example. - Added a new SVG logo for Torii in the partners directory. - Established a color palette with brand and semantic colors. - Implemented typography and spacing scales for consistent styling. - Enabled automatic dark/light mode switching in the design system. - Created utility classes for common styles and animations. - Configured theme settings in TypeScript for easy access to design tokens. - Documented the design system structure and usage in README files. * Refactor code structure for improved readability and maintainability * feat: enhance project setup with Tailwind CSS, Vocs configuration, and improved documentation structure * feat: implement dynamic sidebar configuration and add navigation components for improved user experience * feat: add CTA, Features, Hero, and Stats components with responsive design and improved structure * Add comprehensive guides for React integration with Dojo - Introduced `main.md` detailing the initialization process of Dojo React applications, including SDK setup, provider hierarchy, and error handling. - Created `manifest.md` to explain the deployment-specific contract information management across different networks. - Developed `overview.md` summarizing the key concepts and benefits of integrating Dojo with React for onchain game development. - Added `starknet-provider.md` outlining the configuration of the Starknet provider for seamless blockchain interactions in React applications. - Initiated `unity.mdx` for future Unity integration documentation. - Established `api.mdx` as a reference for Dojo Engine APIs and interfaces. - Compiled `cli.mdx` for a complete reference of Dojo CLI commands. - Documented `config.mdx` for project and network configuration guidelines. - Created `troubleshooting.mdx` to address common issues and solutions when working with Dojo Engine. * feat: Add MDX components for enhanced documentation experience - Introduced new MDX components including Callout, CodeBlock, Demo, Playground, Steps, Tabs, Terminal, and FileTree for better content presentation. - Implemented Callout component variations (Info, Warning, Error, Success, Tip) for contextual messaging. - Added CodeBlock component with syntax highlighting and line number options. - Created Steps component for step-by-step instructions with optional completion tracking. - Developed Tabs component for organizing content into tabbed sections. - Integrated Terminal and Command components for simulating command-line interactions. - Included FileTree component for visual representation of file structures. - Updated routes to include a reference page for MDX components. - Documented usage examples in the new MDX components reference page. * feat: Add utility components and enhance error handling with ErrorBoundary and loading states * feat: Add Vercel configuration and enhance package scripts for deployment
1 parent 2c6468a commit 60f8891

95 files changed

Lines changed: 17636 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client-new/.gitignore

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Dependencies
2+
node_modules/
3+
.pnp
4+
.pnp.js
5+
6+
# Build outputs
7+
dist/
8+
.vocs/
9+
build/
10+
out/
11+
12+
# Environment variables
13+
.env
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
# Logs
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
pnpm-debug.log*
24+
lerna-debug.log*
25+
26+
# OS files
27+
.DS_Store
28+
Thumbs.db
29+
30+
# Editor directories and files
31+
.vscode/*
32+
!.vscode/extensions.json
33+
.idea
34+
*.suo
35+
*.ntvs*
36+
*.njsproj
37+
*.sln
38+
*.sw?
39+
40+
# TypeScript
41+
*.tsbuildinfo
42+
43+
# Testing
44+
coverage/
45+
.nyc_output
46+
47+
# Misc
48+
*.log
49+
.cache
50+
.parcel-cache
51+
.vercel
52+
.turbo
53+
54+
# Temporary files
55+
*.tmp
56+
*.temp
57+
.tmp/
58+
.temp/

client-new/components/CTA.tsx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { ReactNode } from 'react'
2+
3+
interface CTAProps {
4+
title: string
5+
description?: string
6+
children?: ReactNode
7+
variant?: 'default' | 'gradient'
8+
}
9+
10+
export function CTA({ title, description, children, variant = 'default' }: CTAProps) {
11+
const bgClass = variant === 'gradient'
12+
? 'bg-gradient-to-r from-dojo-primary to-dojo-light'
13+
: 'bg-surface border border-dojo-primary/20'
14+
15+
const textClass = variant === 'gradient'
16+
? 'text-white'
17+
: 'text-text-primary'
18+
19+
const descClass = variant === 'gradient'
20+
? 'text-white/90'
21+
: 'text-text-secondary'
22+
23+
return (
24+
<section className="py-16 md:py-24">
25+
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
26+
<div className={`${bgClass} rounded-2xl p-8 md:p-12 text-center`}>
27+
<h2 className={`text-3xl md:text-4xl font-bold ${textClass} mb-4`}>
28+
{title}
29+
</h2>
30+
{description && (
31+
<p className={`text-lg ${descClass} mb-8 max-w-2xl mx-auto`}>
32+
{description}
33+
</p>
34+
)}
35+
{children && (
36+
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
37+
{children}
38+
</div>
39+
)}
40+
</div>
41+
</div>
42+
</section>
43+
)
44+
}
45+
46+
interface CTAButtonProps {
47+
href: string
48+
children: ReactNode
49+
variant?: 'primary' | 'white'
50+
external?: boolean
51+
}
52+
53+
export function CTAButton({ href, children, variant = 'primary', external = false }: CTAButtonProps) {
54+
const className = variant === 'white'
55+
? 'inline-flex items-center px-6 py-3 rounded-lg bg-white text-dojo-primary font-semibold hover:bg-gray-100 transition-colors shadow-lg'
56+
: 'inline-flex items-center px-6 py-3 rounded-lg bg-dojo-primary text-white font-semibold hover:bg-dojo-hover transition-colors shadow-lg'
57+
58+
const content = (
59+
<>
60+
{children}
61+
<span className="ml-2"></span>
62+
</>
63+
)
64+
65+
if (external) {
66+
return (
67+
<a
68+
href={href}
69+
target="_blank"
70+
rel="noopener noreferrer"
71+
className={className}
72+
>
73+
{content}
74+
</a>
75+
)
76+
}
77+
78+
return (
79+
<a href={href} className={className}>
80+
{content}
81+
</a>
82+
)
83+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import React from 'react'
2+
3+
interface ErrorBoundaryState {
4+
hasError: boolean
5+
error?: Error
6+
}
7+
8+
interface ErrorBoundaryProps {
9+
children: React.ReactNode
10+
fallback?: React.ComponentType<{ error?: Error; resetError?: () => void }>
11+
}
12+
13+
class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
14+
constructor(props: ErrorBoundaryProps) {
15+
super(props)
16+
this.state = { hasError: false }
17+
}
18+
19+
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
20+
return { hasError: true, error }
21+
}
22+
23+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
24+
console.error('ErrorBoundary caught an error:', error, errorInfo)
25+
}
26+
27+
resetError = () => {
28+
this.setState({ hasError: false, error: undefined })
29+
}
30+
31+
render() {
32+
if (this.state.hasError) {
33+
const FallbackComponent = this.props.fallback || DefaultErrorFallback
34+
return <FallbackComponent error={this.state.error} resetError={this.resetError} />
35+
}
36+
37+
return this.props.children
38+
}
39+
}
40+
41+
interface ErrorFallbackProps {
42+
error?: Error
43+
resetError?: () => void
44+
}
45+
46+
function DefaultErrorFallback({ error, resetError }: ErrorFallbackProps) {
47+
return (
48+
<div className="flex flex-col items-center justify-center min-h-[400px] p-8 text-center">
49+
<div className="max-w-md mx-auto">
50+
<div className="text-6xl mb-4">⚠️</div>
51+
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
52+
Something went wrong
53+
</h2>
54+
<p className="text-gray-600 dark:text-gray-400 mb-6">
55+
We encountered an unexpected error. This has been logged and we'll look into it.
56+
</p>
57+
58+
{error && (
59+
<details className="mb-6 text-left">
60+
<summary className="cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
61+
Error details
62+
</summary>
63+
<pre className="mt-2 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto">
64+
{error.message}
65+
</pre>
66+
</details>
67+
)}
68+
69+
<div className="space-x-4">
70+
{resetError && (
71+
<button
72+
onClick={resetError}
73+
className="px-4 py-2 bg-[#ff3000] text-white rounded hover:bg-[#e02900] transition-colors"
74+
>
75+
Try again
76+
</button>
77+
)}
78+
<button
79+
onClick={() => window.location.reload()}
80+
className="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
81+
>
82+
Reload page
83+
</button>
84+
</div>
85+
</div>
86+
</div>
87+
)
88+
}
89+
90+
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorFallbackProps }

client-new/components/Features.tsx

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import { ReactNode } from 'react'
2+
3+
interface Feature {
4+
icon: string | ReactNode
5+
title: string
6+
description: string
7+
href?: string
8+
}
9+
10+
interface FeaturesProps {
11+
title?: string
12+
subtitle?: string
13+
features: Feature[]
14+
columns?: 2 | 3 | 4
15+
}
16+
17+
export function Features({ title, subtitle, features, columns = 3 }: FeaturesProps) {
18+
const gridCols = {
19+
2: 'grid-cols-1 md:grid-cols-2',
20+
3: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
21+
4: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-4',
22+
}
23+
24+
return (
25+
<section className="py-16 md:py-24">
26+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
27+
{(title || subtitle) && (
28+
<div className="text-center mb-12">
29+
{subtitle && (
30+
<p className="text-dojo-primary font-semibold text-sm md:text-base uppercase tracking-wide mb-3">
31+
{subtitle}
32+
</p>
33+
)}
34+
{title && (
35+
<h2 className="text-3xl md:text-4xl font-bold text-text-primary">
36+
{title}
37+
</h2>
38+
)}
39+
</div>
40+
)}
41+
42+
<div className={`grid ${gridCols[columns]} gap-8`}>
43+
{features.map((feature, index) => (
44+
<FeatureCard key={index} {...feature} />
45+
))}
46+
</div>
47+
</div>
48+
</section>
49+
)
50+
}
51+
52+
interface FeatureCardProps extends Feature {}
53+
54+
export function FeatureCard({ icon, title, description, href }: FeatureCardProps) {
55+
const content = (
56+
<>
57+
<div className="flex items-center justify-center w-12 h-12 rounded-lg bg-dojo-primary/10 text-dojo-primary text-2xl mb-4 group-hover:scale-110 transition-transform">
58+
{icon}
59+
</div>
60+
<h3 className="text-xl font-semibold text-text-primary mb-2 group-hover:text-dojo-primary transition-colors">
61+
{title}
62+
</h3>
63+
<p className="text-text-secondary">
64+
{description}
65+
</p>
66+
{href && (
67+
<div className="mt-4 text-dojo-primary font-medium">
68+
Learn more →
69+
</div>
70+
)}
71+
</>
72+
)
73+
74+
if (href) {
75+
return (
76+
<a href={href} className="block p-6 bg-surface rounded-xl border border-border hover:border-dojo-primary/50 hover:shadow-lg transition-all duration-300 group">
77+
{content}
78+
</a>
79+
)
80+
}
81+
82+
return (
83+
<div className="p-6 bg-surface rounded-xl border border-border">
84+
{content}
85+
</div>
86+
)
87+
}
88+
89+
interface FeatureHighlightProps {
90+
icon: string | ReactNode
91+
title: string
92+
description: string
93+
image?: string
94+
reverse?: boolean
95+
children?: ReactNode
96+
}
97+
98+
export function FeatureHighlight({ icon, title, description, image, reverse = false, children }: FeatureHighlightProps) {
99+
return (
100+
<section className="py-16 md:py-24">
101+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
102+
<div className={`grid grid-cols-1 lg:grid-cols-2 gap-12 items-center ${reverse ? 'lg:flex-row-reverse' : ''}`}>
103+
<div className={reverse ? 'lg:order-2' : ''}>
104+
<div className="flex items-center justify-center w-16 h-16 rounded-xl bg-dojo-primary/10 text-dojo-primary text-3xl mb-6">
105+
{icon}
106+
</div>
107+
<h2 className="text-3xl md:text-4xl font-bold text-text-primary mb-4">
108+
{title}
109+
</h2>
110+
<p className="text-lg text-text-secondary mb-6">
111+
{description}
112+
</p>
113+
{children}
114+
</div>
115+
116+
<div className={reverse ? 'lg:order-1' : ''}>
117+
{image ? (
118+
<img
119+
src={image}
120+
alt={title}
121+
className="rounded-xl shadow-xl"
122+
/>
123+
) : (
124+
<div className="aspect-video bg-gradient-to-br from-dojo-primary/20 to-dojo-primary/5 rounded-xl flex items-center justify-center">
125+
<div className="text-6xl opacity-50">{icon}</div>
126+
</div>
127+
)}
128+
</div>
129+
</div>
130+
</div>
131+
</section>
132+
)
133+
}

0 commit comments

Comments
 (0)