diff --git a/src/app/(home)/_components/OutputPanel.tsx b/src/app/(home)/_components/OutputPanel.tsx index 4ec9a9a..c3d3711 100644 --- a/src/app/(home)/_components/OutputPanel.tsx +++ b/src/app/(home)/_components/OutputPanel.tsx @@ -1,9 +1,104 @@ -import React from 'react' +"use client"; + +import { useCodeEditorState } from "@/store/useCodeEditorStore"; +import { + AlertTriangle, + CheckCircle, + Clock, + Copy, + Terminal, +} from "lucide-react"; +import React from "react"; +import RunningCodeSkeleton from "./RunningCodeLoading"; function OutputPanel() { + const { output, error, isRunning } = useCodeEditorState(); + const [isCopied, setIsCopied] = React.useState(false); + + const hasContent = error || output; + + const handleCopy = async () => { + if (!hasContent) return; + + await navigator.clipboard.writeText(error || output || ""); + setIsCopied(true); + + setTimeout(() => { + setIsCopied(false); + }, 2000); + }; + return ( -
OutputPanel
- ) +
+ {/* Header */} +
+
+
+ +
+ Output +
+ + {hasContent && ( + + )} +
+ +
+
+ {isRunning ? ( + + ) : error ? ( +
+ +
+
Execution Error
+
+                  {error}
+                
+
+
+ ) : output ? ( +
+
+ + Execution Successful +
+
{output}
+
+ ) : ( +
+
+ +
+

+ Run to Check, Submit only if you are satisfied +

+
+ )} +
+
+
+ ); } -export default OutputPanel \ No newline at end of file +export default OutputPanel; diff --git a/src/app/(home)/_components/RunningCodeLoading.tsx b/src/app/(home)/_components/RunningCodeLoading.tsx new file mode 100644 index 0000000..486c4c8 --- /dev/null +++ b/src/app/(home)/_components/RunningCodeLoading.tsx @@ -0,0 +1,17 @@ +const RunningCodeSkeleton = () => ( +
+
+
+
+
+
+ +
+
+
+
+
+
+ ); + + export default RunningCodeSkeleton; \ No newline at end of file