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 { ToastContainerWrapper, Status, Keywords } from './problems'; import { toast } from 'react-toastify'; import { Suspense, useCallback, useEffect, useState } from 'react'; import { useParams } from '@remix-run/react'; import { getProblem, updateProblem as backendUpdateProblem, deleteProblem as backendDeleteProblem, getProblemsUsername, BoltProblemStatus, getNutIsAdmin, } from '~/lib/replay/Problems'; import type { BoltProblem, BoltProblemComment } from '~/lib/replay/Problems'; function Comments({ comments }: { comments: BoltProblemComment[] }) { return (
{comments.map((comment, index) => (
{comment.username ?? 'Anonymous'} {new Date(comment.timestamp).toLocaleString()}
{comment.content}
))}
); } function ProblemViewer({ problem }: { problem: BoltProblem }) { const { problemId, title, description, status = BoltProblemStatus.Pending, keywords = [], comments = [] } = problem; return (

{title}

{description}

Load Problem
); } interface UpdateProblemFormProps { handleSubmit: (content: string) => void; updateText: string; placeholder: string; } function UpdateProblemForm(props: UpdateProblemFormProps) { const { handleSubmit, updateText, placeholder } = props; const [value, setValue] = useState(''); const onSubmitClicked = (e: React.FormEvent) => { e.preventDefault(); if (value.trim()) { handleSubmit(value); setValue(''); } }; return (