import { Component, ContextType } from "preact"; import { GlobalCtx } from "./GlobalContext.tsx"; import Fab from "preact-material-components/Fab"; import Icon from "preact-material-components/Icon"; import { set_state } from "../server/state.ts"; import t from "../server/i18n.ts"; import BSelect from "./BSelect.tsx"; import { useState } from "preact/hooks"; import { TaskType } from "../task.ts"; export type NewTaskProps = { show: boolean; }; export default class NewTask extends Component { static contextType = GlobalCtx; declare context: ContextType; render() { if (!this.props.show) return null; const [task_type, set_task_type] = useState(TaskType.Download); let config_div = null; if (task_type === TaskType.Download) { config_div = (
{t("task.gallery_url")}
); } return (
{t("task.add")}
{ set_state((p) => p.slice(0, p.length - 4)); }} > close
{t("task.type")}
{config_div}
); } }