diff options
| author | Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> | 2025-07-17 08:49:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-17 08:49:12 -0400 |
| commit | ca0d5f0ec1f4ba21f4bf51f0f773d2b6bad45c93 (patch) | |
| tree | 8374652b65877b10bce3ea6e073165a02b6af0ba /src/components/ResultDisplay.tsx | |
| parent | 74ac6e7b7a18c2ae969b08242a5919f903d294e2 (diff) | |
| download | Decky-Framegen-ca0d5f0ec1f4ba21f4bf51f0f773d2b6bad45c93.tar.gz Decky-Framegen-ca0d5f0ec1f4ba21f4bf51f0f773d2b6bad45c93.zip | |
reorganize for readability and DRY (#115)v0.10.1
* reorganize for readability and DRY
* rm backup files
* ver bump
Diffstat (limited to 'src/components/ResultDisplay.tsx')
| -rw-r--r-- | src/components/ResultDisplay.tsx | 37 |
1 files changed, 37 insertions, 0 deletions
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> + ); +}; |
