import { ClientOnly } from 'remix-utils/client-only'; import { Header } from '~/components/header/Header'; import { Menu } from '~/components/sidebar/Menu.client'; import BackgroundRays from '~/components/ui/BackgroundRays'; import { TooltipProvider } from '@radix-ui/react-tooltip'; import { sendCommandDedicatedClient } from '~/lib/replay/ReplayProtocolClient'; import { cssTransition, toast, ToastContainer } from 'react-toastify'; import { useEffect } from 'react'; import { useState } from 'react'; interface BoltProblemDescription { problemId: string; title: string; description: string; timestamp: number; } const toastAnimation = cssTransition({ enter: 'animated fadeInRight', exit: 'animated fadeOutRight', }); function ToastContainerWrapper() { return { return ( ); }} icon={({ type }) => { /** * @todo Handle more types if we need them. This may require extra color palettes. */ switch (type) { case 'success': { return
; } case 'error': { return
; } } return undefined; }} position="bottom-right" pauseOnFocusLoss transition={toastAnimation} /> } async function fetchProblems(): Promise { try { const rv = await sendCommandDedicatedClient({ method: "Recording.globalExperimentalCommand", params: { name: "listBoltProblems", }, }); console.log("ListProblemsRval", rv); return (rv as any).rval.problems; } catch (error) { console.error("Error fetching problems", error); toast.error("Failed to fetch problems"); return []; } } function ProblemsPage() { const [problems, setProblems] = useState(null); useEffect(() => { fetchProblems().then(setProblems); }, []); return (
{() => }
{problems === null ? (
) : problems.length === 0 ? (
No problems found
) : ( )}
); } export default ProblemsPage;