Skip to content

Commit 5d2cd83

Browse files
committed
Enable PhotoSwipe captions + add collection leadership night photo
Technical Changes: - Add captionContent callback to PhotoSwipe initialization (PhotoGallery.astro) - Style captions with Egyptian design system colors (dark semi-transparent bg) - Update optimize-gallery-images.js to handle in-place optimization Content Changes: - Add collection-leadership-night.jpg as first gallery image - Generate WebP version (1200x1601, optimized) - Add TODO placeholder caption for user context Documentation: - Create statsbomb-photo-captions-context-needed.md with caption-writing guide - 13 photos now have TODO placeholders ready for personal context Next Step: User to replace TODO captions with 1-2 sentence descriptions from personal Statsbomb memories (2018-2022) Story Points: 8 total (2+3+1+2)
1 parent 1e93dfd commit 5d2cd83

File tree

6 files changed

+284
-24
lines changed

6 files changed

+284
-24
lines changed
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# Statsbomb Photo Captions - Context Needed
2+
3+
**Status**: Captions enabled in PhotoSwipe lightbox ✅
4+
**Task**: Replace 13 TODO placeholders with 1-2 sentence descriptions from your personal context
5+
6+
---
7+
8+
## Instructions
9+
10+
Each photo in the gallery needs a caption that provides human context:
11+
- **Who**: Who are the people in the photo?
12+
- **When**: What time period or specific event?
13+
- **What**: What were you working on or discussing?
14+
- **Why it matters**: How does this connect to the story?
15+
16+
**Length**: 1-2 sentences maximum (keep it concise for mobile)
17+
**Tone**: Match the case study voice (collaborative, humble, specific)
18+
19+
---
20+
21+
## Photo 1: collection-leadership-night.jpg ⭐ NEW
22+
23+
**Current Caption**:
24+
> TODO: Add caption with your context - Who were these collection leaders? What were they discussing during this night shift? (1-2 sentences)
25+
26+
**Context Needed**:
27+
- Who are these 4 people? (Names if you remember)
28+
- What were they discussing about their ambitions/dreams?
29+
- What time period? (2018, 2019, 2020?)
30+
31+
**Suggested Format**:
32+
> "[Names], collection leads (2019): Late-night shift discussing career ambitions after finishing Champions League matches. They wanted to understand systems thinking, not just click buttons."
33+
34+
---
35+
36+
## Photo 2: IMG_20180326_132547.jpg
37+
38+
**Current Caption**:
39+
> TODO: Add caption describing this photo - team meeting, workspace, or technical discussion context (1-2 sentences).
40+
41+
**Context Needed**:
42+
- Who is in this photo?
43+
- What were you working on? (Week One? Live-collection-app?)
44+
- Cairo office context?
45+
46+
---
47+
48+
## Photo 3: IMG_20180410_163253.jpg
49+
50+
**Current Caption**:
51+
> TODO: Add caption - April 2018 context, Electron app development, XState implementation.
52+
53+
**Context Needed**:
54+
- Is this the freezeframe tool development?
55+
- Who are the people visible?
56+
- What milestone does April 2018 represent?
57+
58+
---
59+
60+
## Photo 4: IMG_20180813_133937.jpg
61+
62+
**Current Caption**:
63+
> TODO: Add caption describing this photo - architectural sessions, code reviews, or team collaboration moments.
64+
65+
**Context Needed**:
66+
- August 2018 - what were you building at this point?
67+
- Was this the DSL work starting?
68+
- Team context?
69+
70+
---
71+
72+
## Photo 5: IMG_20180814_180157.jpg
73+
74+
**Current Caption**:
75+
> TODO: Add caption - DSL, ANTLR, Kafka integration context from August 2018.
76+
77+
**Context Needed**:
78+
- Is this when you started the backend DSL work?
79+
- Who is in the photo?
80+
- What specific problem were you solving?
81+
82+
---
83+
84+
## Photo 6: IMG_20190625_113053.jpg
85+
86+
**Current Caption**:
87+
> TODO: Add caption - XState state machines, real-time collection, Electron app evolution (June 2019).
88+
89+
**Context Needed**:
90+
- June 2019 - what milestone?
91+
- Was real-time collection working at this point?
92+
- Who are the team members?
93+
94+
---
95+
96+
## Photo 7: IMG_20190815_190736.jpg
97+
98+
**Current Caption**:
99+
> TODO: Add caption - Team growth, Cairo engineering expansion, second year context (August 2019).
100+
101+
**Context Needed**:
102+
- How many people on the team at this point?
103+
- What were you celebrating or working on?
104+
- Any specific context from August 2019?
105+
106+
---
107+
108+
## Photo 8: _MG_0011.jpg
109+
110+
**Current Caption**:
111+
> TODO: Add caption - Technical architecture discussion, whiteboard sessions, or pairing context.
112+
113+
**Context Needed**:
114+
- What are you discussing in this photo?
115+
- Who is this with? (Ali? Adham?)
116+
- What problem were you solving?
117+
118+
---
119+
120+
## Photo 9: _MG_0017.jpg
121+
122+
**Current Caption**:
123+
> TODO: Add caption - Engineering workspace, code review, or debugging session context.
124+
125+
**Context Needed**:
126+
- What were you working on?
127+
- What time period?
128+
- Any specific bug or feature context?
129+
130+
---
131+
132+
## Photo 10: IMG_0570.jpg
133+
134+
**Current Caption**:
135+
> TODO: Add caption - Team planning, sprint retrospective, or feature discussion context.
136+
137+
**Context Needed**:
138+
- What meeting or planning session is this?
139+
- What were you planning?
140+
- Time period context?
141+
142+
---
143+
144+
## Photo 11: IMG_5279.jpg
145+
146+
**Current Caption**:
147+
> TODO: Add caption - Sports data collection, match analysis, or collector training context.
148+
149+
**Context Needed**:
150+
- Is this a collector training session?
151+
- What sport? (Soccer, NFL expansion?)
152+
- What were you demonstrating or discussing?
153+
154+
---
155+
156+
## Photo 12: df52f41a-686e-4989-8f34-08b1487920b6.jpg
157+
158+
**Current Caption**:
159+
> TODO: Add caption - Team milestone, celebration, or gathering outside typical work context.
160+
161+
**This is the night debugging photo with Adham and Waheed** - already captioned inline in the case study.
162+
163+
**Suggested Caption for Gallery**:
164+
> "Late night debugging with Adham and Waheed (2019): Real-time collection stress testing during live matches. Ali stayed for company, not supervision."
165+
166+
---
167+
168+
## Photo 13: IMG_5078.jpg
169+
170+
**Current Caption**:
171+
> TODO: Add caption - Engineering workspace perspective, team environment, or office culture context.
172+
173+
**Context Needed**:
174+
- What does this photo show?
175+
- What time period?
176+
- Why did you take this photo?
177+
178+
---
179+
180+
## Next Steps
181+
182+
1. **Review each photo** in the gallery at http://localhost:4321/portfolio/statsbomb
183+
2. **Click each photo** to open PhotoSwipe lightbox and see the TODO caption
184+
3. **Update `src/data/statsbomb-photos.json`** with real captions (replace "TODO: ..." strings)
185+
4. **Test mobile rendering** - Ensure captions read well on small screens
186+
187+
---
188+
189+
## Caption Writing Tips
190+
191+
**Good Example**:
192+
> "Ali and Adham pairing on ANTLR grammar (August 2018): Defining sequencing rules for possession chains. This VSCode session led to the 'start → [middle*] → break' mental model."
193+
194+
**Why it works**:
195+
- Names specific people and time
196+
- Explains what they're working on
197+
- Connects to narrative (VSCode moment from case study)
198+
- Concise (under 2 sentences)
199+
200+
**Bad Example**:
201+
> "Team working together on the data collection system in Cairo office"
202+
203+
**Why it fails**:
204+
- Generic (could describe any photo)
205+
- No specific context or connection to story
206+
- No names, no time period, no insight
207+
208+
---
209+
210+
## File to Edit
211+
212+
**Location**: `src/data/statsbomb-photos.json`
213+
**Lines**: 1-99 (all 13 photos)
214+
**Search for**: `"caption": "TODO:`
215+
**Replace with**: Your 1-2 sentence context
216+
217+
**After editing**, refresh the page and click photos to verify captions display correctly in the lightbox.
420 KB
Loading
324 KB
Loading

