From 9490a3a616f526ee7b495abab27af111df16bbb4 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 5 Mar 2024 15:14:38 +0000
Subject: extension: Allow deleting and opening newly saved bookmarks

---
 packages/browser-extension/src/Layout.tsx | 51 +++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 packages/browser-extension/src/Layout.tsx

(limited to 'packages/browser-extension/src/Layout.tsx')

diff --git a/packages/browser-extension/src/Layout.tsx b/packages/browser-extension/src/Layout.tsx
new file mode 100644
index 00000000..b7768d1a
--- /dev/null
+++ b/packages/browser-extension/src/Layout.tsx
@@ -0,0 +1,51 @@
+import { Outlet } from "react-router-dom";
+import { Home, RefreshCw, Settings, X } from "lucide-react";
+import { useNavigate } from "react-router-dom";
+import usePluginSettings from "./utils/settings";
+
+export default function Layout() {
+  const navigate = useNavigate();
+  const [settings, _1, _2, _3, isInit] = usePluginSettings();
+  if (!isInit) {
+    return <div className="p-4">Loading ... </div>;
+  }
+
+  if (!settings.apiKey || !settings.address) {
+    navigate("/notconfigured");
+    return;
+  }
+
+  return (
+    <div className="flex flex-col space-y-2">
+      <div className="rounded-md bg-yellow-100 p-4">
+        <Outlet />
+      </div>
+      <hr />
+      <div className="flex justify-between space-x-3">
+        <div className="my-auto">
+          <a
+            className="flex gap-2 text-black"
+            target="_blank"
+            href={`${settings.address}/dashboard/bookmarks`}
+          >
+            <Home />
+            <span className="text-md my-auto">Bookmarks</span>
+          </a>
+        </div>
+        <div className="flex space-x-3">
+          {process.env.NODE_ENV == "development" && (
+            <button onClick={() => navigate(0)}>
+              <RefreshCw className="w-4" />
+            </button>
+          )}
+          <button onClick={() => navigate("/options")}>
+            <Settings className="w-4" />
+          </button>
+          <button onClick={() => window.close()}>
+            <X className="w-4" />
+          </button>
+        </div>
+      </div>
+    </div>
+  );
+}
-- 
cgit v1.2.3-70-g09d2

