playwright-director 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +74 -10
  2. package/dist/Tutorial.d.ts.map +1 -1
  3. package/dist/Tutorial.js +1 -1
  4. package/dist/Tutorial.js.map +1 -1
  5. package/dist/init.js +11 -1
  6. package/dist/init.js.map +1 -1
  7. package/dist/site/build-site.d.ts +6 -0
  8. package/dist/site/build-site.d.ts.map +1 -1
  9. package/dist/site/build-site.js +13 -2
  10. package/dist/site/build-site.js.map +1 -1
  11. package/dist/site/embed.d.ts +9 -0
  12. package/dist/site/embed.d.ts.map +1 -1
  13. package/dist/site/embed.js +7 -3
  14. package/dist/site/embed.js.map +1 -1
  15. package/dist/site/generate-manifest.d.ts +2 -0
  16. package/dist/site/generate-manifest.d.ts.map +1 -1
  17. package/dist/site/generate-manifest.js +57 -16
  18. package/dist/site/generate-manifest.js.map +1 -1
  19. package/dist/site/scaffold.d.ts +6 -0
  20. package/dist/site/scaffold.d.ts.map +1 -1
  21. package/dist/site/scaffold.js +54 -8
  22. package/dist/site/scaffold.js.map +1 -1
  23. package/dist/site/scan-tutorials.d.ts +2 -0
  24. package/dist/site/scan-tutorials.d.ts.map +1 -1
  25. package/dist/site/scan-tutorials.js +3 -1
  26. package/dist/site/scan-tutorials.js.map +1 -1
  27. package/dist/site/seo.d.ts +22 -0
  28. package/dist/site/seo.d.ts.map +1 -0
  29. package/dist/site/seo.js +91 -0
  30. package/dist/site/seo.js.map +1 -0
  31. package/dist/site/strings.d.ts +19 -0
  32. package/dist/site/strings.d.ts.map +1 -1
  33. package/dist/site/strings.js +57 -3
  34. package/dist/site/strings.js.map +1 -1
  35. package/dist/site/tokens.d.ts +28 -0
  36. package/dist/site/tokens.d.ts.map +1 -0
  37. package/dist/site/tokens.js +38 -0
  38. package/dist/site/tokens.js.map +1 -0
  39. package/dist/site/types.d.ts +57 -12
  40. package/dist/site/types.d.ts.map +1 -1
  41. package/dist/timeline.d.ts +7 -1
  42. package/dist/timeline.d.ts.map +1 -1
  43. package/dist/timeline.js +5 -1
  44. package/dist/timeline.js.map +1 -1
  45. package/dist/types.d.ts +8 -0
  46. package/dist/types.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/schemas/embed-v1.schema.json +5 -0
  49. package/skills/tutorialize/SKILL.md +7 -2
  50. package/skills/tutorialize/agent.md +4 -0
  51. package/skills/tutorialize/references/api.md +1 -0
  52. package/skills/tutorialize/references/site.md +158 -0
  53. package/templates/site/public/widget.js +16 -11
  54. package/templates/site/src/components/Emphasis.astro +8 -0
  55. package/templates/site/src/components/HomeLangs.astro +20 -0
  56. package/templates/site/src/components/LangSwitch.astro +20 -0
  57. package/templates/site/src/components/Lightbox.astro +50 -0
  58. package/templates/site/src/components/PrevNext.astro +40 -0
  59. package/templates/site/src/components/Seo.astro +42 -0
  60. package/templates/site/src/components/StepGuide.astro +115 -0
  61. package/templates/site/src/components/StepStrip.astro +33 -0
  62. package/templates/site/src/components/ThemeSwitcher.astro +22 -0
  63. package/templates/site/src/components/VariantFilter.astro +36 -0
  64. package/templates/site/src/components/VideoCard.astro +1 -103
  65. package/templates/site/src/components/VideoLinks.astro +19 -0
  66. package/templates/site/src/components/VideoModal.astro +66 -153
  67. package/templates/site/src/components/VideoPlayer.astro +43 -0
  68. package/templates/site/src/i18n.ts +8 -3
  69. package/templates/site/src/layouts/Shell.astro +46 -0
  70. package/templates/site/src/lib/filter.ts +24 -0
  71. package/templates/site/src/lib/site.ts +127 -0
  72. package/templates/site/src/pages/[lang]/index.astro +6 -6
  73. package/templates/site/src/pages/[slug].astro +5 -850
  74. package/templates/site/src/pages/index.astro +2 -2
  75. package/templates/site/src/styles/components.css +919 -0
  76. package/templates/site/src/styles/user.css +1 -0
  77. package/templates/themes/academy/CourseNav.astro +56 -0
  78. package/templates/themes/academy/Home.astro +139 -0
  79. package/templates/themes/academy/Layout.astro +48 -0
  80. package/templates/themes/academy/VideoPage.astro +75 -0
  81. package/templates/themes/academy/theme.css +979 -0
  82. package/templates/themes/classic/Home.astro +58 -0
  83. package/templates/themes/classic/Layout.astro +46 -0
  84. package/templates/themes/classic/VideoPage.astro +47 -0
  85. package/templates/themes/classic/theme.css +289 -0
  86. package/templates/site/src/components/TutorialsHome.astro +0 -169
  87. package/templates/site/src/layouts/Base.astro +0 -61
  88. package/templates/site/src/styles/tutorials.css +0 -303
