feat: enhance dashboard and canvas components with improved state management and resizing logic

- Added client mount state to the dashboard to prevent premature interactions before the component is fully loaded.
- Updated button disabling logic to ensure it reflects the component's readiness and user session state.
- Introduced zIndex handling in canvas placement context for better node layering.
- Enhanced asset and image nodes with improved resizing logic to maintain aspect ratios during adjustments.
- Refactored node components to streamline rendering and improve performance during dynamic updates.
This commit is contained in:
Matthias
2026-03-27 23:17:10 +01:00
parent e96c9c611c
commit 4e84e7f76f
11 changed files with 357 additions and 215 deletions

View File

@@ -61,6 +61,11 @@ export default function DashboardPage() {
);
const createCanvas = useMutation(api.canvases.create);
const [isCreatingWorkspace, setIsCreatingWorkspace] = useState(false);
const [hasClientMounted, setHasClientMounted] = useState(false);
useEffect(() => {
setHasClientMounted(true);
}, []);
const displayName = session?.user.name?.trim() || session?.user.email || "Nutzer";
const initials = getInitials(displayName);
@@ -207,7 +212,12 @@ export default function DashboardPage() {
className="cursor-pointer text-muted-foreground"
type="button"
onClick={handleCreateWorkspace}
disabled={isCreatingWorkspace || isSessionPending || !session?.user}
disabled={
isCreatingWorkspace ||
!hasClientMounted ||
isSessionPending ||
!session?.user
}
>
{isCreatingWorkspace ? "Erstelle..." : "Neuen Arbeitsbereich"}
</Button>