Skip to content

Commit

Permalink
Merge pull request #263 from Aar-if/workspace
Browse files Browse the repository at this point in the history
Issue #PS-2103: Add Workspace UI implementation in admin portal
  • Loading branch information
itsvick authored Oct 15, 2024
2 parents e00f5fb + d7a7d1b commit 881cee0
Showing 1 changed file with 2 additions and 42 deletions.
44 changes: 2 additions & 42 deletions src/pages/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,12 @@
import React, { useEffect, useState } from "react";
import dynamic from "next/dynamic";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Loader from "@/components/Loader";
import { useTranslation } from "next-i18next";

// @ts-ignore
const Editors = dynamic(() => import("editor/Editor"), { ssr: false });

const Editor = () => {
const { t } = useTranslation();
const [isAssetsLoaded, setIsAssetsLoaded] = useState(false);

useEffect(() => {
const loadScriptAndStyles = () => {
if (!document.getElementById("sunbird-editor-css")) {
const link = document.createElement("link");
link.id = "sunbird-editor-css";
link.rel = "stylesheet";
link.href =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected]/styles.css";
document.head.appendChild(link);
}

if (!document.getElementById("sunbird-editor-script")) {
const script = document.createElement("script");
script.id = "sunbird-editor-script";
script.src =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected]/sunbird-questionset-editor.js";
script.async = true;
script.onload = () => setIsAssetsLoaded(true);
document.body.appendChild(script);
} else {
setIsAssetsLoaded(true);
}
};

loadScriptAndStyles();
}, []);

return (
<div>
{isAssetsLoaded ? (
<Editors />
) : (
<Loader showBackdrop={false} loadingText={t("COMMON.LOADING")} />
)}
</div>
);
return <Editors />;
};

export default Editor;
Expand All @@ -58,4 +18,4 @@ export async function getStaticProps({ locale }: any) {
...(await serverSideTranslations(locale, ["common"])),
},
};
}
}

0 comments on commit 881cee0

Please sign in to comment.