@@ -0,0 +1,58 @@
1
+ ---
2
+ import Layout from './Layout.astro';
3
+ import VideoCard from '../components/VideoCard.astro';
4
+ import VideoModal from '../components/VideoModal.astro';
5
+ import HomeLangs from '../components/HomeLangs.astro';
6
+ import VariantFilter from '../components/VariantFilter.astro';
7
+ import Emphasis from '../components/Emphasis.astro';
8
+ import { manifest, media, videoHref, videosForLang, sections, numberSteps, loc, homeSeo, plainText } from '../lib/site';
9
+ import { t, siteLang } from '../i18n';
10
+
11
+ interface Props {
12
+ /** Page language — `/` is the site default, `/<lang>/` the others */
13
+ lang?: string;
14
+ }
15
+
16
+ const { ui } = manifest;
17
+ const lang = Astro.props.lang ?? siteLang;
18
+ const videos = videosForLang(lang);
19
+ const heroTitle = loc(ui.heroTitle, lang);
20
+ // The default subtitle is a UI string — translate it; a configured one stays as is.
21
+ const subtitle = ui.heroSubtitle === t(siteLang, 'videoTutorials') ? t(lang, 'videoTutorials') : loc(ui.heroSubtitle, lang);
22
+ ---
23
+
24
+ <Layout title={plainText(heroTitle)} description={subtitle} lang={lang} seo={homeSeo()}>
25
+ <slot name="head" slot="head" />
26
+ <section class="hero">
27
+ <h1><Emphasis text={heroTitle} /></h1>
28
+ <p>{subtitle}</p>
29
+ </section>
30
+
31
+ <HomeLangs lang={lang} />
32
+ <VariantFilter videos={videos} lang={lang} />
33
+
34
+ {sections(videos).map((section) => (
35
+ <section class="category" id={section.id}>
36
+ <div class="category-header">
37
+ <span class="category-icon">{section.icon}</span>
38
+ <h2>{loc(section.label, lang)}</h2>
39
+ </div>
40
+ <div class="video-grid">
41
+ {section.videos.map((video) => (
42
+ <VideoCard
43
+ id={video.id}
44
+ title={video.title}
45
+ duration={video.duration}
46
+ videoUrl={media(video.file)}
47
+ steps={numberSteps(video).filter((s) => s.image).map((s) => media(s.image!))}
48
+ href={videoHref(video)}
49
+ variant={video.variant}
50
+ lang={video.lang}
51
+ />
52
+ ))}
53
+ </div>
54
+ </section>
55
+ ))}
56
+
57
+ <VideoModal lang={lang} />
58
+ </Layout>
@@ -0,0 +1,46 @@
1
+ ---
2
+ import Shell from '../layouts/Shell.astro';
3
+ import ThemeSwitcher from '../components/ThemeSwitcher.astro';
4
+ import type { SeoProps } from '../components/Seo.astro';
5
+ import { config, base } from '../lib/site';
6
+ import { t, siteLang } from '../i18n';
7
+
8
+ interface Props {
9
+ title: string;
10
+ description?: string;
11
+ lang?: string;
12
+ seo?: SeoProps;
13
+ }
14
+
15
+ const { title, description, seo } = Astro.props;
16
+ const lang = Astro.props.lang || siteLang;
17
+ ---
18
+
19
+ <Shell title={title} description={description} lang={lang} seo={seo}>
20
+ <slot name="head" slot="head" />
21
+ <header>
22
+ <div class="header-content">
23
+ <a href={`${base}/`} class="logo">
24
+ {
25
+ config.logo ? (
26
+ <img src={`${base}${config.logo}`} alt={config.title} class="logo-img" />
27
+ ) : (
28
+ <span class="logo-icon">🎬</span>
29
+ )
30
+ }
31
+ <span class="logo-text">{config.title}</span>
32
+ </a>
33
+ <ThemeSwitcher lang={lang} />
34
+ </div>
35
+ </header>
36
+ <main>
37
+ <slot />
38
+ </main>
39
+ <footer>
40
+ <div class="footer-content">
41
+ <span>© {new Date().getFullYear()} {config.title}</span>
42
+ <span>·</span>
43
+ <span>{t(lang, 'builtWith')}</span>
44
+ </div>
45
+ </footer>
46
+ </Shell>
@@ -0,0 +1,47 @@
1
+ ---
2
+ import Layout from './Layout.astro';
3
+ import VideoPlayer from '../components/VideoPlayer.astro';
4
+ import LangSwitch from '../components/LangSwitch.astro';
5
+ import StepStrip from '../components/StepStrip.astro';
6
+ import StepGuide from '../components/StepGuide.astro';
7
+ import Lightbox from '../components/Lightbox.astro';
8
+ import PrevNext from '../components/PrevNext.astro';
9
+ import VideoLinks from '../components/VideoLinks.astro';
10
+ import { homeOf, numberSteps, neighbours, sameLang, steps, videoSeo, type Video } from '../lib/site';
11
+ import { t } from '../i18n';
12
+
13
+ interface Props {
14
+ video: Video;
15
+ }
16
+
17
+ const { video } = Astro.props;
18
+ const L = video.lang;
19
+ const numbered = numberSteps(video);
20
+ // Prev/next stay in this page's language; LangSwitch lists the same tutorial in the other languages.
21
+ const { prev, next } = neighbours(sameLang(video), video);
22
+ ---
23
+
24
+ <Layout title={video.title} description={video.description} lang={L} seo={videoSeo(video)}>
25
+ <slot name="head" slot="head" />
26
+ <div class="video-page">
27
+ <a href={homeOf(L)} class="back-link"><span class="back-arrow" aria-hidden="true">←</span> {t(L, 'allTutorials')}</a>
28
+
29
+ <LangSwitch video={video} />
30
+ <VideoPlayer video={video} />
31
+
32
+ <div class="video-page-info">
33
+ <h1 class="video-page-title">{video.title}</h1>
34
+ {video.description && <p class="video-page-desc">{video.description}</p>}
35
+ <div class="video-page-meta">
36
+ <span class="video-duration">&#x1F553; {video.duration}</span>
37
+ </div>
38
+ <VideoLinks video={video} />
39
+ </div>
40
+
41
+ {steps.strip && <StepStrip steps={numbered} lang={L} />}
42
+ <StepGuide steps={numbered} layout={steps.layout} lang={L} />
43
+ <PrevNext prev={prev} next={next} lang={L} />
44
+ </div>
45
+
46
+ {(steps.strip || steps.layout === 'cards') && <Lightbox />}
47
+ </Layout>
@@ -0,0 +1,289 @@
1
+ /* Classic theme — light/dark gallery. Token defaults (--pd-*) + page chrome. */
2
+ :root {
3
+ /* indigo-600: #6366f1 was 4.46:1 with white, under WCAG AA */
4
+ --pd-primary: #4f46e5;
5
+ --pd-on-primary: #fff;
6
+ --pd-accent: #4f46e5;
7
+ --pd-bg: #f8fafc;
8
+ --pd-surface: #ffffff;
9
+ --pd-text: #1e293b;
10
+ --pd-muted: #64748b;
11
+ --pd-border: #e2e8f0;
12
+ --pd-pro: #f59e0b;
13
+ --pd-font-body: system-ui, -apple-system, sans-serif;
14
+ --pd-font-display: var(--pd-font-body);
15
+ --pd-radius: 0.75rem;
16
+ --pd-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
17
+ --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
18
+
19
+ /* Pre-0.6 names, kept for custom CSS written against them */
20
+ --color-primary: var(--pd-primary);
21
+ --color-primary-dark: #4f46e5;
22
+ --color-bg: var(--pd-bg);
23
+ --color-bg-card: var(--pd-surface);
24
+ --color-text: var(--pd-text);
25
+ --color-text-muted: var(--pd-muted);
26
+ --color-border: var(--pd-border);
27
+ --color-pro: var(--pd-pro);
28
+ --font-family: var(--pd-font-body);
29
+ --radius: var(--pd-radius);
30
+ --shadow: var(--pd-shadow);
31
+ --shadow-hover: var(--pd-shadow-hover);
32
+ }
33
+
34
+ @media (prefers-color-scheme: dark) {
35
+ :root:not([data-theme='light']) {
36
+ --pd-bg: #0f172a;
37
+ --pd-surface: #1e293b;
38
+ --pd-text: #e2e8f0;
39
+ --pd-muted: #94a3b8;
40
+ --pd-border: #334155;
41
+ --pd-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
42
+ --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
43
+ }
44
+ }
45
+
46
+ :root[data-theme='dark'] {
47
+ --pd-bg: #0f172a;
48
+ --pd-surface: #1e293b;
49
+ --pd-text: #e2e8f0;
50
+ --pd-muted: #94a3b8;
51
+ --pd-border: #334155;
52
+ --pd-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
53
+ --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
54
+ }
55
+
56
+ * {
57
+ box-sizing: border-box;
58
+ margin: 0;
59
+ padding: 0;
60
+ }
61
+
62
+ body {
63
+ font-family: var(--pd-font-body);
64
+ background: var(--pd-bg);
65
+ color: var(--pd-text);
66
+ line-height: 1.6;
67
+ min-height: 100vh;
68
+ display: flex;
69
+ flex-direction: column;
70
+ }
71
+
72
+ /* Header */
73
+ header {
74
+ background: var(--pd-surface);
75
+ border-bottom: 1px solid var(--pd-border);
76
+ position: sticky;
77
+ top: 0;
78
+ z-index: 100;
79
+ }
80
+
81
+ .header-content {
82
+ max-width: 1200px;
83
+ margin: 0 auto;
84
+ padding: 1rem 2rem;
85
+ display: flex;
86
+ justify-content: space-between;
87
+ align-items: center;
88
+ }
89
+
90
+ .logo {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 0.5rem;
94
+ text-decoration: none;
95
+ color: var(--pd-text);
96
+ font-weight: 600;
97
+ font-size: 1.1rem;
98
+ }
99
+
100
+ .logo-icon {
101
+ font-size: 1.5rem;
102
+ }
103
+
104
+ .logo-img {
105
+ height: 32px;
106
+ width: auto;
107
+ }
108
+
109
+ .theme-switcher {
110
+ display: flex;
111
+ gap: 0.25rem;
112
+ padding: 0.25rem;
113
+ border: 1px solid var(--pd-border);
114
+ border-radius: 999px;
115
+ }
116
+
117
+ .theme-switcher a {
118
+ padding: 0.35rem 0.85rem;
119
+ border-radius: 999px;
120
+ color: var(--pd-muted);
121
+ text-decoration: none;
122
+ font-size: 0.85rem;
123
+ }
124
+
125
+ .theme-switcher a[aria-current] {
126
+ background: var(--pd-primary);
127
+ color: var(--pd-on-primary);
128
+ }
129
+
130
+ /* Main content */
131
+ main {
132
+ flex: 1;
133
+ max-width: 1200px;
134
+ margin: 0 auto;
135
+ padding: 2rem;
136
+ width: 100%;
137
+ }
138
+
139
+ /* Hero section */
140
+ .hero {
141
+ text-align: center;
142
+ padding: 3rem 1rem;
143
+ }
144
+
145
+ .hero h1 {
146
+ font-size: 2.5rem;
147
+ margin-bottom: 0.5rem;
148
+ color: var(--pd-text);
149
+ }
150
+
151
+ .hero p {
152
+ font-size: 1.25rem;
153
+ color: var(--pd-muted);
154
+ }
155
+
156
+ /* Category sections */
157
+ .category {
158
+ margin-bottom: 3rem;
159
+ }
160
+
161
+ .category-header {
162
+ display: flex;
163
+ align-items: center;
164
+ gap: 0.5rem;
165
+ margin-bottom: 1.5rem;
166
+ padding-bottom: 0.5rem;
167
+ border-bottom: 2px solid var(--pd-border);
168
+ }
169
+
170
+ .category-header h2 {
171
+ font-size: 1.25rem;
172
+ font-weight: 600;
173
+ }
174
+
175
+ .category-icon {
176
+ font-size: 1.25rem;
177
+ }
178
+
179
+ /* Video grid */
180
+ .video-grid {
181
+ display: grid;
182
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
183
+ gap: 1.5rem;
184
+ }
185
+
186
+ /* Video page */
187
+ .video-page {
188
+ max-width: 900px;
189
+ margin: 0 auto;
190
+ }
191
+
192
+ .back-link {
193
+ display: inline-block;
194
+ margin-bottom: 1.5rem;
195
+ color: var(--pd-muted);
196
+ text-decoration: none;
197
+ font-size: 0.9rem;
198
+ transition: color 0.2s;
199
+ }
200
+
201
+ .back-link:hover {
202
+ color: var(--pd-primary);
203
+ }
204
+
205
+ .video-page-info {
206
+ margin-bottom: 1.5rem;
207
+ }
208
+
209
+ .video-page-title {
210
+ font-size: 1.75rem;
211
+ font-weight: 700;
212
+ margin-bottom: 0.5rem;
213
+ line-height: 1.3;
214
+ }
215
+
216
+ .video-page-desc {
217
+ color: var(--pd-muted);
218
+ font-size: 1rem;
219
+ line-height: 1.6;
220
+ margin-bottom: 0.75rem;
221
+ }
222
+
223
+ .video-page-meta {
224
+ display: flex;
225
+ align-items: center;
226
+ gap: 0.75rem;
227
+ color: var(--pd-muted);
228
+ font-size: 0.9rem;
229
+ }
230
+
231
+ /* Footer */
232
+ footer {
233
+ background: var(--pd-surface);
234
+ border-top: 1px solid var(--pd-border);
235
+ padding: 1.5rem;
236
+ }
237
+
238
+ .footer-content {
239
+ max-width: 1200px;
240
+ margin: 0 auto;
241
+ display: flex;
242
+ justify-content: center;
243
+ gap: 1rem;
244
+ color: var(--pd-muted);
245
+ font-size: 0.875rem;
246
+ }
247
+
248
+ .footer-content a {
249
+ color: var(--pd-muted);
250
+ text-decoration: none;
251
+ }
252
+
253
+ .footer-content a:hover {
254
+ color: var(--pd-primary);
255
+ }
256
+
257
+ /* Responsive */
258
+ @media (max-width: 768px) {
259
+ .hero h1 {
260
+ font-size: 1.75rem;
261
+ }
262
+
263
+ .hero p {
264
+ font-size: 1rem;
265
+ }
266
+
267
+ .video-grid {
268
+ grid-template-columns: 1fr;
269
+ }
270
+
271
+ .header-content {
272
+ padding: 1rem;
273
+ }
274
+
275
+ main {
276
+ padding: 1rem;
277
+ }
278
+ }
279
+
280
+ @media (max-width: 600px) {
281
+ .video-page-title {
282
+ font-size: 1.25rem;
283
+ }
284
+
285
+ /* Prev/next: arrows only on phones */
286
+ .nav-text {
287
+ display: none;
288
+ }
289
+ }
@@ -1,169 +0,0 @@
1
- ---
2
- import { readdirSync, existsSync } from 'fs';
3
- import { join } from 'path';
4
- import Base from '../layouts/Base.astro';
5
- import VideoCard from './VideoCard.astro';
6
- import VideoModal from './VideoModal.astro';
7
- import tutorials from '../data/tutorials.json';
8
- import { t, siteLang, LANG_NAMES } from '../i18n';
9
-
10
- interface Props {
11
- /** Page language — `/` is the site default, `/<lang>/` the others */
12
- lang?: string;
13
- }
14
-
15
- const { categories, videos: allVideos, ui } = tutorials as any;
16
- const base = import.meta.env.BASE_URL.replace(/\/$/, '');
17
-
18
- // One home page per language: each lists only the tutorials recorded in it
19
- // (all of them when a single language was recorded).
20
- const langs: string[] = ([...new Set(allVideos.map((v: any) => v.lang).filter(Boolean))] as string[]).sort();
21
- const lang = Astro.props.lang ?? siteLang;
22
- const videos = langs.length > 1 ? allVideos.filter((v: any) => (v.lang ?? siteLang) === lang) : allVideos;
23
- const homeOf = (l: string) => (l === siteLang ? `${base}/` : `${base}/${l}/`);
24
- // The default subtitle is a UI string — translate it; a configured one stays as is.
25
- const subtitle = ui.heroSubtitle === t(siteLang, 'videoTutorials') ? t(lang, 'videoTutorials') : ui.heroSubtitle;
26
-
27
- // Scan for step screenshots at build time
28
- const videosDir = join(process.cwd(), 'public/videos');
29
- type StepEntry = { n: number; url: string };
30
- const stepsByVideo: Record<string, string[]> = {};
31
- if (existsSync(videosDir)) {
32
- const staging: Record<string, StepEntry[]> = {};
33
- for (const file of readdirSync(videosDir)) {
34
- const m = file.match(/^(.+)-step-(\d+)\.(png|jpe?g|webp|avif)$/);
35
- if (!m) continue;
36
- const [, id, n] = m;
37
- (staging[id] ??= []).push({ n: parseInt(n), url: `${base}/videos/${file}` });
38
- }
39
- for (const [id, entries] of Object.entries(staging)) {
40
- stepsByVideo[id] = entries.sort((a, b) => a.n - b.n).map(s => s.url);
41
- }
42
- }
43
-
44
- const getSteps = (file: string): string[] => {
45
- const base = file.replace(/\.[^.]+$/, '');
46
- return stepsByVideo[base] ?? [];
47
- };
48
-
49
- const videosByCategory = videos.reduce((acc: Record<string, any[]>, video: any) => {
50
- if (!acc[video.category]) acc[video.category] = [];
51
- acc[video.category].push(video);
52
- return acc;
53
- }, {} as Record<string, any[]>);
54
-
55
- // Variant filter (desktop / mobile / …) — only shown when at least one video
56
- // was recorded in a variant.
57
- const variants: string[] = [...new Set(videos.map((v: any) => v.variant ?? ''))] as string[];
58
- const hasVariants = variants.some((v) => v !== '');
59
- const variantLabel = (v: string) => (v === '' ? t(lang, 'desktop') : v.charAt(0).toUpperCase() + v.slice(1));
60
- ---
61
-
62
- <Base title={ui.heroTitle} lang={lang}>
63
- <section class="hero">
64
- <h1>{ui.heroTitle}</h1>
65
- <p>{subtitle}</p>
66
- </section>
67
-
68
- {langs.length > 1 && (
69
- <nav class="variant-filter" aria-label={t(lang, 'language')}>
70
- {langs.map((l) => (
71
- <a class:list={['variant-btn', { active: l === lang }]} href={homeOf(l)} lang={l} hreflang={l} aria-current={l === lang ? 'page' : undefined}>{LANG_NAMES[l] ?? l}</a>
72
- ))}
73
- </nav>
74
- )}
75
-
76
- {hasVariants && (
77
- <nav class="variant-filter" aria-label={t(lang, 'filterVariant')}>
78
- <button class="variant-btn active" data-variant="all">{t(lang, 'all')}</button>
79
- {variants.sort().map((v) => (
80
- <button class="variant-btn" data-variant={v}>{variantLabel(v)}</button>
81
- ))}
82
- </nav>
83
- )}
84
-
85
- {Object.entries(categories).map(([catId, cat]: [string, any]) => {
86
- const catVideos = videosByCategory[catId];
87
- if (!catVideos?.length) return null;
88
- return (
89
- <section class="category">
90
- <div class="category-header">
91
- <span class="category-icon">{cat.icon}</span>
92
- <h2>{cat.label}</h2>
93
- </div>
94
- <div class="video-grid">
95
- {catVideos.map((video: any) => (
96
- <VideoCard
97
- id={video.id}
98
- title={video.title}
99
- duration={video.duration}
100
- videoUrl={`${base}/videos/${video.file}`}
101
- steps={getSteps(video.file)}
102
- href={`${base}/${video.id}`}
103
- variant={video.variant}
104
- lang={video.lang}
105
- />
106
- ))}
107
- </div>
108
- </section>
109
- );
110
- })}
111
-
112
- <VideoModal />
113
- </Base>
114
-
115
- <style>
116
- .variant-filter {
117
- display: flex;
118
- justify-content: center;
119
- gap: 0.5rem;
120
- margin: 0 0 1.5rem;
121
- }
122
-
123
- .variant-btn {
124
- display: inline-flex;
125
- align-items: center;
126
- min-height: 44px;
127
- padding: 0 1rem;
128
- text-decoration: none;
129
- border: 1px solid var(--color-border, #ddd);
130
- border-radius: 999px;
131
- background: transparent;
132
- color: var(--color-text-muted, #666);
133
- font-size: 0.9rem;
134
- cursor: pointer;
135
- transition: all 0.2s;
136
- }
137
-
138
- .variant-btn:hover {
139
- border-color: var(--color-primary, #0066fd);
140
- color: var(--color-primary, #0066fd);
141
- }
142
-
143
- .variant-btn.active {
144
- background: var(--color-primary, #0066fd);
145
- border-color: var(--color-primary, #0066fd);
146
- color: white;
147
- }
148
- </style>
149
-
150
- <script>
151
- const bar = document.querySelector('[data-variant]')?.closest('.variant-filter');
152
- bar?.addEventListener('click', (e) => {
153
- const btn = (e.target as HTMLElement).closest<HTMLElement>('.variant-btn');
154
- if (!btn) return;
155
- const filter = btn.dataset.variant!;
156
- bar.querySelectorAll('.variant-btn').forEach((b) => b.classList.toggle('active', b === btn));
157
- document.querySelectorAll<HTMLElement>('.video-card').forEach((card) => {
158
- const match = filter === 'all' || (card.dataset.variant ?? '') === filter;
159
- card.style.display = match ? '' : 'none';
160
- });
161
- // Hide categories left with no visible card
162
- document.querySelectorAll<HTMLElement>('section.category').forEach((section) => {
163
- const anyVisible = [...section.querySelectorAll<HTMLElement>('.video-card')].some(
164
- (card) => card.style.display !== 'none'
165
- );
166
- section.style.display = anyVisible ? '' : 'none';
167
- });
168
- });
169
- </script>
@@ -1,61 +0,0 @@
1
- ---
2
- import '../styles/tutorials.css';
3
- import siteConfig from '../data/site-config.json';
4
- import { t, siteLang, RTL_LANGS } from '../i18n';
5
-
6
- interface Props {
7
- title: string;
8
- description?: string;
9
- /** Page language (a tutorial page uses its narration language) */
10
- lang?: string;
11
- }
12
-
13
- const config = siteConfig as any;
14
- const base = import.meta.env.BASE_URL.replace(/\/$/, '');
15
- const { title, description = config.title } = Astro.props;
16
- const lang = Astro.props.lang || siteLang;
17
- const dir = RTL_LANGS.includes(lang) ? 'rtl' : 'ltr';
18
-
19
- const cssVars = [
20
- config.primaryColor && `--color-primary: ${config.primaryColor}`,
21
- config.font && `--font-family: ${config.font}`,
22
- ]
23
- .filter(Boolean)
24
- .join('; ');
25
- ---
26
-
27
- <!doctype html>
28
- <html lang={lang} dir={dir}>
29
- <head>
30
- <meta charset="UTF-8" />
31
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
32
- <meta name="description" content={description} />
33
- <title>{title} | {config.title}</title>
34
- </head>
35
- <body style={cssVars || undefined}>
36
- <header>
37
- <div class="header-content">
38
- <a href={`${base}/`} class="logo">
39
- {
40
- config.logo ? (
41
- <img src={config.logo} alt={config.title} class="logo-img" />
42
- ) : (
43
- <span class="logo-icon">🎬</span>
44
- )
45
- }
46
- <span class="logo-text">{config.title}</span>
47
- </a>
48
- </div>
49
- </header>
50
- <main>
51
- <slot />
52
- </main>
53
- <footer>
54
- <div class="footer-content">
55
- <span>© {new Date().getFullYear()} {config.title}</span>
56
- <span>·</span>
57
- <span>{t(lang, 'builtWith')}</span>
58
- </div>
59
- </footer>
60
- </body>
61
- </html>