import React from "react"; import FlipMove from "react-flip-move"; import useSWR from "swr"; import { getFlagEmoji } from "../utils/getFlagEmoji.ts"; import { Progress } from "./Progress.tsx"; import { fetchApi, handleResponse } from "./apiClient.ts"; export function QueuePage() { const getJobs = useSWR( ["/jobs", {}] as const, (args) => fetchApi(...args).then(handleResponse), { refreshInterval: 2000 }, ); return ( {getJobs.data && getJobs.data.length === 0 ?
  • Queue is empty.
  • : ( getJobs.data?.map((job) => (
  • {job.place}. {getFlagEmoji(job.state.from.language_code ?? undefined)} {job.state.from.first_name} {job.state.from.last_name} {job.state.from.username ? ( @{job.state.from.username} ) : null} {job.state.progress != null && ( )} {job.state.workerInstanceKey}
  • )) )}
    ); }