- enhanced modal animations

This commit is contained in:
2025-12-15 14:46:48 +00:00
parent 8b635101de
commit cae652477e
6 changed files with 51 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "in-car-system-fe", "name": "in-car-system-fe",
"private": true, "private": true,
"version": "1.0.17", "version": "1.0.18",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -21,6 +21,7 @@ type SightingModalProps = {
}; };
const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }: SightingModalProps) => { const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }: SightingModalProps) => {
console.log(sighting);
const { dispatch } = useAlertHitContext(); const { dispatch } = useAlertHitContext();
const { query, mutation } = useCameraBlackboard(); const { query, mutation } = useCameraBlackboard();
@@ -147,13 +148,13 @@ const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }:
{hotlistNames && hotlistNames.length > 0 && ( {hotlistNames && hotlistNames.length > 0 && (
<div className="flex flex-col border-b border-gray-600 mb-4"> <div className="flex flex-col border-b border-gray-600 mb-4">
<p className="text-gray-300">Hotlists</p> <p className="text-gray-300">Hotlists</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-[90%] lg:gap-x-[15%] w-[50%]"> <div className="grid grid-cols-1 md:grid-cols-2 md:gap-x-[20%] w-[50%]">
{hotlistNames.map((hotlistName, index) => ( {hotlistNames.map((hotlistName, index) => (
<div className="items-center px-2.5 py-0.5 rounded-sm me-2 bg-amber-500 w-55 m-2" key={index}> <span className="items-center px-2.5 py-0.5 rounded-sm me-2 bg-amber-500 w-50 m-2" key={index}>
<p className="font-medium text-2xl break-all text-amber-800"> <p className="font-medium text-2xl break-all text-amber-800">
{hotlistName ? hotlistName?.replace(/\.csv$/i, "") : "-"} {hotlistName ? hotlistName?.replace(/\.csv$/i, "") : "-"}
</p> </p>
</div> </span>
))} ))}
</div> </div>
</div> </div>

View File

@@ -12,8 +12,16 @@ const ModalComponent = ({ isModalOpen, children, close }: ModalComponentProps) =
<Modal <Modal
isOpen={isModalOpen} isOpen={isModalOpen}
onRequestClose={close} onRequestClose={close}
className="bg-[#1e2a38] p-3 rounded-lg shadow-lg w-[95%] mt-[2%] md:w-[60%] h-[100%] md:h-[95%] lg:h-[85%] z-[100] overflow-y-auto" className="bg-[#1e2a38] p-3 rounded-lg shadow-lg w-[95%] mt-[2%] md:w-[60%] h-[100%] md:h-[95%] lg:h-[80%] z-[100] overflow-y-hidden border border-gray-500"
overlayClassName="fixed inset-0 bg-[#1e2a38]/70 flex justify-center items-start z-100 " overlayClassName="fixed inset-0 bg-[#1e2a38]/70 flex justify-center items-start z-100 "
style={{
overlay: {
transition: "opacity 200ms ease-in-out",
},
content: {
transition: "all 200ms ease-in-out",
},
}}
> >
{children} {children}
</Modal> </Modal>

View File

@@ -15,10 +15,10 @@ const VersionsModal = ({ isDevModalOpen, handleClose, data }: VersionsModalProps
return ( return (
<ModalComponent isModalOpen={isDevModalOpen} close={handleClose}> <ModalComponent isModalOpen={isDevModalOpen} close={handleClose}>
<div className="flex justify-end"> <div className="flex justify-end overflow-auto">
<button <button
onClick={handleClose} onClick={handleClose}
className="p-2 border border-gray-600 rounded-md text-gray-200 hover:bg-gray-700 transition mb-4" className="p-2 border border-gray-600 rounded-md text-gray-200 hover:bg-gray-700 transition"
> >
Close Close
</button> </button>

View File

@@ -44,7 +44,10 @@ export const IntegrationsProvider = ({ children }: IntegrationsProviderType) =>
if (catResult?.result) { if (catResult?.result) {
dispatch({ type: "NPEDCATENABLED", payload: catResult.result }); dispatch({ type: "NPEDCATENABLED", payload: catResult.result });
} else { } else {
console.log("Early return: catResult check failed"); dispatch({
type: "NPEDCATENABLED",
payload: { catA: true, catB: true, catC: true, catD: true },
});
} }
} catch (error) { } catch (error) {
console.error("Error in fetchData:", error); console.error("Error in fetchData:", error);

View File

@@ -37,3 +37,33 @@ body {
stroke-width: 20px; stroke-width: 20px;
stroke-linejoin: round; stroke-linejoin: round;
} }
/* Modal animations */
.ReactModal__Overlay {
opacity: 0;
transition: opacity 200ms ease-in-out;
}
.ReactModal__Overlay--after-open {
opacity: 1;
}
.ReactModal__Overlay--before-close {
opacity: 0;
}
.ReactModal__Content {
transform: scale(0.9) translateY(-20px);
opacity: 0;
transition: all 200ms ease-in-out;
}
.ReactModal__Content--after-open {
transform: scale(1) translateY(0);
opacity: 1;
}
.ReactModal__Content--before-close {
transform: scale(0.9) translateY(-20px);
opacity: 0;
}