aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/components
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-04-29 13:26:09 -0400
committerXe Iaso <me@xeiaso.net>2023-04-29 13:26:09 -0400
commit042d4fa9523edb9b0613902d67452df10078c836 (patch)
tree377a856295cdefa79ff5f807b1370c975e899e7a /src/frontend/components
parent9d9614ad8a4a1d00f7df1b0e37ec32d324151335 (diff)
downloadxesite-yarn.tar.xz
xesite-yarn.zip
fucking horrible typescript garbageyarn
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'src/frontend/components')
-rw-r--r--src/frontend/components/ConvSnippet.tsx3
-rw-r--r--src/frontend/components/MastodonShareButton.tsx32
-rw-r--r--src/frontend/components/NoFunAllowed.tsx7
-rw-r--r--src/frontend/components/Video.tsx22
-rw-r--r--src/frontend/components/WASITerm.tsx18
5 files changed, 36 insertions, 46 deletions
diff --git a/src/frontend/components/ConvSnippet.tsx b/src/frontend/components/ConvSnippet.tsx
index 9644333..99c254e 100644
--- a/src/frontend/components/ConvSnippet.tsx
+++ b/src/frontend/components/ConvSnippet.tsx
@@ -1,6 +1,3 @@
-// @jsxImportSource xeact
-// @jsxRuntime automatic
-
export interface ConvSnippetProps {
name: string;
mood: string;
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",
diff --git a/src/frontend/components/NoFunAllowed.tsx b/src/frontend/components/NoFunAllowed.tsx
index 9f5c5f5..249bcbf 100644
--- a/src/frontend/components/NoFunAllowed.tsx
+++ b/src/frontend/components/NoFunAllowed.tsx
@@ -1,7 +1,4 @@
-// @jsxImportSource xeact
-// @jsxRuntime automatic
-
-import { c } from "xeact";
+import { c } from "@xeserv/xeact";
const onclick = () => {
Array.from(c("xeblog-slides-fluff")).forEach((el) =>
@@ -13,7 +10,7 @@ export default function NoFunAllowed() {
const button = (
<button
class=""
- onclick={() => onclick()}
+ onClick={() => onclick()}
>
No fun allowed
</button>
diff --git a/src/frontend/components/Video.tsx b/src/frontend/components/Video.tsx
index 812e6bd..1d83319 100644
--- a/src/frontend/components/Video.tsx
+++ b/src/frontend/components/Video.tsx
@@ -1,7 +1,5 @@
-// @jsxImportSource xeact
-// @jsxRuntime automatic
-
-import Hls from "@hls.js";
+import Hls from "hls.js";
+import { h } from "@xeserv/xeact";
export interface VideoProps {
path: string;
@@ -9,16 +7,12 @@ export interface VideoProps {
export default function Video({ path }: VideoProps) {
const streamURL =
- `https://cdn.xeiaso.net/file/christine-static/${path}/index.m3u8`;
- const video = (
- <video style="width:100%" controls>
- <source src={streamURL} type="application/vnd.apple.mpegurl" />
- <source
- src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4"
- type="video/mp4"
- />
- </video>
- );
+ `https://cdn.xeiaso.net/file/christine-static/${path}/index.m3u8`;
+ const video: HTMLVideoElement =
+ h("video", {style: "width:100%", controls: true}, [
+ h("source", {src: streamURL, type: "application/vnd.apple.mpegurl"}, []),
+ h("source", {src: "https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4", type: "video/mp4"}, [])
+ ]) as unknown as HTMLVideoElement;
if (Hls.isSupported()) {
const hls = new Hls();
diff --git a/src/frontend/components/WASITerm.tsx b/src/frontend/components/WASITerm.tsx
index 5f7e7f9..644f293 100644
--- a/src/frontend/components/WASITerm.tsx
+++ b/src/frontend/components/WASITerm.tsx
@@ -1,9 +1,6 @@
-// @jsxImportSource xeact
-// @jsxRuntime automatic
-
-import { t, x } from "xeact";
-import Terminal from "@xterm";
-import * as fitAdd from "@xterm/addon-fit";
+import { t, x, h } from "@xeserv/xeact";
+import { Terminal } from "xterm";
+import { FitAddon } from 'xterm-addon-fit';
import { Fd, File, PreopenDirectory, WASI } from "@bjorn3/browser_wasi_shim";
class XtermStdio extends Fd {
@@ -41,16 +38,17 @@ export interface WASITermProps {
}
export default function WASITerm({ href, env, args }: WASITermProps) {
- const root = <div style="max-width:80ch;max-height:20ch"></div>;
+ const root = h("div", {style:"max-width:80ch;max-height:20ch"}, []);
const term = new Terminal({
convertEol: true,
fontFamily: "Iosevka Curly Iaso",
});
- const fit = new fitAdd.default();
- term.loadAddon(fit);
- fit.fit();
+ const fitAddon = new FitAddon();
+ term.loadAddon(fitAddon);
+ term.open(root);
+ fitAddon.fit();
return (
<div>