From 514a33483697ff231c075cbb9130606af19d9298 Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Tue, 17 Dec 2024 12:47:45 -0500
Subject: Improve BMEditor

---
 extension/src/components/BMEditor.tsx | 43 +++++++++++++++++------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

(limited to 'extension/src/components/BMEditor.tsx')

diff --git a/extension/src/components/BMEditor.tsx b/extension/src/components/BMEditor.tsx
index 1ac72c6..2579bdb 100644
--- a/extension/src/components/BMEditor.tsx
+++ b/extension/src/components/BMEditor.tsx
@@ -2,7 +2,6 @@ import React, {useContext, useEffect, useState} from "react";
 import CloseIcon from "../assets/close.svg?react"
 import {ActiveEdit} from "./Body.tsx";
 import {getBrowser} from "../main.tsx";
-import RadioButtonGroup from "./RadioButtonGroup.tsx";
 
 
 function BMEditor() {
@@ -17,8 +16,6 @@ function BMEditor() {
         });
     }, [activeEdit]);
 
-    if (!activeEdit) return;
-
     let isFolder = activeEdit && activeEdit.children && activeEdit.children.length > 0;
     return (
         <div id="settings-menu" className={activeEdit ? "open" : "closed"}>
@@ -26,28 +23,30 @@ function BMEditor() {
                 <CloseIcon/>
             </button>
 
-            <h1>Edit {isFolder ? "Folder" : "Bookmark"}</h1>
-
-            <h3>Name</h3>
-            <input type={"text"} defaultValue={activeEdit?.title} onChange={e => {
-                getBrowser().bookmarks.update(activeEdit!.id, {title: e.target.value})
-            }}/>
+            {activeEdit && (<>
+                <h1>Edit {isFolder ? "Folder" : "Bookmark"}</h1>
 
-            {!isFolder && (<>
-                <h3>URL</h3>
-                <input type={"url"} defaultValue={activeEdit?.url} onChange={e => {
-                    getBrowser().bookmarks.update(activeEdit!.id, {url: e.target.value})
+                <h3>Name</h3>
+                <input type={"text"} defaultValue={activeEdit?.title} onChange={e => {
+                    getBrowser().bookmarks.update(activeEdit!.id, {title: e.target.value})
                 }}/>
-            </>)}
 
-            <h3>Icon</h3>
-            {/*<RadioButtonGroup value={undefined}>*/}
-                {iconOptions && iconOptions.map(s =>
-                    // <option value={s}>
-                        <img src={s}/>
-                    // </option>
-                )}
-            {/*</RadioButtonGroup>*/}
+                {!isFolder && (<>
+                    <h3>URL</h3>
+                    <input type={"url"} defaultValue={activeEdit?.url} onChange={e => {
+                        getBrowser().bookmarks.update(activeEdit!.id, {url: e.target.value})
+                    }}/>
+                </>)}
+
+                <h3>Icon</h3>
+                {/*<RadioButtonGroup value={undefined}>*/}
+                    {iconOptions && iconOptions.map(s =>
+                        // <option value={s}>
+                            <img src={s}/>
+                        // </option>
+                    )}
+                {/*</RadioButtonGroup>*/}
+            </>)}
         </div>
     );
 }
-- 
cgit v1.2.3

