diff --git a/app/src/components/GuideMobileMenu.tsx b/app/src/components/GuideMobileMenu.tsx index 2ca4c51d..612eab54 100644 --- a/app/src/components/GuideMobileMenu.tsx +++ b/app/src/components/GuideMobileMenu.tsx @@ -44,7 +44,7 @@ export function GuideMobileMenu({ return ( <> - + )} @@ -112,7 +124,7 @@ export const StepperActionHeader = ({ - + {(onSaveDraft || !hideBackBtn || onPublish) && (
diff --git a/app/src/components/contribute/steps/Content.tsx b/app/src/components/contribute/steps/Content.tsx index 607c66d2..42d67e0b 100644 --- a/app/src/components/contribute/steps/Content.tsx +++ b/app/src/components/contribute/steps/Content.tsx @@ -1,61 +1,39 @@ import { Suspense, lazy, useEffect, useState } from "react"; -import type { ContributionType } from "@/types/contributions"; -import { StepperActionHeader } from "@/components/contribute/StepperActionHeader"; const Editor = lazy(() => import("../editor/Editor")); type PropTypes = { - Stepper: any; - type: ContributionType | null; body: string; onBodyChange: (body: string) => void; onUploadImage?: (file: File) => Promise; - onSaveDraft: () => void; - submitting?: boolean; - title?: string; }; -export const Content = ({ - Stepper, - type, - body, - onBodyChange, - onUploadImage, - onSaveDraft, - submitting, - title = "Content", -}: PropTypes) => { +export const Content = ({ body, onBodyChange, onUploadImage }: PropTypes) => { const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); - return ( - - + if (mounted) { + return ( + }> + + + ); + } else { + return ; + } +}; - {mounted && ( - - Loading Editor... -
- } - > - - - )} - +const EditorFallback = () => { + return ( +
+ Loading Editor... +
); }; diff --git a/app/src/components/contribute/steps/GuideDetails.tsx b/app/src/components/contribute/steps/GuideDetails.tsx deleted file mode 100644 index 18366d30..00000000 --- a/app/src/components/contribute/steps/GuideDetails.tsx +++ /dev/null @@ -1,528 +0,0 @@ -import { X } from "lucide-react"; -import { useState } from "react"; -import { normalizeTodoTitle, todoPrereqSchema } from "@bluelearn/schemas"; -import type { Dispatch, SetStateAction } from "react"; -import type { - ContributionType, - GuideContribution, -} from "@/types/contributions"; - -import { StepperActionHeader } from "@/components/contribute/StepperActionHeader"; -import { - Field, - FieldDescription, - FieldError, - FieldGroup, - FieldLabel, -} from "@/components/ui/field"; -import { Input } from "@/components/ui/input"; - -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { Combobox } from "@/components/ui/combobox"; - -type SubjectOption = { id: string; name: string }; -type GuideOption = { - slug: string | null; - title: string | null; - summary: string | null; -}; - -type PropTypes = { - Stepper: any; - type: ContributionType | null; - guideContData: GuideContribution; - setGuideContData: Dispatch>; - subjects: Array; - guides: Array; - onSaveDraft: () => void; - submitting?: boolean; - showBaseFields?: boolean; - hideBackBtn?: boolean; - title?: string; - changeSummary?: string; - onChangeSummaryChange?: (value: string) => void; -}; - -export const GuideDetails = ({ - Stepper, - type, - guideContData, - setGuideContData, - subjects, - guides, - onSaveDraft, - submitting, - // Prerequisites and todos live on the guide base, so they're only - // authorable while the base is still a draft. - showBaseFields = true, - hideBackBtn, - title = "Guide Details", - changeSummary, - onChangeSummaryChange, -}: PropTypes) => { - const [todoPrereq, setTodoPrereq] = useState<{ - title: string; - summary: string; - }>({ - title: "", - summary: "", - }); - const [todoPrereqError, setTodoPrereqError] = useState<{ - field: "title" | "summary"; - message: string; - } | null>(null); - const [newSubject, setNewSubject] = useState<{ - name: string; - summary: string; - }>({ - name: "", - summary: "", - }); - - return ( - - - - - {showBaseFields && ( - <> -
- - Type - - - Choose whether this guide explains a concept or teaches a - process for accomplishing a goal. - -
- - - - - - - )} - -
- - Title - - - A clear, concise name for your guide. - -
- - - setGuideContData((prev) => ({ - ...prev, - title: e.target.value, - })) - } - /> -
- - -
- - Summary - - - Briefly describe what the reader will learn from this guide. - -
- -