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([]); const [gIcon, setGIcon] = useState(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; return (
{activeEdit && (<>

Edit {isFolder ? "Folder" : "Bookmark"}

Name

{ getBrowser().bookmarks.update(activeEdit!.id, {title: e.target.value}) }}/> {!isFolder && (<>

URL

{ getBrowser().bookmarks.update(activeEdit!.id, {url: e.target.value}) }}/> )}

Icon

Found on the site

{/*{ iconOptions &&*/} {/* {*/} {/* return { props: {*/} {/* value: s,*/} {/* children: ()*/} {/* }}*/} {/* }*/} {/* )}*/} {/*/>}*/}

From Google

Custom

TODO

)}
); } export default BMEditor;