import { Tooltip } from "@mui/joy"; import classNames from "classnames"; import copy from "copy-to-clipboard"; import toast from "react-hot-toast"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { absolutifyLink, getFaviconWithGoogleS2 } from "../helpers/utils"; import useViewStore from "../stores/v1/view"; import Icon from "./Icon"; import ShortcutActionsDropdown from "./ShortcutActionsDropdown"; import VisibilityIcon from "./VisibilityIcon"; interface Props { shortcut: Shortcut; } const ShortcutView = (props: Props) => { const { shortcut } = props; const { t } = useTranslation(); const viewStore = useViewStore(); const shortcutLink = absolutifyLink(`/s/${shortcut.name}`); const favicon = getFaviconWithGoogleS2(shortcut.link); const handleCopyButtonClick = () => { copy(shortcutLink); toast.success("Shortcut link copied to clipboard."); }; return ( <>
{favicon ? ( ) : ( )}
{shortcut.link}
{shortcut.tags.map((tag) => { return ( viewStore.setFilter({ tag: tag })} > #{tag} ); })} {shortcut.tags.length === 0 && No tags}
{shortcut.creator.nickname}
viewStore.setFilter({ visibility: shortcut.visibility })} > {t(`shortcut.visibility.${shortcut.visibility.toLowerCase()}.self`)}
{t("shortcut.visits", { count: shortcut.view })}
); }; export default ShortcutView;