Story Map β
| Page | app/(dashboard)/story-map/page.tsx |
| Route | /story-map |
| Access | Dashboard navbar (πΊοΈ button) |
What it does β
A visual, interactive world map that shows where each child's stories take place. Every story is automatically placed on the map based on keywords detected in the story prompt and title. Kids can tap a location pin to see all stories set in that place.
How location detection works β
The system scans the story's prompt and title fields for keywords and maps them to predefined locations on the map.
User creates story: "A brave bunny explores the ocean"
β
βΌ
detectLocation() finds keyword "ocean"
β
βΌ
Pin placed at Ocean coordinates (x: 35%, y: 60%) with π emojiSupported locations (30+) β
| Keyword(s) | Location | Emoji |
|---|---|---|
| ocean, sea | Ocean | π |
| underwater | Deep Sea | π |
| forest | Enchanted Forest | π² |
| jungle | Jungle | π΄ |
| mountain | Mountains | β°οΈ |
| castle, kingdom, princess, prince | Kingdom | π° |
| dragon | Dragon's Lair | π |
| space, planet | Outer Space | π |
| moon | The Moon | π |
| desert | Desert | ποΈ |
| island | Treasure Island | ποΈ |
| pirate | Pirate Cove | π΄ββ οΈ |
| farm | Sunny Farm | πΎ |
| garden | Magic Garden | πΈ |
| city | Big City | ποΈ |
| snow, ice, winter, arctic | Frozen North | βοΈ |
| dinosaur | Dino Valley | π¦ |
| fairy | Fairy Meadow | π§ |
| magic, wizard | Wizard Tower | πͺ |
| rainbow | Rainbow Valley | π |
| cloud, sky | Cloud Kingdom | βοΈ |
| animal, zoo | Animal Kingdom | π¦ |
| safari | Safari Plains | π¦ |
| robot | Future City | π€ |
| superhero | Hero HQ | π¦Έ |
| candy, cake | Candy Land | π |
If no keyword matches, the story defaults to "Storybook Land" at the center of the map.
UI features β
- Animated pins β each pin gently bounces with a staggered delay
- Story count badge β pins with multiple stories show a count indicator
- Pin detail panel β tapping a pin reveals all stories at that location with cover images
- Navigate to story β tap any story in the detail panel to open the story reader
- Dark/light theme β respects the user's dashboard theme preference
- Empty state β friendly message encouraging kids to create their first story
- Decorative map β abstract land masses and dot grid for a fantasy map feel
Data flow β
Page loads
β
βΌ
useUserStories(uid) β fetches all stories from Firestore
β
βΌ
For each story:
detectLocation(story.prompt, story.title)
β
βΌ
Group stories by location label β Map<label, MapPin>
β
βΌ
Render pins on the map at (x%, y%) coordinatesDesign decisions β
- No external map API β the map is a styled div with CSS, not Google Maps. This keeps it lightweight, kid-friendly, and avoids API costs.
- Keyword-based detection β simple and deterministic. No LLM call needed. Works instantly.
- Multiple stories per pin β stories at the same location are grouped, showing a count badge.
- Responsive β the map uses percentage-based positioning so it works on all screen sizes.

