Public
Like
glimpse2-runbook-view-glimpse-save-login-react
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v8View latest version
Client-side files that render in the browser.
The glimpse frontend provides a rich, interactive view of Notion page content with clean, semantic HTML structure.
glimpse.html
- HTML template with React mount point and custom CSSglimpse.tsx
- React entry point that bootstraps the applicationcomponents/GlimpseView.tsx
- Main component that handles data fetching and layoutcomponents/NotionProperty.tsx
- Renders Notion page properties with proper formattingcomponents/NotionBlock.tsx
- Recursively renders Notion blocks with semantic HTMLcomponents/NotionBlocks.tsx
- Helper component for grouping blocks (especially lists)
- Content Negotiation:
/glimpse/:id
serves HTML for browsers, JSON for API calls - Server-Side Data Injection: Initial data injected to avoid loading states
- Semantic HTML Structure: Clean HTML without unnecessary wrapper divs
- Smart List Handling: Proper
<ul>/<ol>
grouping for consecutive list items - Rich Notion Rendering: Supports headings, paragraphs, lists, code blocks, callouts, etc.
- Property Display: Shows all page properties with type-specific formatting
- Error Handling: Graceful error states with retry functionality
- Responsive Design: Mobile-friendly layout using TailwindCSS
- Debug Mode: Raw data view in development environments
- No Wrappers: Simple elements like
<p>
,<h1>-<h6>
,<blockquote>
render directly - Conditional Wrappers: Complex blocks like callouts, toggles get wrapper divs only when needed
- Semantic Lists: Consecutive list items are grouped into proper
<ul>/<ol>
containers - Valid HTML: Maintains proper parent-child relationships (no
<div>
around<li>
)
- Simple Blocks (no wrapper): paragraphs, headings, quotes, dividers, code blocks
- List Items (grouped): bulleted and numbered list items grouped into semantic lists
- Complex Blocks (wrapper needed): callouts, toggles, file attachments, embeds
- Media Blocks (conditional wrapper): images and videos get wrappers only if captions exist
- Container Blocks: tables, columns maintain proper semantic structure
- Browser Access: Visit
/glimpse/:id
in browser to see rich HTML view - API Access: Use
/api/demo/:id
endpoint for raw JSON data - Fallback: If HTML template fails to load, shows informative error page
- Text blocks: paragraph, headings (1-3), rich text formatting
- Lists: bulleted, numbered, to-do items (properly grouped)
- Interactive: toggle blocks, callouts, checkboxes
- Media: images, videos, files, bookmarks, embeds
- Structure: dividers, columns, tables
- Code: inline code and code blocks with syntax highlighting
Uses a combination of:
- TailwindCSS: Via CDN for utility classes
- Custom CSS: Notion-specific styling in
glimpse.html
- Semantic Classes: Clean class names like
notion-heading-1
,notion-callout
- Responsive Design: Mobile-first approach
- Better Accessibility: Proper HTML semantics for screen readers
- Cleaner CSS: Simpler selectors without unnecessary wrapper divs
- Valid HTML: Maintains proper element relationships
- Performance: Fewer DOM nodes, better rendering performance
- SEO Friendly: Semantic HTML structure for search engines