refactor: Introduce useBoardBackgroundSettings hook for managing board background settings with persistence

- Refactored BoardBackgroundModal to utilize the new useBoardBackgroundSettings hook, improving code organization and reusability.
- Updated methods for setting board background, card opacity, column opacity, and other settings to include server persistence.
- Enhanced error handling and user feedback with toast notifications for successful and failed operations.
- Added keyboard shortcut support for selecting folders in FileBrowserDialog, improving user experience.
- Improved KanbanCard component layout and added dropdown menu for editing and viewing model information.
This commit is contained in:
Test User
2025-12-20 11:27:39 -05:00
parent f367db741a
commit 532d03c231
4 changed files with 294 additions and 55 deletions

View File

@@ -208,13 +208,31 @@ export function FileBrowserDialog({
}
};
const handleSelect = () => {
const handleSelect = useCallback(() => {
if (currentPath) {
addRecentFolder(currentPath);
onSelect(currentPath);
onOpenChange(false);
}
};
}, [currentPath, onSelect, onOpenChange]);
// Handle Command/Ctrl+Enter keyboard shortcut to select current folder
useEffect(() => {
if (!open) return;
const handleKeyDown = (e: KeyboardEvent) => {
// Check for Command+Enter (Mac) or Ctrl+Enter (Windows/Linux)
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
if (currentPath && !loading) {
handleSelect();
}
}
};
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
}, [open, currentPath, loading, handleSelect]);
// Helper to get folder name from path
const getFolderName = (path: string) => {
@@ -399,9 +417,12 @@ export function FileBrowserDialog({
<Button variant="ghost" size="sm" onClick={() => onOpenChange(false)}>
Cancel
</Button>
<Button size="sm" onClick={handleSelect} disabled={!currentPath || loading}>
<Button size="sm" onClick={handleSelect} disabled={!currentPath || loading} title="Select current folder (Cmd+Enter / Ctrl+Enter)">
<FolderOpen className="w-3.5 h-3.5 mr-1.5" />
Select Current Folder
<kbd className="ml-2 px-1.5 py-0.5 text-[10px] bg-background/50 rounded border border-border">
{typeof navigator !== "undefined" && navigator.platform?.includes("Mac") ? "⌘" : "Ctrl"}+
</kbd>
</Button>
</DialogFooter>
</DialogContent>