import { Accessor, Component, createSignal, For, Index, onMount, Setter, Show } from "solid-js"; import { GoogleSignIn, googleUser } from "../common/googleAuth"; import styles from "./ThumbnailManager.module.scss"; class Coordinate { x: number; y: number; } class Template { name: string; description: string; attribution: string; cropStart: Coordinate; cropEnd: Coordinate; locationStart: Coordinate; locationEnd: Coordinate; } const ThumbnailManager: Component = () => { const [templates, setTemplates] = createSignal([]); const [newTemplateErrors, setNewTemplateErrors] = createSignal([]); onMount(async () => { const templateDataResponse = await fetch("/thrimshim/templates"); if (!templateDataResponse.ok) { return; } const templateData = await templateDataResponse.json(); const templateList: Template[] = []; for (const template of templateData) { const cropStart = { x: template.crop[0], y: template.crop[1] }; const cropEnd = { x: template.crop[2], y: template.crop[3] }; const locationStart = { x: template.location[0], y: template.location[1] }; const locationEnd = { x: template.location[2], y: template.location[3] }; templateList.push({ name: template.name, description: template.description, attribution: template.attribution, cropStart: cropStart, cropEnd: cropEnd, locationStart: locationStart, locationEnd: locationEnd, }); } setTemplates(templateList); }); const submitHandler = async ( origName: string, noImageIsError: boolean, errorList: Accessor, setErrorList: Setter, event: SubmitEvent, ): Promise