Refactor dashboards and fix HMR with date handling improvements#106
Closed
conorbranagan wants to merge 6 commits intomasterfrom
Closed
Refactor dashboards and fix HMR with date handling improvements#106conorbranagan wants to merge 6 commits intomasterfrom
conorbranagan wants to merge 6 commits intomasterfrom
Conversation
Introduces a complete design dials system that allows designers and PMs to adjust UI parameters at runtime without code changes. **Dials SDK (`packages/dials/`):** - useDynamicColor: Color values with design system integration - useDynamicSpacing: Spacing/padding/margin controls - useDynamicVariant: Discrete choice selections - useDynamicBoolean: Toggle/feature flag controls - useDynamicNumber: Numeric values with min/max/step - DialsOverlay: Compact Leva-inspired UI (Ctrl+D to toggle) - DialsProvider: React context for dial state management - Design manifest integration for design system tokens **App Integration:** - Added DialsProvider to app Providers - Example dials on WebsitePage (metrics bar, panels, navigation) - MetricCard component with adjustable typography dials - TypeScript manifest at src/config/niteshift-manifest.ts **Documentation:** - Comprehensive CLAUDE.md section on dials usage - Best practices for preserving original appearance - Examples for all dial types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The static class property singleton pattern doesn't survive HMR when module boundaries get crossed. New dials would register with a fresh registry instance while DialsOverlay stayed subscribed to the old one. Fix: Store the singleton on `window.__NITESHIFT_DIALS_REGISTRY__` so it persists across module re-evaluations during hot reload. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
This PR includes several improvements to the dashboard and prototype infrastructure:
Related Task
View Niteshift Task
TL;DR
Refactored dashboards, improved date handling, and introduced the
@niteshift/dialsSDK for runtime design parameter controls, which also fixed HMR issues.What changed?
@niteshift/dialspackage for runtime design parameter controls, including:DialRegistryfor managing and persisting dial values.DialsProviderandDialsOverlayReact components for UI and context.ColorControl,SpacingControl,VariantControl,BooleanControl,NumberControl) for different dial types.useDial,useDynamicBoolean,useDynamicColor,useDynamicNumber,useDynamicSpacing,useDynamicVariant) for integrating dials into components.@niteshift/dialsSDK into the main application (src/app/Providers.tsx,src/app/layout.tsx).CLAUDE.mdwith documentation for the new SDK.PrototypesLayoutcomponent.hybrid,marketing-attribution,product-analytics,revenue-operations) with dynamic customization via@niteshift/dials.WebsiteMetricsBar,WebsitePage, andWebsitePanelscomponents to useTypographyContextand@niteshift/dialsfor dynamic styling.Dateobjects instead of strings for improved date handling.MetricCardcomponent now supports enhanced text customization for labels and values.postinstallscript topackage.jsonto build the@niteshift/dialsworkspace.pnpm-lock.yamlto reflect dependency changes.Description generated by Mesa. Update settings