meta
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: v169View latest version
This directory contains the refactored components from the original monolithic App.tsx file.
- Main application container
- Manages global state (url, metadata, error, history visibility)
- Orchestrates communication between child components
- Handles form submission and API calls
- Handles URL input form
- Manages form submission
- Integrates with history dropdown
- Props: url, onUrlChange, onSubmit, history-related props
- Displays metadata results in a table format
- Handles copy-to-clipboard functionality for individual values
- Formats JSON values with proper syntax highlighting
- Props: metadata
- Simple component for displaying error messages
- Conditionally renders based on error state
- Props: error
- Dropdown component for URL history
- Handles history item selection and clearing
- Props: isOpen, urlHistory, onHistoryItemClick, onClearHistory
formatJSON(): Formats JSON strings/objects for displaycopyToClipboard(): Handles copying values to clipboard
- Custom hook for managing URL history
- Handles localStorage persistence
- Provides addToHistory and clearHistory functions
- Returns: { urlHistory, addToHistory, clearHistory }
- Separation of Concerns: Each component has a single responsibility
- Reusability: Components can be easily reused or tested independently
- Maintainability: Easier to modify individual features without affecting others
- Readability: Smaller, focused components are easier to understand
- Testing: Individual components can be unit tested more easily
- Performance: Smaller components can be optimized independently