import { For } from "solid-js";
import { CheckIcon, ChevronsUpDownIcon } from "lucide-solid";
import { Button } from "./components/ui/button";
import { Card } from "./components/ui/card";
import { Stack, Box, StackProps, HStack, VStack } from "styled-system/jsx";
import { FileUpload } from "./components/ui/file-upload";
import { Text } from "./components/ui/text";
import { AtprotoDid } from "@atcute/lexicons/syntax";
import {
Account,
accounts,
selectedAccount,
setSelectedAccount,
} from "./lib/accounts";
import { Toaster } from "~/components/Toaster";
import { createListCollection, Select } from "./components/ui/select";
import { addTask, tasks, TaskState } from "./lib/task";
import Task from "./components/FileTask";
import Settings from "./components/Settings";
import MicRecorder from "./components/MicRecorder";
import { Link } from "./components/ui/link";
const App = () => {
const collection = () =>
createListCollection({
items: accounts().map((account) => ({
label: account.handle ?? account.did,
value: account.did,
})),
});
const AccountSelect = () => (
setSelectedAccount(details.value[0] as AtprotoDid)
}
collection={collection()}
>
{selectedAccount() ? "@" : ""}
{(item) => (
@{item.label}
)}
);
return (
<>
trill
- 1. upload a voice memo or record one.
- 2. it will automatically be converted to a video
-
3. (optional) add an account to enable bluesky integration.
e.files.forEach((file) => addTask(selectedAccount(), file))
}
/>
account.did === selectedAccount(),
)}
/>
/made by{" "}
{Math.random() < 0.98 ? "dawn" : "90008"}
/
source on{" "}
tangled
>
);
};
export default App;
type TasksProps = StackProps & {
currentTasks: TaskState[];
selectedAccount: Account | undefined;
};
const Tasks = (props: TasksProps) => (
no files processed (yet!)
}
>
{(process) => Task(process, props.selectedAccount)}
);
const getAudioClipboard = async () => {
try {
const clipboardItems = await navigator.clipboard.read();
for (const item of clipboardItems) {
console.log(item);
const type = item.types.find((type) => type.startsWith("audio/"));
if (type) {
const blob = await item.getType(type);
const file = new File([blob], `audio.${type.split("/")[1]}`, { type });
return file;
}
}
return;
} catch (err) {
console.error(err);
return;
}
};
const Upload = (props: FileUpload.RootProps) => {
return (
drop your files here
(
)}
/>
{/*
getAudioClipboard().then((file) => {
if (!file) return;
addTask(selectedAccount(), file);
})
}
variant="subtle"
>
*/}
);
};