Problems components
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import { Search, Grid, List } from "lucide-react";
|
import { Search, Grid, List } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import ProblemCard from "@/components/app/ProblemCard";
|
import ProblemCard from "@/app/problems/components/ProblemCard";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import CodeMirror, { EditorState } from "@uiw/react-codemirror";
|
|||||||
import { vscodeDark } from "@uiw/codemirror-theme-vscode";
|
import { vscodeDark } from "@uiw/codemirror-theme-vscode";
|
||||||
|
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import RunTimer, { RunInfo } from "../problems/components/RunTimer";
|
import RunTimer, { RunInfo } from "./components/RunTimer";
|
||||||
import RunChat, { ChatMessage } from "../problems/components/RunChat";
|
import RunChat, { ChatMessage } from "./components/RunChat";
|
||||||
|
|
||||||
export default function Run() {
|
export default function Run() {
|
||||||
const runInfo: RunInfo = {
|
const runInfo: RunInfo = {
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
import { Check, Minus } from "lucide-react";
|
|
||||||
|
|
||||||
interface SplitRowProps {
|
|
||||||
problemName: string;
|
|
||||||
splitTime: string;
|
|
||||||
delta?: string;
|
|
||||||
isCompleted: boolean;
|
|
||||||
isCurrent?: boolean;
|
|
||||||
pbTime?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SplitRow = ({ problemName, splitTime, delta, isCompleted, isCurrent, pbTime }: SplitRowProps) => {
|
|
||||||
const getDeltaColor = (delta?: string) => {
|
|
||||||
if (!delta) return "text-muted-foreground";
|
|
||||||
if (delta.startsWith("-")) return "text-emerald-400";
|
|
||||||
if (delta.startsWith("+")) return "text-red-400";
|
|
||||||
return "text-muted-foreground";
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={`flex items-center justify-between py-3 px-4 rounded-lg transition-all duration-300 ${
|
|
||||||
isCurrent
|
|
||||||
? 'bg-primary/10 border border-primary/30'
|
|
||||||
: isCompleted
|
|
||||||
? 'bg-secondary/50'
|
|
||||||
: 'bg-card'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
{/* Status indicator */}
|
|
||||||
<div className={`w-6 h-6 rounded-full flex items-center justify-center ${
|
|
||||||
isCompleted
|
|
||||||
? 'bg-emerald-500/20 text-emerald-400'
|
|
||||||
: isCurrent
|
|
||||||
? 'bg-primary/20 text-primary pulse-live'
|
|
||||||
: 'bg-secondary text-muted-foreground'
|
|
||||||
}`}>
|
|
||||||
{isCompleted ? <Check className="h-3.5 w-3.5" /> : <Minus className="h-3.5 w-3.5" />}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span className={`font-medium ${isCurrent ? 'text-primary' : isCompleted ? 'text-foreground' : 'text-muted-foreground'}`}>
|
|
||||||
{problemName}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center gap-4">
|
|
||||||
{/* Delta */}
|
|
||||||
{isCompleted && delta && (
|
|
||||||
<span className={`split-time ${getDeltaColor(delta)}`}>
|
|
||||||
{delta}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Split time */}
|
|
||||||
<span className={`split-time min-w-[70px] text-right ${
|
|
||||||
isCompleted ? 'text-foreground' : 'text-muted-foreground'
|
|
||||||
}`}>
|
|
||||||
{isCompleted ? splitTime : pbTime || '--:--'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SplitRow;
|
|
||||||
Reference in New Issue
Block a user