|
|
|
@ -55,12 +55,7 @@ interface RackedPlayer {
|
|
|
|
|
key: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function Editor({
|
|
|
|
|
id,
|
|
|
|
|
name,
|
|
|
|
|
courtType,
|
|
|
|
|
content,
|
|
|
|
|
}: EditorProps) {
|
|
|
|
|
export default function Editor({ id, name, courtType, content }: EditorProps) {
|
|
|
|
|
const isInGuestMode = id == -1
|
|
|
|
|
|
|
|
|
|
const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY)
|
|
|
|
@ -68,11 +63,16 @@ export default function Editor({
|
|
|
|
|
isInGuestMode && storage_content != null ? storage_content : content
|
|
|
|
|
|
|
|
|
|
const storage_name = localStorage.getItem(GUEST_MODE_TITLE_STORAGE_KEY)
|
|
|
|
|
const editorName = isInGuestMode && storage_name != null ? storage_name : name
|
|
|
|
|
const editorName =
|
|
|
|
|
isInGuestMode && storage_name != null ? storage_name : name
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<EditorView
|
|
|
|
|
tactic={{ name: editorName, id, content: JSON.parse(editorContent) }}
|
|
|
|
|
tactic={{
|
|
|
|
|
name: editorName,
|
|
|
|
|
id,
|
|
|
|
|
content: JSON.parse(editorContent),
|
|
|
|
|
}}
|
|
|
|
|
onContentChange={async (content: TacticContent) => {
|
|
|
|
|
if (isInGuestMode) {
|
|
|
|
|
localStorage.setItem(
|
|
|
|
@ -94,7 +94,8 @@ export default function Editor({
|
|
|
|
|
(r) => r.ok,
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
courtType={courtType}/>
|
|
|
|
|
courtType={courtType}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|