Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions apps/ui/src/components/dialogs/board-background-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Checkbox } from "@/components/ui/checkbox";
import { cn } from "@/lib/utils";
import { useAppStore, defaultBackgroundSettings } from "@/store/app-store";
import { getHttpApiClient } from "@/lib/http-api-client";
import { useBoardBackgroundSettings } from "@/hooks/use-board-background-settings";
import { toast } from "sonner";

const ACCEPTED_IMAGE_TYPES = [
Expand All @@ -35,9 +36,8 @@ export function BoardBackgroundModal({
open,
onOpenChange,
}: BoardBackgroundModalProps) {
const { currentProject, boardBackgroundByProject } = useAppStore();
const {
currentProject,
boardBackgroundByProject,
setBoardBackground,
setCardOpacity,
setColumnOpacity,
Expand All @@ -47,7 +47,7 @@ export function BoardBackgroundModal({
setCardBorderOpacity,
setHideScrollbar,
clearBoardBackground,
} = useAppStore();
} = useBoardBackgroundSettings();
const [isDragOver, setIsDragOver] = useState(false);
const [isProcessing, setIsProcessing] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -139,8 +139,8 @@ export function BoardBackgroundModal({
);

if (result.success && result.path) {
// Update store with the relative path (live update)
setBoardBackground(currentProject.path, result.path);
// Update store and persist to server
await setBoardBackground(currentProject.path, result.path);
toast.success("Background image saved");
} else {
toast.error(result.error || "Failed to save background image");
Expand Down Expand Up @@ -214,7 +214,7 @@ export function BoardBackgroundModal({
);

if (result.success) {
clearBoardBackground(currentProject.path);
await clearBoardBackground(currentProject.path);
setPreviewImage(null);
toast.success("Background image cleared");
} else {
Expand All @@ -228,59 +228,59 @@ export function BoardBackgroundModal({
}
}, [currentProject, clearBoardBackground]);

// Live update opacity when sliders change
// Live update opacity when sliders change (with persistence)
const handleCardOpacityChange = useCallback(
(value: number[]) => {
async (value: number[]) => {
if (!currentProject) return;
setCardOpacity(currentProject.path, value[0]);
await setCardOpacity(currentProject.path, value[0]);
},
[currentProject, setCardOpacity]
);

const handleColumnOpacityChange = useCallback(
(value: number[]) => {
async (value: number[]) => {
if (!currentProject) return;
setColumnOpacity(currentProject.path, value[0]);
await setColumnOpacity(currentProject.path, value[0]);
},
[currentProject, setColumnOpacity]
);

const handleColumnBorderToggle = useCallback(
(checked: boolean) => {
async (checked: boolean) => {
if (!currentProject) return;
setColumnBorderEnabled(currentProject.path, checked);
await setColumnBorderEnabled(currentProject.path, checked);
},
[currentProject, setColumnBorderEnabled]
);

const handleCardGlassmorphismToggle = useCallback(
(checked: boolean) => {
async (checked: boolean) => {
if (!currentProject) return;
setCardGlassmorphism(currentProject.path, checked);
await setCardGlassmorphism(currentProject.path, checked);
},
[currentProject, setCardGlassmorphism]
);

const handleCardBorderToggle = useCallback(
(checked: boolean) => {
async (checked: boolean) => {
if (!currentProject) return;
setCardBorderEnabled(currentProject.path, checked);
await setCardBorderEnabled(currentProject.path, checked);
},
[currentProject, setCardBorderEnabled]
);

const handleCardBorderOpacityChange = useCallback(
(value: number[]) => {
async (value: number[]) => {
if (!currentProject) return;
setCardBorderOpacity(currentProject.path, value[0]);
await setCardBorderOpacity(currentProject.path, value[0]);
},
[currentProject, setCardBorderOpacity]
);

const handleHideScrollbarToggle = useCallback(
(checked: boolean) => {
async (checked: boolean) => {
if (!currentProject) return;
setHideScrollbar(currentProject.path, checked);
await setHideScrollbar(currentProject.path, checked);
},
[currentProject, setHideScrollbar]
);
Expand Down
27 changes: 24 additions & 3 deletions apps/ui/src/components/dialogs/file-browser-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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>
Expand Down
5 changes: 3 additions & 2 deletions apps/ui/src/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ function Card({ className, gradient = false, ...props }: CardProps) {
<div
data-slot="card"
className={cn(
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-white/10 backdrop-blur-md py-6",
"bg-card text-card-foreground flex flex-col gap-1 rounded-xl border border-white/10 backdrop-blur-md py-6",
// Premium layered shadow
"shadow-[0_1px_2px_rgba(0,0,0,0.05),0_4px_6px_rgba(0,0,0,0.05),0_10px_20px_rgba(0,0,0,0.04)]",
// Gradient border option
gradient && "relative before:absolute before:inset-0 before:rounded-xl before:p-[1px] before:bg-gradient-to-br before:from-white/20 before:to-transparent before:pointer-events-none before:-z-10",
gradient &&
"relative before:absolute before:inset-0 before:rounded-xl before:p-[1px] before:bg-gradient-to-br before:from-white/20 before:to-transparent before:pointer-events-none before:-z-10",
className
)}
{...props}
Expand Down
Loading