mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
feat(workspace-editor-footer): add error and warning marker count
This commit is contained in:
parent
4736f77cbf
commit
1de4396eaa
@ -2,7 +2,9 @@
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useEffect, useState } from "react";
|
||||
import { MarkerSeverity } from "monaco-editor";
|
||||
import { useProblem } from "@/hooks/use-problem";
|
||||
import { CircleXIcon, TriangleAlertIcon } from "lucide-react";
|
||||
|
||||
interface WorkspaceEditorFooterProps {
|
||||
className?: string;
|
||||
@ -12,7 +14,7 @@ export function WorkspaceEditorFooter({
|
||||
className,
|
||||
...props
|
||||
}: WorkspaceEditorFooterProps) {
|
||||
const { editor } = useProblem();
|
||||
const { editor, markers } = useProblem();
|
||||
const [position, setPosition] = useState<{ lineNumber: number; column: number } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@ -39,9 +41,19 @@ export function WorkspaceEditorFooter({
|
||||
return (
|
||||
<footer
|
||||
{...props}
|
||||
className={cn("h-9 flex flex-none items-center bg-muted px-3 py-2", className)}
|
||||
className={cn("h-9 flex flex-none items-center px-3 py-2 bg-muted", className)}
|
||||
>
|
||||
<div className="w-full flex items-center justify-end">
|
||||
<div className="w-full flex items-center justify-between px-0.5 truncate">
|
||||
<div className="flex gap-3">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<CircleXIcon className="text-red-500" size={20} aria-hidden="true" />
|
||||
{markers.filter((m) => m.severity === MarkerSeverity.Error).length}
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<TriangleAlertIcon className="text-yellow-500" size={20} aria-hidden="true" />
|
||||
{markers.filter((m) => m.severity === MarkerSeverity.Warning).length}
|
||||
</div>
|
||||
</div>
|
||||
<span className="truncate">
|
||||
{position
|
||||
? `Row ${position.lineNumber}, Column ${position.column}`
|
||||
|
Loading…
Reference in New Issue
Block a user