personal website

Commit 22877310

22877310931aMerged

Justin Dorfman <[email protected]> · 9 months ago · 3 files · +2 added · ~1 modified

Description

feat: Add new video and collapsible More section (#55)

  • Add GitHub Code Search vs Sourcegraph comparison video
  • Shift existing videos down in the grid
  • Add expandable "More" section for archived videos
  • Include toggle button with show/hide functionality
  • Add README and Cursor skill for video management

Details

Commit
22877310931a
Parent
0487644796e2

.cursor/skills/add-video/SKILL.mdaddedView file

1+---
2+name: add-video
3+description: Add a new YouTube video to the portfolio. New video becomes Horizontal Video Card 1, all other videos shift down, oldest goes to More section. Use when user types /add-video followed by a YouTube URL.
4+---
5+
6+# Add Video to Portfolio
7+
8+When user types `/add-video <URL>`, follow these steps exactly.
9+
10+## Step 1: Extract Video ID
11+
12+From the URL, extract the video ID:
13+- `youtube.com/watch?v=VIDEO_ID` → use VIDEO_ID
14+- `youtu.be/VIDEO_ID` → use VIDEO_ID
15+- `youtube.com/embed/VIDEO_ID` → use VIDEO_ID
16+
17+## Step 2: Fetch Video Title
18+
19+Use the YouTube oEmbed API to get the video title (no API key needed):
20+
21+```
22+https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v={VIDEO_ID}&format=json
23+```
24+
25+Fetch this URL and extract the `title` field from the JSON response. Use this title for:
26+- The iframe `title` attribute
27+- The `<h3 class="video-card-title">` text
28+
29+If the fetch fails, fall back to "Video" as the default title.
30+
31+## Step 3: Read index.html
32+
33+Read `index.html` and identify these 5 video cards by their HTML comments:
34+- `<!-- Horizontal Video Card 1 -->` - first large video
35+- `<!-- Horizontal Video Card 2 -->` - second large video
36+- `<!-- Small Video Card 1 -->` - first small video
37+- `<!-- Small Video Card 2 -->` - second small video
38+- `<!-- Small Video Card 3 -->` - third small video
39+
40+Also find `<!-- More Videos Section -->` where archived videos go.
41+
42+## Step 4: Cascade Videos Down
43+
44+Perform these moves in order:
45+
46+1. **Small Card 3 → More section**: Copy the entire `<article>` from Small Card 3 and insert it at the START of the More section's `<div class="video-grid">`, right after the `<!-- Archived videos appear here -->` comment (push existing archived videos down).
47+
48+2. **Small Card 2 → Small Card 3**: Replace Small Card 3's `<article>` content with Small Card 2's content. Keep the `<!-- Small Video Card 3 -->` comment.
49+
50+3. **Small Card 1 → Small Card 2**: Replace Small Card 2's `<article>` content with Small Card 1's content. Keep the `<!-- Small Video Card 2 -->` comment.
51+
52+4. **Horizontal Card 2 → Small Card 1**: Replace Small Card 1's `<article>` with Horizontal Card 2's content, but change the class from `video-card-horizontal` to `video-card-small`. Keep the `<!-- Small Video Card 1 -->` comment.
53+
54+5. **Horizontal Card 1 → Horizontal Card 2**: Replace Horizontal Card 2's `<article>` content with Horizontal Card 1's content. Keep the `<!-- Horizontal Video Card 2 -->` comment.
55+
56+6. **New video → Horizontal Card 1**: Update Horizontal Card 1 with the new video:
57+ - Set iframe src to `https://www.youtube.com/embed/{VIDEO_ID}`
58+ - Set iframe title to the fetched YouTube title (from Step 2)
59+ - Set `<h3 class="video-card-title">` to the fetched YouTube title
60+ - Keep category as "Deep Dives / Demos" unless specified
61+
62+## Video Card Templates
63+
64+**Horizontal card (for positions 1-2):**
65+```html
66+ <!-- Horizontal Video Card 1 -->
67+ <article class="video-card video-card-horizontal">
68+ <div class="video-thumbnail video-thumbnail-16-9">
69+ <iframe
70+ src="https://www.youtube.com/embed/{VIDEO_ID}"
71+ title="{TITLE}"
72+ frameborder="0"
73+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
74+ allowfullscreen
75+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
76+ </iframe>
77+ </div>
78+ <div class="video-info">
79+ <span class="video-category">{CATEGORY}</span>
80+ <h3 class="video-card-title">{TITLE}</h3>
81+ </div>
82+ </article>
83+```
84+
85+**Small card (for positions 1-3 and More section):**
86+```html
87+ <!-- Small Video Card 1 -->
88+ <article class="video-card video-card-small">
89+ <div class="video-thumbnail video-thumbnail-16-9">
90+ <iframe
91+ src="https://www.youtube.com/embed/{VIDEO_ID}"
92+ title="{TITLE}"
93+ frameborder="0"
94+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
95+ allowfullscreen
96+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
97+ </iframe>
98+ </div>
99+ <div class="video-info">
100+ <span class="video-category">{CATEGORY}</span>
101+ <h3 class="video-card-title">{TITLE}</h3>
102+ </div>
103+ </article>
104+```
105+
106+## Example
107+
108+Input: `/add-video https://www.youtube.com/watch?v=abc123`
109+
110+Before:
111+- Horizontal 1: Video A
112+- Horizontal 2: Video B
113+- Small 1: Video C
114+- Small 2: Video D
115+- Small 3: Video E
116+- More: [Video F, Video G...]
117+
118+After:
119+- Horizontal 1: **NEW VIDEO** (abc123)
120+- Horizontal 2: Video A
121+- Small 1: Video B (changed from horizontal to small class)
122+- Small 2: Video C
123+- Small 3: Video D
124+- More: [Video E, Video F, Video G...]
125+
126+## Optional Title/Category Override
127+
128+By default, the video title is fetched automatically from YouTube.
129+
130+If user wants to override the title: `/add-video URL "My Custom Title"`
131+If user wants to override title and category: `/add-video URL "My Custom Title" "Category Name"`
132+
133+User-provided values take precedence over the fetched YouTube title. Default category is "Deep Dives / Demos".