From c3448542c4083497dd1e76a3b5b9b0c9a7a76be0 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Sat, 9 Nov 2024 17:26:37 -0600 Subject: [PATCH] Add template form --- .../thumbnails/ThumbnailManager.module.scss | 14 + .../src/thumbnails/ThumbnailManager.tsx | 308 +++++++++++++----- 2 files changed, 232 insertions(+), 90 deletions(-) diff --git a/thrimbletrimmer/src/thumbnails/ThumbnailManager.module.scss b/thrimbletrimmer/src/thumbnails/ThumbnailManager.module.scss index 2391be1..d941b5b 100644 --- a/thrimbletrimmer/src/thumbnails/ThumbnailManager.module.scss +++ b/thrimbletrimmer/src/thumbnails/ThumbnailManager.module.scss @@ -30,4 +30,18 @@ .templateUpdateErrors { color: #c00; +} + +.newTemplateFormFields { + display: grid; + grid-template-columns: max-content max-content; + gap: 1px; +} + +.newTemplateFieldLabelContainer { + display: contents; +} + +.newTemplateMidText { + margin: 2px; } \ No newline at end of file diff --git a/thrimbletrimmer/src/thumbnails/ThumbnailManager.tsx b/thrimbletrimmer/src/thumbnails/ThumbnailManager.tsx index b2d779b..9c7f783 100644 --- a/thrimbletrimmer/src/thumbnails/ThumbnailManager.tsx +++ b/thrimbletrimmer/src/thumbnails/ThumbnailManager.tsx @@ -1,4 +1,4 @@ -import { Accessor, Component, createSignal, For, Index, onMount, Show } from "solid-js"; +import { Accessor, Component, createSignal, For, Index, onMount, Setter, Show } from "solid-js"; import { GoogleSignIn, googleUser } from "../common/googleAuth"; import styles from "./ThumbnailManager.module.scss"; @@ -19,6 +19,7 @@ class Template { const ThumbnailManager: Component = () => { const [templates, setTemplates] = createSignal([]); + const [newTemplateErrors, setNewTemplateErrors] = createSignal([]); onMount(async () => { const templateDataResponse = await fetch("/thrimshim/templates"); @@ -46,6 +47,95 @@ const ThumbnailManager: Component = () => { setTemplates(templateList); }); + const submitHandler = async (origName: string, noImageIsError: boolean, errorList: Accessor, setErrorList: Setter, event: SubmitEvent): Promise