diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsx
index f3a722ea..0bc2c9d5 100644
--- a/components/CollectionListing.tsx
+++ b/components/CollectionListing.tsx
@@ -17,6 +17,8 @@ import toast from "react-hot-toast";
import { useTranslation } from "next-i18next";
import { useCollections, useUpdateCollection } from "@/hooks/store/collections";
import { useUpdateUser, useUser } from "@/hooks/store/user";
+import Icon from "./Icon";
+import { IconWeight } from "@phosphor-icons/react";
interface ExtendedTreeItem extends TreeItem {
data: Collection;
@@ -256,7 +258,7 @@ const renderItem = (
: "hover:bg-neutral/20"
} duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}
>
- {Icon(item as ExtendedTreeItem, onExpand, onCollapse)}
+ {Dropdown(item as ExtendedTreeItem, onExpand, onCollapse)}
-
+ {collection.icon ? (
+
{collection.name}
{collection.isPublic && ( @@ -288,7 +301,7 @@ const renderItem = ( ); }; -const Icon = ( +const Dropdown = ( item: ExtendedTreeItem, onExpand: (id: ItemId) => void, onCollapse: (id: ItemId) => void @@ -332,6 +345,8 @@ const buildTreeFromCollections = ( name: collection.name, description: collection.description, color: collection.color, + icon: collection.icon, + iconWeight: collection.iconWeight, isPublic: collection.isPublic, ownerId: collection.ownerId, createdAt: collection.createdAt, diff --git a/components/Drawer.tsx b/components/Drawer.tsx index 12f931ec..49cd9eb2 100644 --- a/components/Drawer.tsx +++ b/components/Drawer.tsx @@ -40,13 +40,13 @@ export default function Drawer({{t("set_custom_icon")}
+ ) : ( + + )}{link.name}
} - - {link.url && ( - <> -{t("link")}
- -{t("collection")}
- -{link.collection.name}
-+ {link.name || t("untitled")} +
+{t("link")}
+ ++ {t("name")} +
+{t("notes")}
++ {t("collection")} +
-{link.description}
+ {mode === "view" ? ( +{link.collection.name}
++ {t("tags")} +
+ + {mode === "view" ? ( ++ {t("description")} +
+ + {mode === "view" ? ( +{link.description}
+ ) : ( +{t("no_description_provided")}
+ )} ++ {link.url ? t("preserved_formats") : t("file")} +
+ ++ {t("preservation_in_queue")} +
++ {t("check_back_later")} +
+{t("there_are_more_formats")}
++ {t("check_back_later")} +
++ {t("view_latest_snapshot")} +
+ + + )} +- {link.url ? t("preserved_formats") : t("file")} -
- -{t("preservation_in_queue")}
-{t("check_back_later")}
-{t("there_are_more_formats")}
-{t("check_back_later")}
-{t("view_latest_snapshot")}
- - - )} ++ {t("saved")}{" "} + {new Date(link.createdAt || "").toLocaleDateString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + })}{" "} + at{" "} + {new Date(link.createdAt || "").toLocaleTimeString("en-US", { + hour: "numeric", + minute: "numeric", + })} +
+ > + ) : ( + <> +- {unescapeString(link.name)} -
- -+ {unescapeString(link.name)} +
+ )} + + {show.link &&{collection?.name}
> diff --git a/components/LinkViews/LinkComponents/LinkIcon.tsx b/components/LinkViews/LinkComponents/LinkIcon.tsx index e60c23a6..c423aa7e 100644 --- a/components/LinkViews/LinkComponents/LinkIcon.tsx +++ b/components/LinkViews/LinkComponents/LinkIcon.tsx @@ -2,34 +2,26 @@ import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import Image from "next/image"; import isValidUrl from "@/lib/shared/isValidUrl"; import React from "react"; +import Icon from "@/components/Icon"; +import { IconWeight } from "@phosphor-icons/react"; +import clsx from "clsx"; export default function LinkIcon({ link, className, - size, + hideBackground, + onClick, }: { link: LinkIncludingShortenedCollectionAndTags; className?: string; - size?: "small" | "medium"; + hideBackground?: boolean; + onClick?: Function; }) { - let iconClasses: string = - "bg-white shadow rounded-md border-[2px] flex item-center justify-center border-white select-none z-10 " + - (className || ""); - - let dimension; - - switch (size) { - case "small": - dimension = " w-8 h-8"; - break; - case "medium": - dimension = " w-12 h-12"; - break; - default: - size = "medium"; - dimension = " w-12 h-12"; - break; - } + let iconClasses: string = clsx( + "rounded flex item-center justify-center shadow select-none z-10 w-12 h-12", + !hideBackground && "rounded-md bg-white backdrop-blur-lg bg-opacity-50 p-1", + className + ); const url = isValidUrl(link.url || "") && link.url ? new URL(link.url) : undefined; @@ -37,37 +29,41 @@ export default function LinkIcon({ const [showFavicon, setShowFavicon] = React.useState- {link.name ? ( - unescapeString(link.name) - ) : ( -
+ {unescapeString(link.name)} +
+ )}- {unescapeString(link.name)} -
++ {unescapeString(link.name)} +
+ )} -+ {show.description && link.description && ( +
{unescapeString(link.description)}
)} - {link.tags && link.tags[0] && ( + {show.tags && link.tags && link.tags[0] && ({t("name")}
-{t("name")}
{t("color")}
-{t("description")}