scripts/optimize-gallery-images.js

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const __filename = fileURLToPath(import.meta.url);
2020
const __dirname = dirname(__filename);
2121

2222
// Configuration
23-
const INPUT_DIR = join(__dirname, '../tmp-images');
23+
const INPUT_DIR = join(__dirname, '../public/images/statsbomb');
2424
const OUTPUT_DIR = join(__dirname, '../public/images/statsbomb');
2525
const TARGET_WIDTH = 1200;
2626
const QUALITY = 85;
@@ -70,31 +70,43 @@ async function optimizeImages() {
7070
const metadata = await sharp(inputPath).metadata();
7171
console.log(` Original: ${metadata.width}x${metadata.height} (${(metadata.size / 1024 / 1024).toFixed(2)}MB)`);
7272

73-
// Convert to WebP
73+
// Convert to WebP (skip if already exists)
7474
const webpPath = join(OUTPUT_DIR, `${fileBasename}.webp`);
75-
await sharp(inputPath)
76-
.resize(TARGET_WIDTH, null, {
77-
withoutEnlargement: true,
78-
fit: 'inside'
79-
})
80-
.webp({ quality: QUALITY })
81-
.toFile(webpPath);
82-
83-
const webpSize = await sharp(webpPath).metadata();
84-
console.log(` → WebP: ${webpSize.width}x${webpSize.height} (${(webpSize.size / 1024).toFixed(0)}KB)`);
85-
86-
// Create JPEG fallback
75+
if (!file.endsWith('.webp')) {
76+
await sharp(inputPath)
77+
.resize(TARGET_WIDTH, null, {
78+
withoutEnlargement: true,
79+
fit: 'inside'
80+
})
81+
.webp({ quality: QUALITY })
82+
.toFile(webpPath);
83+
84+
const webpSize = await sharp(webpPath).metadata();
85+
console.log(` → WebP: ${webpSize.width}x${webpSize.height} (${(webpSize.size / 1024).toFixed(0)}KB)`);
86+
}
87+
88+
// Create JPEG fallback (only if input is not already JPEG in output dir)
8789
const jpegPath = join(OUTPUT_DIR, `${fileBasename}.jpg`);
88-
await sharp(inputPath)
89-
.resize(TARGET_WIDTH, null, {
90-
withoutEnlargement: true,
91-
fit: 'inside'
92-
})
93-
.jpeg({ quality: QUALITY })
94-
.toFile(jpegPath);
95-
96-
const jpegSize = await sharp(jpegPath).metadata();
97-
console.log(` → JPEG: ${jpegSize.width}x${jpegSize.height} (${(jpegSize.size / 1024).toFixed(0)}KB)`);
90+
const needsJpegConversion = inputPath !== jpegPath;
91+
92+
if (needsJpegConversion) {
93+
await sharp(inputPath)
94+
.resize(TARGET_WIDTH, null, {
95+
withoutEnlargement: true,
96+
fit: 'inside'
97+
})
98+
.jpeg({ quality: QUALITY })
99+
.toFile(jpegPath + '.tmp');
100+
101+
// Rename temp file to final
102+
const { rename } = await import('fs/promises');
103+
await rename(jpegPath + '.tmp', jpegPath);
104+
105+
const jpegSize = await sharp(jpegPath).metadata();
106+
console.log(` → JPEG: ${jpegSize.width}x${jpegSize.height} (${(jpegSize.size / 1024).toFixed(0)}KB)`);
107+
} else {
108+
console.log(` → JPEG: Already optimized (skipped)`);
109+
}
98110

99111
console.log(` ✅ Saved to ${OUTPUT_DIR}\n`);
100112

src/components/PhotoGallery.astro

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ try {
173173
transform: none;
174174
}
175175
}
176+
177+
/* PhotoSwipe Caption Styling */
178+
:global(.pswp__caption-content) {
179+
padding: var(--spacing-md);
180+
background: rgba(15, 23, 42, 0.9); /* text-text with alpha */
181+
color: var(--color-background);
182+
font-size: 14px;
183+
line-height: 1.5;
184+
text-align: center;
185+
font-style: italic;
186+
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
187+
}
176188
</style>
177189

