The App Settings: Global Orchestration & System Maintenance
The App Settings Modal serves as the central command center for global behavior and AI integration within Ploty. Engineered as a centralized hub, it allows for the management of the balance between local hardware performance and cloud-based generative power. The interface is organized into six specialized sections: General, Account, Database, Features, Tutorials, and Dev. This structure provides granular control over variables ranging from API credits to experimental UI paradigms.
The module architecture supports multi-layered configuration states, secure financial-to-app data bridges via Stripe, and automated filesystem maintenance utilities.
Technical Architecture: The Config-State Framework
A primary challenge in the Settings module is ensuring that global changes, such as enabling experimental features, are instantly broadcast and reconciled across the application without requiring a restart.
- Reactive Feature Toggling: The system utilizes a "Feature Flag" logic within Zustand. When a module like the Audio Timeline or Floating Panels is enabled in the Features section, the root layout re-evaluates the component tree in real-time, mounting or unmounting complex UI layers dynamically.
- Stripe-to-Zustand Integration: The Account section facilitates real-time credit management. A secure bridge manages the transition to a Stripe Checkout session for credit purchases. Upon a successful webhook event, the balance is updated via an encrypted API call, with the new count reflecting instantly within the local Tauri environment.
- Diagnostic Transparency: To assist in professional troubleshooting, the General section provides a direct hook to the Native Log Directory. This enables the immediate location of system logs for technical support, connecting the high-level UI to the underlying Rust-based error reporting.
Key Feature Breakdown
The App Settings provides the tools necessary to maintain a stable, long-term production environment:
| Section | Technical Implementation | Production Purpose |
|---|---|---|
| General & Logs | Native OS path-resolution for app.log file location. | Facilitates debugging and the submission of diagnostic data to support teams. |
| Account & Credits | Secure API integration with Stripe and RunPod. | Manages the financial requirements for cloud-based rendering and AI generation. |
| Database Cleanup | Automated audit script comparing SQLite manifests to physical files. | Scans for and removes orphaned assets to maintain lean local storage. |
| Modular UI Toggles | State-driven conditional rendering of UI paradigms. | Allows for switching between Standard and Floating layouts or testing experimental features. |
| Tutorial Hub | Curated index of video guides and technical documentation. | Reduces friction for new users and provides access to advanced workflow documentation. |
Performance & Optimization
Settings management is designed to be lightweight to avoid resource contention with the primary WebGL canvas:
- Non-Destructive Cleanup: The Run Cleanup tool operates as a background worker. It performs an initial "Dry Run" to identify unreferenced files without locking the database, ensuring that maintenance does not interrupt active creative work.
- Lazy Loading of Modals: To optimize application startup speed, the Settings Modal and its sub-sections are code-split. These components are only loaded into memory when the settings interface is explicitly accessed.
- Persistent Preferences: Global settings are serialized into a local
settings.jsonfile. Utilizing Tauri’s FS API, the application performs a fast synchronous read on startup, ensuring that the customized workspace and feature toggles are restored consistently.
Core Architectural Benefits
The App Settings system ensures that the application remains a sustainable and extensible professional tool.
- Workspace Customization: By allowing for the toggling of experimental features, the application adapts to specific ergonomic preferences and workflows.
- Storage Sustainability: The Database Cleanup tool addresses the data bloat common in media-heavy applications, ensuring that local storage remains efficient over long-term use.
- Secure Scalability: The integration of Stripe credits allows for the scaling of rendering power on demand, providing a frictionless transition between payment and execution.
- Diagnostic Readiness: Prioritizing access to log files and system health provides the transparency and support readiness required in high-end studio environments.