diff --git a/src/api-calls/homebrew/_homebrewCollection.type.ts b/src/api-calls/homebrew/_homebrewCollection.type.ts index a98f1675..82b1d92a 100644 --- a/src/api-calls/homebrew/_homebrewCollection.type.ts +++ b/src/api-calls/homebrew/_homebrewCollection.type.ts @@ -6,6 +6,7 @@ export interface BaseHomebrewCollectionDocument { type: PackageTypes; id: string; title: string; + description?: string; editors: string[]; viewers?: string[]; creator: string; diff --git a/src/pages/Homebrew/HomebrewEditorPage/AboutSection/AboutSection.tsx b/src/pages/Homebrew/HomebrewEditorPage/AboutSection/AboutSection.tsx index 70c26d97..87e174fa 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/AboutSection/AboutSection.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/AboutSection/AboutSection.tsx @@ -23,6 +23,7 @@ import { arrayRemove } from "firebase/firestore"; import { removeSelfAsEditor } from "api-calls/homebrew/editorFunction/removeSelfAsEditor"; import { useNavigate } from "react-router-dom"; import { BASE_ROUTES, basePaths } from "routes"; +import { Description } from "./Description"; export interface AboutSectionProps { id: string; @@ -131,6 +132,15 @@ export function AboutSection(props: AboutSectionProps) { /> )} + {(!!details.description || isEditor) && ( + + + + )} {details.type === PackageTypes.Expansion && ( Expansion For diff --git a/src/pages/Homebrew/HomebrewEditorPage/AboutSection/Description.tsx b/src/pages/Homebrew/HomebrewEditorPage/AboutSection/Description.tsx new file mode 100644 index 00000000..9664887a --- /dev/null +++ b/src/pages/Homebrew/HomebrewEditorPage/AboutSection/Description.tsx @@ -0,0 +1,37 @@ +import { Box } from "@mui/material"; +import { MarkdownRenderer } from "components/shared/MarkdownRenderer"; +import { MarkdownEditor } from "components/shared/RichTextEditor/MarkdownEditor"; +import { useState } from "react"; +import { useStore } from "stores/store"; + +export interface DescriptionProps { + expansionId: string; + description?: string; + isEditor?: boolean; +} + +export function Description(props: DescriptionProps) { + const { expansionId, description, isEditor } = props; + const updateDetails = useStore((store) => store.homebrew.updateExpansion); + + const [localDescription, setLocalDescription] = useState(description ?? ""); + + const handleSave = () => { + updateDetails(expansionId, { description: localDescription }); + }; + + return ( + theme.breakpoints.values.md}> + {isEditor ? ( + setLocalDescription(value)} + onBlur={handleSave} + /> + ) : ( + + )} + + ); +} diff --git a/src/types/World.type.ts b/src/types/World.type.ts index 6da6ad02..ad47b9a3 100644 --- a/src/types/World.type.ts +++ b/src/types/World.type.ts @@ -5,12 +5,14 @@ export type TRUTH_IDS = (typeof truthIds)[number]; export interface World { name: string; - truths?: { [key: string]: Truth }; newTruths?: Record; ownerIds: string[]; worldDescription?: Uint8Array; + // Deprecated, use newTruths instead + truths?: { [key: string]: Truth }; } +// Deprecated export interface Truth { customTruth?: TruthOptionClassic; selectedSubItemId?: string | null;