mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
♻️ refactor: streamline sidebar component structure and enhance functionality
- Extracted new components: ProjectSelectorWithOptions, SidebarFooter, TrashDialog, and OnboardingDialog to improve code organization and reusability. - Introduced new hooks: useProjectCreation, useSetupDialog, and useTrashDialog for better state management and modularity. - Updated sidebar.tsx to utilize the new components and hooks, reducing complexity and improving maintainability. - Enhanced project creation and setup processes with dedicated dialogs and streamlined user interactions. This refactor aims to enhance the user experience and maintainability of the sidebar by modularizing functionality and improving the overall structure.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { useAppStore } from '@/store/app-store';
|
||||
import { useThemePreview } from './use-theme-preview';
|
||||
|
||||
/**
|
||||
* Hook that manages project theme state and preview handlers
|
||||
*/
|
||||
export function useProjectTheme() {
|
||||
// Get theme-related values from store
|
||||
const { theme: globalTheme, setTheme, setProjectTheme, setPreviewTheme } = useAppStore();
|
||||
|
||||
// Get debounced preview handlers
|
||||
const { handlePreviewEnter, handlePreviewLeave } = useThemePreview({ setPreviewTheme });
|
||||
|
||||
return {
|
||||
// Theme state
|
||||
globalTheme,
|
||||
setTheme,
|
||||
setProjectTheme,
|
||||
setPreviewTheme,
|
||||
|
||||
// Preview handlers
|
||||
handlePreviewEnter,
|
||||
handlePreviewLeave,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user