From 901829cf8d25ed1e7741f5771e616ed3b9d327c7 Mon Sep 17 00:00:00 2001 From: ARYPROGRAMMER Date: Mon, 16 Dec 2024 08:20:25 +0530 Subject: [PATCH] phase_1_develop_1002: output panel ui ready --- src/app/(home)/_components/OutputPanel.tsx | 103 +++++++++++++++++- .../(home)/_components/RunningCodeLoading.tsx | 17 +++ 2 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 src/app/(home)/_components/RunningCodeLoading.tsx 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