⚡️⚡️⚡️ 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
add link actions to readable view
Matthew Jacobs1a96ca32f99c
diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsxindex d809dfc8..fcd47507 100644--- a/components/LinkViews/LinkComponents/LinkActions.tsx+++ b/components/LinkViews/LinkComponents/LinkActions.tsx@@ -18,6 +18,7 @@ type Props = {position?: string;toggleShowInfo?: () => void;linkInfo?: boolean;+ alignToTop?: boolean;flipDropdown?: boolean;};@@ -26,6 +27,7 @@ export default function LinkActions({toggleShowInfo,position,linkInfo,+ alignToTop,flipDropdown,}: Props) {const permissions = usePermissions(link.collection.id as number);@@ -67,9 +69,9 @@ export default function LinkActions({return (<><div- className={`dropdown dropdown-left dropdown-end absolute ${+ className={`dropdown dropdown-left absolute ${position || "top-3 right-3"- } z-20`}+ } ${alignToTop ? "" : "dropdown-end"} z-20`}><divtabIndex={0}@@ -79,7 +81,11 @@ export default function LinkActions({><i title="More" className="bi-three-dots text-xl" /></div>- <ul className="dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 translate-y-10">+ <ul+ className={`dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 ${+ alignToTop ? "" : "translate-y-10"+ }`}+ ><li><divrole="button"diff --git a/components/ReadableView.tsx b/components/ReadableView.tsxindex 9c7ce176..977ca2a0 100644--- a/components/ReadableView.tsx+++ b/components/ReadableView.tsx@@ -4,6 +4,7 @@ import isValidUrl from "@/lib/shared/isValidUrl";import useLinkStore from "@/store/links";import {ArchivedFormat,+ CollectionIncludingMembersAndLinkCount,LinkIncludingShortenedCollectionAndTags,} from "@/types/global";import ColorThief, { RGBColor } from "colorthief";@@ -11,7 +12,9 @@ import DOMPurify from "dompurify";import Image from "next/image";import Link from "next/link";import { useRouter } from "next/router";-import React, { useEffect, useState } from "react";+import React, { useEffect, useMemo, useState } from "react";+import LinkActions from "./LinkViews/LinkComponents/LinkActions";+import useCollectionStore from "@/store/collections";type LinkContent = {title: string;@@ -41,6 +44,13 @@ export default function ReadableView({ link }: Props) {const router = useRouter();const { links, getLink } = useLinkStore();+ const { collections } = useCollectionStore();++ const collection = useMemo(() => {+ return collections.find(+ (e) => e.id === link.collection.id+ ) as CollectionIncludingMembersAndLinkCount;+ }, [collections, link]);useEffect(() => {const fetchLinkContent = async () => {@@ -131,7 +141,7 @@ export default function ReadableView({ link }: Props) {<div className={`flex flex-col max-w-screen-md h-full mx-auto py-5`}><divid="link-banner"- className="link-banner bg-opacity-10 border-neutral-content p-3 border mb-3"+ className="link-banner relative bg-opacity-10 border-neutral-content p-3 border mb-3"><div id="link-banner-inner" className="link-banner-inner"></div>@@ -226,6 +236,13 @@ export default function ReadableView({ link }: Props) {{link?.name ? <p>{unescapeString(link?.description)}</p> : undefined}</div>++ <LinkActions+ link={link}+ collection={collection}+ position="top-3 right-3"+ alignToTop+ /></div><div className="flex flex-col gap-5 h-full">