From ca0d5f0ec1f4ba21f4bf51f0f773d2b6bad45c93 Mon Sep 17 00:00:00 2001
From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
Date: Thu, 17 Jul 2025 08:49:12 -0400
Subject: reorganize for readability and DRY (#115)

* reorganize for readability and DRY

* rm backup files

* ver bump
---
 src/components/ResultDisplay.tsx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 src/components/ResultDisplay.tsx

(limited to 'src/components/ResultDisplay.tsx')

diff --git a/src/components/ResultDisplay.tsx b/src/components/ResultDisplay.tsx
new file mode 100644
index 0000000..0f58f0e
--- /dev/null
+++ b/src/components/ResultDisplay.tsx
@@ -0,0 +1,37 @@
+import { PanelSectionRow } from "@decky/ui";
+import { FC } from "react";
+import { STYLES } from "../utils/constants";
+import { ApiResponse } from "../types/index";
+
+export type OperationResult = ApiResponse;
+
+interface ResultDisplayProps {
+  result: OperationResult | null;
+}
+
+export const ResultDisplay: FC<ResultDisplayProps> = ({ result }) => {
+  if (!result) return null;
+
+  return (
+    <PanelSectionRow>
+      <div>
+        <strong>Status:</strong>{" "}
+        <span style={result.status === "success" ? STYLES.statusSuccess : STYLES.statusError}>
+          {result.status === "success" ? "Success" : "Error"}
+        </span>
+        <br />
+        {result.output ? (
+          <>
+            <strong>Output:</strong>
+            <pre style={STYLES.preWrap}>{result.output}</pre>
+          </>
+        ) : null}
+        {result.message ? (
+          <>
+            <strong>Error:</strong> {result.message}
+          </>
+        ) : null}
+      </div>
+    </PanelSectionRow>
+  );
+};
-- 
cgit v1.2.3

