Improve toolbox architecture and initial bundle loading
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
This commit is contained in:
parent
f76cddcc95
commit
b221257616
34 changed files with 8358 additions and 6744 deletions
|
|
@ -1,5 +1,4 @@
|
|||
// Rôle : regroupe les modales, notifications et viewers rendus au-dessus de l'application.
|
||||
import React from "react";
|
||||
import { Icon } from "./Icon.jsx";
|
||||
import { ImageViewer } from "./ImageViewer.jsx";
|
||||
import { ConfirmModal, CreateToolboxModal, LinkToolboxModal, NotificationToast } from "./ToolboxModals.jsx";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Rôle : structure le layout global avec sidebar, topbar, navigation et contenu.
|
||||
import React from "react";
|
||||
import { Icon } from "./Icon.jsx";
|
||||
import { ImportButton } from "./ImportButton.jsx";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Rôle : affiche le switch global de position des notifications internes.
|
||||
import React from "react";
|
||||
import { Icon } from "./Icon.jsx";
|
||||
|
||||
export function ToastPositionSwitch({ position, labels, onChange }) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : fournit une infobulle accessible et réutilisable pour les contrôles et données denses.
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
export function Tooltip({ as: Component = "span", children, content, className = "", tooltipClassName = "", position = "top", ...props }) {
|
||||
|
|
@ -8,7 +8,7 @@ export function Tooltip({ as: Component = "span", children, content, className =
|
|||
const [open, setOpen] = useState(false);
|
||||
const [style, setStyle] = useState({});
|
||||
|
||||
function placeTooltip() {
|
||||
const placeTooltip = useCallback(() => {
|
||||
const anchor = anchorRef.current;
|
||||
if (!anchor) return;
|
||||
const rect = anchor.getBoundingClientRect();
|
||||
|
|
@ -17,7 +17,7 @@ export function Tooltip({ as: Component = "span", children, content, className =
|
|||
return;
|
||||
}
|
||||
setStyle({ top: `${Math.max(8, rect.top - 8)}px`, left: `${Math.min(window.innerWidth - 8, Math.max(8, rect.left + rect.width / 2))}px` });
|
||||
}
|
||||
}, [position]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined;
|
||||
|
|
@ -28,7 +28,7 @@ export function Tooltip({ as: Component = "span", children, content, className =
|
|||
window.removeEventListener("resize", placeTooltip);
|
||||
window.removeEventListener("scroll", placeTooltip, true);
|
||||
};
|
||||
}, [open, position]);
|
||||
}, [open, placeTooltip]);
|
||||
|
||||
if (!content) return <Component className={className} {...props}>{children}</Component>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue