From 0c8fa3a2a270747f3dbb54fe8792f3f0aec997e3 Mon Sep 17 00:00:00 2001
From: Ryan Schanzenbacher <ryan@rschanz.org>
Date: Mon, 3 Aug 2026 01:22:44 -0400
Subject: Initial commit: combined darwin + guix-linux home-manager flake

Supersedes nix-dotfiles (darwin) and guix-dotfiles' ad-hoc
nix-home-manager flake (linux). See README.md/MIGRATION.md.
---
 .../simple-bar-source/lib/components/error.jsx     | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/components/error.jsx

(limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/components/error.jsx')

diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/error.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/error.jsx
new file mode 100755
index 0000000..135cb29
--- /dev/null
+++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/error.jsx
@@ -0,0 +1,42 @@
+import * as Settings from "./settings/settings.jsx";
+import * as Utils from "../utils";
+
+// Error messages for different types of errors
+const message = {
+  error: "Something went wrong…",
+  yabaiError: "yabai is not running",
+  aerospaceError: "AeroSpace is either not running or outdated",
+  noOutput: "Loading…",
+  noData: "JSON error…",
+};
+
+/**
+ * Component to display error messages based on the type of error.
+ * @param {Object} props - The properties object.
+ * @param {string} props.type - The type of error.
+ * @param {string} props.classes - Additional CSS classes.
+ * @returns {JSX.Element} The error component.
+ */
+export function Component({ type, classes }) {
+  // Combine base class with additional classes and conditional loading class
+  const errorClasses = Utils.classNames("simple-bar--empty", classes, {
+    "simple-bar--loading": type === "noOutput",
+  });
+
+  // Refresh the component after 2 seconds for general errors and JSON errors
+  if (type === "error" || type === "noData") {
+    setTimeout(Utils.softRefresh, 2000);
+  }
+
+  // Refresh the component after 15 seconds for yabai and aerospace errors
+  if (type === "yabaiError" || type === "aerospaceError") {
+    setTimeout(Utils.softRefresh, 15000);
+  }
+
+  return (
+    <div className={errorClasses}>
+      <span>simple-bar-index.jsx: {message[type]}</span>
+      <Settings.Wrapper />
+    </div>
+  );
+}
-- 
cgit v1.3.1

