mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-03 18:47:56 +01:00
9233b3dbd7
Co-authored-by: Sylvia Crowe <software@oneirocosm.com> Co-authored-by: sawka <mike.sawka@gmail.com>
27 lines
854 B
TypeScript
27 lines
854 B
TypeScript
// Copyright 2024, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { atoms } from "@/store/global";
|
|
import { modalsModel } from "@/store/modalmodel";
|
|
import * as jotai from "jotai";
|
|
import { getModalComponent } from "./modalregistry";
|
|
import { TosModal } from "./tos";
|
|
|
|
const ModalsRenderer = () => {
|
|
const clientData = jotai.useAtomValue(atoms.client);
|
|
const [modals] = jotai.useAtom(modalsModel.modalsAtom);
|
|
const rtn: JSX.Element[] = [];
|
|
for (const modal of modals) {
|
|
const ModalComponent = getModalComponent(modal.displayName);
|
|
if (ModalComponent) {
|
|
rtn.push(<ModalComponent key={modal.displayName} {...modal.props} />);
|
|
}
|
|
}
|
|
if (!clientData.tosagreed) {
|
|
rtn.push(<TosModal key={TosModal.displayName} />);
|
|
}
|
|
return <>{rtn}</>;
|
|
};
|
|
|
|
export { ModalsRenderer };
|