diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx index f694cbadd..0e16e03b8 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx @@ -138,7 +138,8 @@ function SessionPage({ data, game, playtype }: UGPT & { data: SessionReturns }) { const newSession: SessionReturns = { ...sessionData, @@ -156,7 +157,8 @@ function SessionPage({ data, game, playtype }: UGPT & { data: SessionReturns }) /> { const newSession: SessionReturns = { diff --git a/client/src/components/targets/quests/editor/EditableQuest.tsx b/client/src/components/targets/quests/editor/EditableQuest.tsx index a2a7be1e1..50291dce9 100644 --- a/client/src/components/targets/quests/editor/EditableQuest.tsx +++ b/client/src/components/targets/quests/editor/EditableQuest.tsx @@ -24,48 +24,33 @@ export default function EditableQuest({ return ( +
+ as="h1" + initialText={quest.name} + placeholderText={quest.name || "Untitled Quest"} + onSubmit={(name) => onChange({ ...quest, name, }) } - > - {(text) => ( -

- {text} - - - -

- )} -
+ authorised + /> + initialText={quest.desc} + placeholderText={quest.desc || "Please set a description."} + onSubmit={(desc) => onChange({ ...quest, desc, }) } - > - {(desc) => ( -
- {desc} - - - -
- )} -
+ authorised + /> -
- Game: {FormatGame(quest.game, quest.playtype)} -
+ Game: {FormatGame(quest.game, quest.playtype)}
} > @@ -157,43 +142,33 @@ function QuestSection({ const [show, setShow] = useState(false); return ( -
- - onChange({ - ...section, - title, - }) - } - > - {(text) => ( -
- {text} - - - -
- )} -
- - onChange({ - ...section, - desc, - }) - } - > - {(desc) => ( -
- {desc === "" ? No Description... : desc} - - - -
- )} -
+ <> +
+ + onChange({ + ...section, + title, + }) + } + authorised + /> + + + onChange({ + ...section, + desc, + }) + } + authorised + /> +

{section.rawGoals.length === 0 ? ( No Goals... @@ -252,7 +227,7 @@ function QuestSection({ }} /> )} -
+ ); } diff --git a/client/src/components/util/EditableText.tsx b/client/src/components/util/EditableText.tsx index e902389b1..eb6735c7f 100644 --- a/client/src/components/util/EditableText.tsx +++ b/client/src/components/util/EditableText.tsx @@ -1,27 +1,34 @@ import React, { useState } from "react"; import { Button, Form, InputGroup } from "react-bootstrap"; import Icon from "./Icon"; +import Muted from "./Muted"; export default function EditableText({ as = "p", onSubmit, - initial, - authorised, + initialText, + placeholderText, className, + authorised, }: { as?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span"; onSubmit: (value: string) => void; - initial: string; - authorised: boolean; + initialText: string; + placeholderText: string; className?: string; + authorised: boolean; }) { - const [text, setText] = useState(initial); + const [text, setText] = useState(initialText); const [editing, setEditing] = useState(false); if (editing) { return ( - setText(e.target.value)} /> + setText(e.target.value)} + />