import { LinkIncludingCollectionAndTags } from "@/types/global"; import { faFolder, faArrowUpRightFromSquare, faEllipsis, } from "@fortawesome/free-solid-svg-icons"; import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useState } from "react"; import Image from "next/image"; import useLinkStore from "@/store/links"; import LinkModal from "../Modal/LinkModal"; import Link from "next/link"; import Dropdown from "../Dropdown"; import Modal from "../Modal"; type Props = { link: LinkIncludingCollectionAndTags; count: number; }; export default function LinkItem({ link, count }: Props) { const [expandDropdown, setExpandDropdown] = useState(false); const [editModal, setEditModal] = useState(false); const { removeLink } = useLinkStore(); const url = new URL(link.url); const formattedDate = new Date(link.createdAt as string).toLocaleString( "en-US", { year: "numeric", month: "short", day: "numeric", } ); const toggleEditModal = () => { setEditModal(!editModal); }; return (
{count + 1}.
{link.name}
{link.title}
{link.collection.name}
# {e.name}
))}{formattedDate}
{url.host}