178190
<script>
@@ -205,6 +217,18 @@ try {
205217
children: "a",
206218
pswpModule: PhotoSwipe,
207219

220+
// Enable captions from data-pswp-caption attribute
221+
captionContent: (slide) => {
222+
const caption = slide.data.element?.getAttribute('data-pswp-caption');
223+
if (!caption) return '';
224+
225+
// Create caption element with proper styling
226+
const captionEl = document.createElement('div');
227+
captionEl.className = 'pswp__caption-content';
228+
captionEl.textContent = caption;
229+
return captionEl;
230+
},
231+
208232
// Animation durations (will be overridden by CSS if reduced motion)
209233
showAnimationDuration: prefersReducedMotion() ? 0 : 400,
210234
hideAnimationDuration: prefersReducedMotion() ? 0 : 400,

src/data/statsbomb-photos.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
[
2+
{
3+
"src": "/images/statsbomb/collection-leadership-night.jpg",
4+
"alt": "Collection leadership team during night shift discussing their ambitions and dreams",
5+
"caption": "TODO: Add caption with your context - Who were these collection leaders? What were they discussing during this night shift? (1-2 sentences)",
6+
"width": 1240,
7+
"height": 1654
8+
},
29
{
310
"src": "/images/statsbomb/IMG_20180326_132547.jpg",
411
"alt": "Team photo from Statsbomb Cairo office showing engineering workspace",

0 commit comments

Comments
 (0)