diff --git a/messages/az.json b/messages/az.json
index 98e73f0..250e3e2 100644
--- a/messages/az.json
+++ b/messages/az.json
@@ -34,7 +34,6 @@
"resources": "Resurslar",
"questions": "Suallar",
"previous": "Əvvəlki",
- "next": "Növbəti",
- "task": "Tapşırıq"
+ "next": "Növbəti"
}
-}
\ No newline at end of file
+}
diff --git a/messages/en.json b/messages/en.json
index fb23515..a200ea3 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -34,7 +34,6 @@
"resources": "Resources",
"questions": "Questions",
"previous": "Previous",
- "next": "Next",
- "task": "Task"
+ "next": "Next"
}
-}
\ No newline at end of file
+}
diff --git a/next-env.d.ts b/next-env.d.ts
index c4b7818..20e7bcf 100644
--- a/next-env.d.ts
+++ b/next-env.d.ts
@@ -1,6 +1,6 @@
///
///
-import "./.next/dev/types/routes.d.ts";
+import './.next/dev/types/routes.d.ts';
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/src/app/(protected)/admin/planet/add/components/AddPlanetClient.tsx b/src/app/(protected)/admin/planet/add/components/AddPlanetClient.tsx
index 4703190..e765a17 100644
--- a/src/app/(protected)/admin/planet/add/components/AddPlanetClient.tsx
+++ b/src/app/(protected)/admin/planet/add/components/AddPlanetClient.tsx
@@ -12,6 +12,7 @@ import PlanetDetails from '@/components/shared/planet-details/PlanetDetails';
import { useOrphanedImageCleanup } from '@/lib/hooks/admin/useOrphanedImageCleanup';
import ExitPreviewButton from '@/components/admin/ui/ExitPreviewButton';
import { PLANET_CATEGORY } from '@/lib/constants/planet';
+import { usePreventScroll } from '@/lib/hooks/ui/usePreventScroll';
interface Props {
category: PlanetCategory;
}
@@ -50,6 +51,8 @@ const AddPlanetClient = ({ category }: Props) => {
useOrphanedImageCleanup(planetData, setPendingContentImages);
+ usePreventScroll(previewActive);
+
const labels = {
researchTopics: 'Research Topics',
resources: 'Resources',
@@ -62,7 +65,7 @@ const AddPlanetClient = ({ category }: Props) => {
return (
<>
{previewActive && (
-
+
setPreviewActive(false)} />
{
// Remove orphaned content images: keep only images referenced by any content in any locale
useOrphanedImageCleanup(planetData, setPendingContentImages);
+ usePreventScroll(previewActive);
+
const labels = {
researchTopics: 'Research Topics',
resources: 'Resources',
@@ -62,7 +65,7 @@ const UpdatePlanetClient = ({ planetId, step, initialData }: Props) => {
return (
<>
{previewActive && (
-
+
setPreviewActive(false)} />
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const editorRef = useRef(null);
diff --git a/src/components/shared/planet-details/CodePreview.tsx b/src/components/shared/planet-details/CodePreview.tsx
index f05cf85..139efd7 100644
--- a/src/components/shared/planet-details/CodePreview.tsx
+++ b/src/components/shared/planet-details/CodePreview.tsx
@@ -19,7 +19,7 @@ const CodePreview = ({
height,
paddingTop = 20,
paddingBottom = 20,
- fontSize = 18,
+ fontSize = 16,
color,
}: Props) => {
return (
diff --git a/src/components/shared/planet-details/ContentList.tsx b/src/components/shared/planet-details/ContentList.tsx
index fe3e36d..6b45174 100644
--- a/src/components/shared/planet-details/ContentList.tsx
+++ b/src/components/shared/planet-details/ContentList.tsx
@@ -4,14 +4,13 @@ import Content from './contents/Content';
interface Props {
contents: PlanetContent[];
- labels: Record;
}
-const ContentList = ({ contents, labels }: Props) => {
+const ContentList = ({ contents }: Props) => {
return (
{contents.map((content) => (
-
+
))}
);
diff --git a/src/components/shared/planet-details/PlanetDetails.tsx b/src/components/shared/planet-details/PlanetDetails.tsx
index 9bae536..6d28e75 100644
--- a/src/components/shared/planet-details/PlanetDetails.tsx
+++ b/src/components/shared/planet-details/PlanetDetails.tsx
@@ -30,9 +30,7 @@ const PlanetDetails = ({ planet, labels }: Props) => {
{resources && resources.length > 0 && (
)}
- {contents && contents.length > 0 && (
-
- )}
+ {contents && contents.length > 0 && }
{questions && questions.length > 0 && (
)}
diff --git a/src/components/shared/planet-details/Questions.tsx b/src/components/shared/planet-details/Questions.tsx
index 6f5ec4b..1b8da02 100644
--- a/src/components/shared/planet-details/Questions.tsx
+++ b/src/components/shared/planet-details/Questions.tsx
@@ -1,5 +1,7 @@
import type { Question } from '@/types/planet';
+import CustomMarkdown from './contents/CustomMarkdown';
+
interface Props {
questions: Question[];
labels: Record;
@@ -15,7 +17,7 @@ const Questions = ({ questions, labels }: Props) => {
{idx + 1}.
- {qn.question}
+
))}
diff --git a/src/components/shared/planet-details/ResearchTopics.tsx b/src/components/shared/planet-details/ResearchTopics.tsx
index cbc76de..c49ec64 100644
--- a/src/components/shared/planet-details/ResearchTopics.tsx
+++ b/src/components/shared/planet-details/ResearchTopics.tsx
@@ -1,5 +1,7 @@
import type { ResearchTopic } from '@/types/planet';
+import CustomMarkdown from './contents/CustomMarkdown';
+
interface Props {
researchTopics: ResearchTopic[];
labels: Record;
@@ -11,7 +13,9 @@ const ResearchTopics = ({ researchTopics, labels }: Props) => {
{labels.researchTopics}
{researchTopics.map((topic) => (
- - {topic.topic}
+ -
+
+
))}
diff --git a/src/components/shared/planet-details/contents/Content.tsx b/src/components/shared/planet-details/contents/Content.tsx
index 3deb574..983eb2f 100644
--- a/src/components/shared/planet-details/contents/Content.tsx
+++ b/src/components/shared/planet-details/contents/Content.tsx
@@ -8,16 +8,15 @@ import ImageBlock from './ImageBlock';
interface Props {
content: PlanetContent;
- labels: Record;
}
-const Content = ({ content, labels }: Props) => {
+const Content = ({ content }: Props) => {
switch (content.type) {
case 'text':
return ;
case 'implementation-task':
- return ;
+ return ;
case 'html-element':
return ;
diff --git a/src/components/shared/planet-details/contents/CustomMarkdown.tsx b/src/components/shared/planet-details/contents/CustomMarkdown.tsx
index 4c1026a..a1234f8 100644
--- a/src/components/shared/planet-details/contents/CustomMarkdown.tsx
+++ b/src/components/shared/planet-details/contents/CustomMarkdown.tsx
@@ -2,15 +2,15 @@ import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { cn } from '@/lib/utils/cn';
-
interface Props {
text: string;
className?: string;
+ inline?: boolean;
}
-
-const CustomMarkdown = ({ text, className }: Props) => {
+const CustomMarkdown = ({ text, className, inline }: Props) => {
+ const Wrapper = inline ? 'span' : 'div';
return (
- {
className,
)}
>
- {text}
-
+ children } : undefined}
+ >
+ {text}
+
+
);
};
-
export default CustomMarkdown;
diff --git a/src/components/shared/planet-details/contents/HtmlElementBlock.tsx b/src/components/shared/planet-details/contents/HtmlElementBlock.tsx
index 68a435d..56c9dae 100644
--- a/src/components/shared/planet-details/contents/HtmlElementBlock.tsx
+++ b/src/components/shared/planet-details/contents/HtmlElementBlock.tsx
@@ -4,28 +4,24 @@ import { useEffect, useState, useRef } from 'react';
import type { HtmlElementContent } from '@/types/planet';
import CustomMarkdown from './CustomMarkdown';
-
interface Props {
content: HtmlElementContent;
}
-
const HtmlElementBlock = ({ content }: Props) => {
const { title, description, element } = content;
const { html, css, js } = element;
const [iframeHeight, setIframeHeight] = useState(300);
const iframeRef = useRef(null);
-
useEffect(() => {
const handleMessage = (e: MessageEvent) => {
+ if (e.source !== iframeRef.current?.contentWindow) return;
if (e.data.type === 'resize') {
setIframeHeight(e.data.height);
}
};
-
window.addEventListener('message', handleMessage);
return () => window.removeEventListener('message', handleMessage);
}, []);
-
const iframeContent = `
@@ -41,19 +37,15 @@ const HtmlElementBlock = ({ content }: Props) => {
${html}