⚡️⚡️⚡️ 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
code cleanup
daniel31x13803a97b7e0b1
diff --git a/apps/web/components/DashboardLinks.tsx b/apps/web/components/DashboardLinks.tsxindex 3ad65cd6..675e45bd 100644--- a/apps/web/components/DashboardLinks.tsx+++ b/apps/web/components/DashboardLinks.tsx@@ -5,7 +5,6 @@ import {CollectionIncludingMembersAndLinkCount,} from "@linkwarden/types";import { useEffect, useRef, useState } from "react";-import useLinkStore from "@/store/links";import unescapeString from "@/lib/client/unescapeString";import LinkActions from "@/components/LinkViews/LinkComponents/LinkActions";import LinkDate from "@/components/LinkViews/LinkComponents/LinkDate";@@ -16,9 +15,6 @@ import {formatAvailable,} from "@linkwarden/lib/formatStats";import useOnScreen from "@/hooks/useOnScreen";-import usePermissions from "@/hooks/usePermissions";-import toast from "react-hot-toast";-import { useTranslation } from "next-i18next";import { useCollections } from "@linkwarden/router/collections";import { useUser } from "@linkwarden/router/user";import { useGetLink, useLinks } from "@linkwarden/router/links";@@ -63,14 +59,10 @@ type Props = {};export function Card({ link, editMode }: Props) {- const { t } = useTranslation();-const { data: collections = [] } = useCollections();const { data: user } = useUser();- const { setSelectedLinks, selectedLinks } = useLinkStore();-const {settings: { show },} = useLocalSettingsStore();@@ -82,22 +74,6 @@ export function Card({ link, editMode }: Props) {const { refetch } = useGetLink({ id: link.id as number, isPublicRoute });- useEffect(() => {- if (!editMode) {- setSelectedLinks([]);- }- }, [editMode]);-- const handleCheckboxClick = (- link: LinkIncludingShortenedCollectionAndTags- ) => {- if (selectedLinks.includes(link)) {- setSelectedLinks(selectedLinks.filter((e) => e !== link));- } else {- setSelectedLinks([...selectedLinks, link]);- }- };-let shortendURL;try {@@ -125,7 +101,6 @@ export function Card({ link, editMode }: Props) {const ref = useRef<HTMLDivElement>(null);const isVisible = useOnScreen(ref);- const permissions = usePermissions(collection?.id as number);const [linkModal, setLinkModal] = useState(false);@@ -151,27 +126,10 @@ export function Card({ link, editMode }: Props) {};}, [isVisible, link.preview]);- const selectedStyle = selectedLinks.some(- (selectedLink) => selectedLink.id === link.id- )- ? "border-primary bg-base-300"- : "border-neutral-content";-- const selectable =- editMode &&- (permissions === true || permissions?.canCreate || permissions?.canDelete);-return (<divref={ref}- className={`${selectedStyle} min-w-60 w-60 border border-solid border-neutral-content bg-base-200 duration-100 rounded-xl relative group`}- onClick={() =>- selectable- ? handleCheckboxClick(link)- : editMode- ? toast.error(t("link_selection_error"))- : undefined- }+ className={`min-w-60 w-60 border border-solid border-neutral-content bg-base-200 duration-100 rounded-xl relative group`}><divclassName="rounded-xl cursor-pointer h-full w-full flex flex-col justify-between"