feat: get url favicon from google s2

This commit is contained in:
Steven
2023-09-29 19:37:44 +08:00
parent 010271c668
commit 8cd976791e
12 changed files with 84 additions and 258 deletions

View File

@ -1,8 +1,6 @@
import classNames from "classnames";
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { absolutifyLink } from "../helpers/utils";
import useFaviconStore from "../stores/v1/favicon";
import { absolutifyLink, getFaviconWithGoogleS2 } from "../helpers/utils";
import Icon from "./Icon";
import ShortcutActionsDropdown from "./ShortcutActionsDropdown";
@ -12,17 +10,8 @@ interface Props {
const ShortcutView = (props: Props) => {
const { shortcut } = props;
const faviconStore = useFaviconStore();
const [favicon, setFavicon] = useState<string | undefined>(undefined);
const shortcutLink = absolutifyLink(`/s/${shortcut.name}`);
useEffect(() => {
faviconStore.getOrFetchUrlFavicon(shortcut.link).then((url) => {
if (url) {
setFavicon(url);
}
});
}, [shortcut.link]);
const favicon = getFaviconWithGoogleS2(shortcut.link);
return (
<>