// import React, { FC, useEffect, useState } from "react"; // import { Routes, Route, Navigate, BrowserRouter } from "react-router-dom"; // import "./App.css"; // // import Buttons from "./components/buttons/Buttons"; // // import Colors from "./components/colors/Colors"; // // import Flipcard from "./components/flipcard/Flipcard"; // // import Fonts from "./components/fonts/Fonts"; // // import Forms from "./components/forms/Forms"; // // import Home from "./components/home/Home"; // // import Levels from "./components/levels/Levels"; // // import Modal from "./components/modal/Modal"; // // import MonthPicker from "./components/monthPicker"; // // import Multiselect from "./components/multiselect/Multiselect"; // // import Stepper from "./components/stepper/Stepper"; // // import Login from "./components/login/Login"; // // import { defineRequiredCwcElements } from "./cwc-elements-definitions" // // import { createRoot } from "react-dom/client"; // // import Textfield from "./components/textfield/Textfield"; // import onemoretime from "./components/onemoretime/onemoretime"; import angularTest from "./components/angularTest/angularTest"; //END IMPORTS - DO NOT REMOVE THIS LINE // const cwcElementsDefinedPromise = defineRequiredCwcElements() // export function AppRoutes() { // const [loadingState, setLoadingState] = useState<"loading" | "ok" | "error">("loading"); // // Wait until we finish loading the CWC microfrontend. // // Or else, the methods of the web components won't be available, and the app crashes (not good). // useEffect(() => { // cwcElementsDefinedPromise.then(({ loadedOk }) => { // if (loadedOk) { // setLoadingState("ok"); // } else { // setLoadingState("error"); // } // }); // }); // if (loadingState === "loading") return

Loading...

; // if (loadingState === "error") return

Oops... couldn't load Midnight microfrontend

; // return ( // // }> // }> // }> // }> // }> // }> // }> // }> // }> // }> // }> // }> // }> // }> }> {/* END ROUTES - DO NOT REMOVE THIS LINE */} // } // /> // // ); // } // // @ts-ignore // const styles = [...document.getElementsByTagName('style')].map(tag => tag.innerText).join('') // /** // * @param basename To make the router work, basename should be the path where the host app is loading foundations. // * For example, if https://host.com/foundations loads foundations, then basename should be '/foundations' // */ // const AppMFE: FC<{ basename?: string }> = ({ basename }) => ( // <> // // // // // // // ); // class StandaloneWebComponent extends HTMLElement { // mountPoint!: HTMLSpanElement; // styleTag: HTMLStyleElement; // // This wrapper is required in order to use `useState`, // // so AppMFE will listen to React attribute changes. // AppMFEWrapper: FC = () => { // const [basename, setBasename] = useState(this.getAttribute("basename") ?? undefined); // this.wrapperBasenameSetter = setBasename; // return // } // // We save the React state setter to call it from attributeChangedCallback. // wrapperBasenameSetter?: (basename: undefined | string) => void; // constructor() { // super() // this.styleTag = document.createElement('style') as HTMLStyleElement; // this.styleTag.innerHTML = `${styles}` // } // attributeChangedCallback(name: string, oldValue: string, newValue: string) { // if (name === "basename") { // if (this.wrapperBasenameSetter) { // this.wrapperBasenameSetter(newValue) // } // } // } // connectedCallback() { // const mountPoint = document.createElement("span"); // mountPoint.appendChild(this.styleTag) // this.attachShadow({ mode: "open" }).appendChild(mountPoint); // const root = createRoot(mountPoint); // createRoot(container!) if you use TypeScript // root.render(); // // const linkGlobalStyles = this.shadowRoot?.getElementById('linkGlobalStyles'); // // this.styleTag?.addEventListener('load', () => { // // console.log('loaded!!!'); // // }) // // setTimeout(() => {console.log('connected!', this.styleTag, this.linkGlobalStyles)}, 1000) // } // } // const init = () => { // window.customElements.get("cwc-foundations") || window.customElements.define("cwc-foundations", StandaloneWebComponent); // return Promise.resolve('cwc-foundations') // } // export default init();