From 41814aa14040aa038c17ee0728532b0e341c5953 Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Tue, 31 Dec 2024 00:49:03 -0500
Subject: Refactor BMIcon

---
 extension/src/components/BMEditor.tsx | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

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

diff --git a/extension/src/components/BMEditor.tsx b/extension/src/components/BMEditor.tsx
index 2579bdb..4ebdaa2 100644
--- a/extension/src/components/BMEditor.tsx
+++ b/extension/src/components/BMEditor.tsx
@@ -2,17 +2,25 @@ 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() {
     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]);
+            setIconOptions(r["icon-aval-" + activeEdit.id]);
         });
     }, [activeEdit]);
 
@@ -39,13 +47,21 @@ function BMEditor() {
                 </>)}
 
                 <h3>Icon</h3>
-                {/*<RadioButtonGroup value={undefined}>*/}
-                    {iconOptions && iconOptions.map(s =>
-                        // <option value={s}>
-                            <img src={s}/>
-                        // </option>
-                    )}
-                {/*</RadioButtonGroup>*/}
+                <h4>Found on the site</h4>
+                {/*{ iconOptions &&*/}
+                {/*<RadioButtonGroup value={undefined} children={*/}
+                {/*    iconOptions.map(s => {*/}
+                {/*        return { props: {*/}
+                {/*            value: s,*/}
+                {/*            children: ()*/}
+                {/*        }}*/}
+                {/*    }*/}
+                {/*    )}*/}
+                {/*/>}*/}
+                <h4>From Google</h4>
+                <img src={gIcon}/>
+                <h4>Custom</h4>
+                <p>TODO</p>
             </>)}
         </div>
     );
-- 
cgit v1.2.3

