From 042d4fa9523edb9b0613902d67452df10078c836 Mon Sep 17 00:00:00 2001
From: Xe Iaso <me@xeiaso.net>
Date: Sat, 29 Apr 2023 13:26:09 -0400
Subject: fucking horrible typescript garbage

Signed-off-by: Xe Iaso <me@xeiaso.net>
---
 src/frontend/components/MastodonShareButton.tsx | 32 ++++++++++++++-----------
 1 file changed, 18 insertions(+), 14 deletions(-)

(limited to 'src/frontend/components/MastodonShareButton.tsx')

diff --git a/src/frontend/components/MastodonShareButton.tsx b/src/frontend/components/MastodonShareButton.tsx
index d809ee9..a0d56f0 100644
--- a/src/frontend/components/MastodonShareButton.tsx
+++ b/src/frontend/components/MastodonShareButton.tsx
@@ -1,17 +1,15 @@
-// @jsxImportSource xeact
-// @jsxRuntime automatic
-
-import { u, useState } from "xeact";
+import { u } from "@xeserv/xeact";
+import { useState } from 'preact/hooks';
 
 export interface MastodonShareButtonProps {
   title: string;
   url: string;
   series?: string;
-  tags: string;
+  tags: string[];
 }
 
 export default function MastodonShareButton(
-  { title, url = u(), series, tags }: MastodonShareButtonProps,
+  { title, url = u("", {}), series, tags }: MastodonShareButtonProps,
 ) {
   let defaultURL = localStorage["mastodon_instance"];
 
@@ -27,8 +25,8 @@ ${series ? "#" + series + " " : ""}${
     tags ? tags.map((x) => "#" + x).join(" ") : ""
   } @cadey@pony.social`;
 
-  const [getURL, setURL] = useState(defaultURL);
-  const [getToot, setToot] = useState(tootTemplate);
+  const [theURL, setURL] = useState(defaultURL);
+  const [toot, setToot] = useState(tootTemplate);
 
   return (
     <div>
@@ -40,27 +38,33 @@ ${series ? "#" + series + " " : ""}${
           type="text"
           placeholder="https://pony.social"
           value={defaultURL}
-          oninput={(e) => setURL(e.target.value)}
+            onInput={(e) => {
+                const target = e.target as HTMLInputElement;
+                setURL(target.value);
+            }}
         />
         <br />
         <textarea
           rows={6}
           cols={40}
-          oninput={(e) => setToot(e.target.value)}
+            onInput={(e) => {
+                const target = e.target as HTMLTextAreaElement;
+                setToot(target.value)
+            }}
         >
-          {getToot()}
+          {toot}
         </textarea>
         <br />
         <button
-          onclick={() => {
-            let instanceURL = getURL();
+          onClick={() => {
+            let instanceURL = theURL;
 
             if (!instanceURL.startsWith("https://")) {
               instanceURL = `https://${instanceURL}`;
             }
 
             localStorage["mastodon_instance"] = instanceURL;
-            const text = getToot();
+            const text = toot;
             const mastodonURL = u(instanceURL + "/share", {
               text,
               visibility: "public",
-- 
cgit v1.2.3

