securityos/components/system/Apps/AppsLoader.tsx

33 lines
848 B
TypeScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
import { useProcesses } from "contexts/process";
import { AnimatePresence } from "framer-motion";
import dynamic from "next/dynamic";
import { memo } from "react";
const RenderComponent = dynamic(
() => import("components/system/Apps/RenderComponent")
);
const AppsLoader: FC = () => {
const { processes = {} } = useProcesses();
return (
<AnimatePresence initial={false} presenceAffectsLayout={false}>
{Object.entries(processes).map(
([id, { closing, Component, hasWindow }]) =>
id &&
Component &&
!closing && (
<RenderComponent
key={id}
Component={Component}
hasWindow={hasWindow}
id={id}
/>
)
)}
</AnimatePresence>
);
};
export default memo(AppsLoader);