Fixed live run page
This commit is contained in:
@@ -41,7 +41,7 @@ function getLanguageExtension(lang: Language) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Editor({ run }: { run: LiveRun | null }) {
|
export default function Editor({ run }: { run: LiveRun | null | undefined }) {
|
||||||
const [editorView, setEditorView] = useState<EditorView>();
|
const [editorView, setEditorView] = useState<EditorView>();
|
||||||
const [moves] = useActionOnce<LiveRunMove[]>(getLiveRunMoves, [run]);
|
const [moves] = useActionOnce<LiveRunMove[]>(getLiveRunMoves, [run]);
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,20 @@ import { getLiveRun } from "@/modules/live-run/actions";
|
|||||||
import ProblemCard from "@/app/problems/components/ProblemCard";
|
import ProblemCard from "@/app/problems/components/ProblemCard";
|
||||||
import ProfileCard from "./components/ProfileCard";
|
import ProfileCard from "./components/ProfileCard";
|
||||||
import { getProblem } from "@/modules/problems/actions";
|
import { getProblem } from "@/modules/problems/actions";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default function Run() {
|
export default function Run() {
|
||||||
const [run] = useActionInterval(getLiveRun, 1000);
|
const params = useParams<{ runId: string }>();
|
||||||
|
|
||||||
|
const [run] = useActionInterval(() => getLiveRun(params.runId), 1000, [
|
||||||
|
params,
|
||||||
|
]);
|
||||||
|
|
||||||
const [problem] = useAction(
|
const [problem] = useAction(
|
||||||
async () => (run?.id ? getProblem(run.problem) : null),
|
async () => (run?.id ? getProblem(run.problem) : null),
|
||||||
[run],
|
[run],
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(problem);
|
|
||||||
|
|
||||||
const chatMessages: ChatMessage[] = [
|
const chatMessages: ChatMessage[] = [
|
||||||
{ user: "Alice", message: "Nice split!", time: "1:53" },
|
{ user: "Alice", message: "Nice split!", time: "1:53" },
|
||||||
{ user: "Bob", message: "Watch out for the string problem!", time: "1:54" },
|
{ user: "Bob", message: "Watch out for the string problem!", time: "1:54" },
|
||||||
|
|||||||
Reference in New Issue
Block a user