From 279e8c7ea4f7e48ee68844e4347a67e5875faaa2 Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Sat, 18 Jan 2025 15:16:12 -0500
Subject: Icon picker working (barely, refresh after)

---
 extension/src/components/BMEditor.tsx | 33 +++++----------------------------
 1 file changed, 5 insertions(+), 28 deletions(-)

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

diff --git a/extension/src/components/BMEditor.tsx b/extension/src/components/BMEditor.tsx
index b97d21f..eb84246 100644
--- a/extension/src/components/BMEditor.tsx
+++ b/extension/src/components/BMEditor.tsx
@@ -4,25 +4,16 @@ import {ActiveEdit} from "./Body.tsx";
 import {getBrowser} from "../main.tsx";
 import RadioButtonGroup from "./RadioButtonGroup.tsx";
 import BMIcon from "./BMIcon.tsx";
+import IconPicker from "./IconPicker.tsx";
+
+
 
 
 function BMEditor() {
     const [activeEdit, setActiveEdit] = useContext(ActiveEdit);
 
-    const [iconOptions, setIconOptions] = useState<string[]>([]);
-    const [gIcon, setGIcon] = useState<string | undefined>(undefined);
-
     useEffect(() => {
         if (!activeEdit) return;
-
-        const gURL = new URL('https://www.google.com/s2/favicons');
-        gURL.searchParams.set("sz", "256");
-        gURL.searchParams.set("domain_url", activeEdit.url!);
-        setGIcon(gURL.toString());
-
-        getBrowser().storage.local.get("icon-aval-"+activeEdit.id).then( r => {
-            setIconOptions(r["icon-aval-" + activeEdit.id]);
-        });
     }, [activeEdit]);
 
     let isFolder = activeEdit && activeEdit.children && activeEdit.children.length > 0;
@@ -48,22 +39,8 @@ function BMEditor() {
                 </>)}
 
                 <h3>Icon</h3>
-                <h4>Found on the site</h4>
-                <div className={"icon-selector"}>
-                    { iconOptions &&
-                    // <RadioButtonGroup value={undefined} children={
-                        iconOptions.map(s =>
-                            <BMIcon imgSrc={s}/>
-                        )
-                    // />
-                    }
-                </div>
-                <h4>From Google</h4>
-                <div className={"icon-selector"}>
-                    <BMIcon imgSrc={gIcon}/>
-                </div>
-                <h4>Custom</h4>
-                <button className={"default"}>Upload</button>
+                <IconPicker bmData={activeEdit}/>
+
             </>)}
         </div>
     );
-- 
cgit v1.2.3

