⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
bug fixed
daniel31x13cfa36fc8da43
diff --git a/apps/web/components/LinkDetails.tsx b/apps/web/components/LinkDetails.tsxindex f2f03f3d..c3a15715 100644--- a/apps/web/components/LinkDetails.tsx+++ b/apps/web/components/LinkDetails.tsx@@ -190,7 +190,7 @@ export default function LinkDetails({) : link.preview === "unavailable" ? (<div className="bg-gray-50 duration-100 h-40"></div>) : (- <div className="duration-100 h-40 skeleton rounded-none"></div>+ <div className="h-40 skeleton rounded-none"></div>)}{!standalone &&diff --git a/apps/web/components/Preservation/PreservationContent.tsx b/apps/web/components/Preservation/PreservationContent.tsxindex c5321f55..53baa955 100644--- a/apps/web/components/Preservation/PreservationContent.tsx+++ b/apps/web/components/Preservation/PreservationContent.tsx@@ -13,25 +13,13 @@ import {atLeastOneFormatAvailable,formatAvailable,} from "@linkwarden/lib/formatStats";-import PreservationNavbar from "./PreservationNavbar";+import getLinkTypeFromFormat from "@linkwarden/lib/getLinkTypeFromFormat";type Props = {link?: LinkIncludingShortenedCollectionAndTags;- format?: ArchivedFormat;+ format: ArchivedFormat;};-function findAvailableImageFormat(- link: LinkIncludingShortenedCollectionAndTags-) {- return formatAvailable(link, "image")- ? link?.image?.endsWith(".png")- ? ArchivedFormat.png- : link?.image?.endsWith(".jpeg") || link?.image?.endsWith(".jpg")- ? ArchivedFormat.jpeg- : null- : null;-}-export const PreservationContent: React.FC<Props> = ({ link, format }) => {const router = useRouter();const { t } = useTranslation();@@ -165,8 +153,17 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {return (<div className="relative bg-base-200">- {!atLeastOneFormatAvailable(link) ? (- <div className={`w-full h-full flex flex-col justify-center p-10`}>+ {formatAvailable(link, getLinkTypeFromFormat(format)) ? (+ renderFormat()+ ) : link[getLinkTypeFromFormat(format)] === "unavailable" ? (+ <div className="w-full h-[calc(100vh-3.1rem)] flex flex-col justify-center p-10">+ <p className="text-center text-2xl font-bold">404</p>+ <p className="text-center text-lg">Format not available...</p>+ </div>+ ) : (+ <div+ className={`w-full h-[calc(100vh-3.1rem)] flex flex-col justify-center p-10`}+ ><BeatLoadercolor="oklch(var(--p))"className="mx-auto mb-3"@@ -175,8 +172,6 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {<p className="text-center text-xl">{t("preservation_in_queue")}</p><p className="text-center text-lg">{t("check_back_later")}</p></div>- ) : (- renderFormat())}</div>);diff --git a/apps/web/components/Preservation/PreservationNavbar.tsx b/apps/web/components/Preservation/PreservationNavbar.tsxindex 102db6f6..1f1e5705 100644--- a/apps/web/components/Preservation/PreservationNavbar.tsx+++ b/apps/web/components/Preservation/PreservationNavbar.tsx@@ -14,7 +14,10 @@ import { Button } from "@/components/ui/button";import { useTranslation } from "next-i18next";import Link from "next/link";import { useRouter } from "next/router";-import { formatAvailable } from "@linkwarden/lib/formatStats";+import {+ atLeastOneFormatAvailable,+ formatAvailable,+} from "@linkwarden/lib/formatStats";import LinkActions from "../LinkViews/LinkComponents/LinkActions";import { useCollections } from "@linkwarden/router/collections";import clsx from "clsx";@@ -109,8 +112,12 @@ const PreservationNavbar = ({ link, format, showNavbar, className }: Props) => {)}</div><DropdownMenu>- <DropdownMenuTrigger>- <Button variant="ghost" className="h-8 text-neutral">+ <DropdownMenuTrigger asChild>+ <Button+ variant="ghost"+ className="h-8 text-neutral"+ disabled={!atLeastOneFormatAvailable(link) || false}+ >{format === ArchivedFormat.readability? t("readable"): format === ArchivedFormat.monolithdiff --git a/packages/lib/formatStats.ts b/packages/lib/formatStats.tsindex 013fc026..8d62e2c9 100644--- a/packages/lib/formatStats.ts+++ b/packages/lib/formatStats.ts@@ -5,7 +5,7 @@ export function formatAvailable(link: Link | LinkIncludingShortenedCollectionAndTags,format: "image" | "pdf" | "readable" | "monolith" | "preview") {- return link && link[format] && link[format] !== "unavailable";+ return Boolean(link && link[format] && link[format] !== "unavailable");}export const atLeastOneFormatAvailable = (