creates video voice memos from audio clips; with bluesky integration. trill.ptr.pet
1/* @refresh reload */ 2import { render } from "solid-js/web"; 3import "solid-devtools"; 4import "./index.css"; 5 6import type {} from "@atcute/atproto"; 7import type {} from "@atcute/bluesky"; 8import type {} from "@atcute/microcosm"; 9 10import App from "./App"; 11import { tryFinalizeLogin } from "./lib/oauth"; 12import { accounts, setAccounts } from "./lib/accounts"; 13import { AtprotoDid } from "@atcute/lexicons/syntax"; 14import { toaster } from "./components/Toaster"; 15 16const root = document.getElementById("root"); 17 18if (import.meta.env.DEV && !(root instanceof HTMLElement)) { 19 throw new Error( 20 "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?", 21 ); 22} 23 24const prefersDarkScheme = window.matchMedia( 25 "(prefers-color-scheme: dark)", 26).matches; 27document.documentElement.dataset.theme = prefersDarkScheme ? "dark" : "light"; 28 29tryFinalizeLogin() 30 .then((login) => { 31 if (!login) return; 32 let currentAccounts = accounts(); 33 currentAccounts = currentAccounts.filter((acc) => acc.did !== login.did); 34 setAccounts([ 35 ...currentAccounts, 36 { 37 did: login.did as AtprotoDid, 38 handle: login.handle === "handle.invalid" ? undefined : login.handle, 39 }, 40 ]); 41 toaster.create({ 42 title: "login success", 43 description: `logged in as ${login.handle}`, 44 type: "success", 45 }); 46 }) 47 .catch((error) => { 48 console.error(error); 49 toaster.create({ 50 title: "login error", 51 description: `${error}`, 52 type: "error", 53 }); 54 }); 55 56render(() => <App />, root!);