⚡️⚡️⚡️ 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
format
Isaac Wised2e59d48c2c7
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsxindex 53abfccb..28a00522 100644--- a/components/CollectionListing.tsx+++ b/components/CollectionListing.tsx@@ -4,7 +4,12 @@ import { CollectionIncludingMembersAndLinkCount } from "@/types/global";import Link from "next/link";import { useRouter } from "next/router";import React, { useEffect, useState } from "react";-import { DragDropContext, Draggable, DraggableProvided, Droppable } from "react-beautiful-dnd";+import {+ DragDropContext,+ Draggable,+ DraggableProvided,+ Droppable,+} from "react-beautiful-dnd";type Props = {links: boolean;@@ -14,7 +19,9 @@ const CollectionSelection = ({ links }: Props) => {const { collections } = useCollectionStore();const { account, updateAccount } = useAccountStore();// Use local state to store the collection order so we don't have to wait for a response from the API to update the UI- const [localCollectionOrder, setLocalCollectionOrder] = useState<number[] | []>([]);+ const [localCollectionOrder, setLocalCollectionOrder] = useState<+ number[] | []+ >([]);const [active, setActive] = useState("");const router = useRouter();@@ -40,8 +47,15 @@ const CollectionSelection = ({ links }: Props) => {}const updatedCollectionOrder = [...account.collectionOrder];- const [movedCollectionId] = updatedCollectionOrder.splice(result.source.index, 1);- updatedCollectionOrder.splice(result.destination.index, 0, movedCollectionId);+ const [movedCollectionId] = updatedCollectionOrder.splice(+ result.source.index,+ 1+ );+ updatedCollectionOrder.splice(+ result.destination.index,+ 0,+ movedCollectionId+ );// Update local state with the new collection ordersetLocalCollectionOrder(updatedCollectionOrder);@@ -134,18 +148,20 @@ const CollectionItem = ({<divref={innerRef}{...props}- className={`${active === `/collections/${collection.id}`- ? "bg-primary/20"- : "hover:bg-neutral/20"- } duration-100 rounded-md flex w-full items-center cursor-pointer mb-1 px-2 gap-1`}+ className={`${+ active === `/collections/${collection.id}`+ ? "bg-primary/20"+ : "hover:bg-neutral/20"+ } duration-100 rounded-md flex w-full items-center cursor-pointer mb-1 px-2 gap-1`}><buttononClick={() => setIsOpen(!isOpen)}className="flex items-center"><i- className={`bi-chevron-down ${isOpen ? "rotate-reverse" : "rotate"- }`}+ className={`bi-chevron-down ${+ isOpen ? "rotate-reverse" : "rotate"+ }`}></i></button><Link href={`/collections/${collection.id}`} className="w-full">@@ -189,10 +205,11 @@ const CollectionItem = ({<div ref={innerRef} {...props}><Link href={`/collections/${collection.id}`} className="w-full"><div- className={`${active === `/collections/${collection.id}`- ? "bg-primary/20"- : "hover:bg-neutral/20"- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize mb-1`}+ className={`${+ active === `/collections/${collection.id}`+ ? "bg-primary/20"+ : "hover:bg-neutral/20"+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize mb-1`}><iclassName="bi-folder-fill text-2xl drop-shadow"diff --git a/components/Sidebar.tsx b/components/Sidebar.tsxindex cfd9fc83..d77dbacb 100644--- a/components/Sidebar.tsx+++ b/components/Sidebar.tsx@@ -41,12 +41,12 @@ export default function Sidebar({ className }: { className?: string }) {setActive(router.asPath);}, [router, collections]);-return (<divid="sidebar"- className={`bg-base-200 h-full w-80 overflow-y-auto border-solid border border-base-200 border-r-neutral-content p-2 z-20 ${className || ""- }`}+ className={`bg-base-200 h-full w-80 overflow-y-auto border-solid border border-base-200 border-r-neutral-content p-2 z-20 ${+ className || ""+ }`}><div className="grid grid-cols-2 gap-2"><SidebarHighlightLink@@ -84,8 +84,9 @@ export default function Sidebar({ className }: { className?: string }) {><p className="text-sm">Collections</p><i- className={`bi-chevron-down ${collectionDisclosure ? "rotate-reverse" : "rotate"- }`}+ className={`bi-chevron-down ${+ collectionDisclosure ? "rotate-reverse" : "rotate"+ }`}></i></Disclosure.Button><Transition@@ -110,8 +111,9 @@ export default function Sidebar({ className }: { className?: string }) {><p className="text-sm">Tags</p><i- className={`bi-chevron-down ${tagDisclosure ? "rotate-reverse" : "rotate"- }`}+ className={`bi-chevron-down ${+ tagDisclosure ? "rotate-reverse" : "rotate"+ }`}></i></Disclosure.Button><Transition@@ -130,10 +132,11 @@ export default function Sidebar({ className }: { className?: string }) {return (<Link key={i} href={`/tags/${e.id}`}><div- className={`${active === `/tags/${e.id}`- ? "bg-primary/20"- : "hover:bg-neutral/20"- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}+ className={`${+ active === `/tags/${e.id}`+ ? "bg-primary/20"+ : "hover:bg-neutral/20"+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}><i className="bi-hash text-2xl text-primary drop-shadow"></i><p className="truncate w-full pr-7">{e.name}</p>diff --git a/lib/api/controllers/collections/postCollection.ts b/lib/api/controllers/collections/postCollection.tsindex 6b41ea1a..0969f1ce 100644--- a/lib/api/controllers/collections/postCollection.ts+++ b/lib/api/controllers/collections/postCollection.ts@@ -44,10 +44,10 @@ export default async function postCollection(color: collection.color,parent: collection.parentId? {- connect: {- id: collection.parentId,- },- }+ connect: {+ id: collection.parentId,+ },+ }: undefined,},include: {@@ -78,7 +78,6 @@ export default async function postCollection(},});-createFolder({ filePath: `archives/${newCollection.id}` });return { response: newCollection, status: 200 };diff --git a/lib/api/controllers/users/userId/updateUserById.ts b/lib/api/controllers/users/userId/updateUserById.tsindex bc92728f..fa0e21da 100644--- a/lib/api/controllers/users/userId/updateUserById.ts+++ b/lib/api/controllers/users/userId/updateUserById.ts@@ -97,18 +97,18 @@ export default async function updateUserById(id: { not: userId },OR: emailEnabled? [- {- username: data.username.toLowerCase(),- },- {- email: data.email?.toLowerCase(),- },- ]+ {+ username: data.username.toLowerCase(),+ },+ {+ email: data.email?.toLowerCase(),+ },+ ]: [- {- username: data.username.toLowerCase(),- },- ],+ {+ username: data.username.toLowerCase(),+ },+ ],},});diff --git a/pages/_app.tsx b/pages/_app.tsxindex e4005e95..b9659411 100644--- a/pages/_app.tsx+++ b/pages/_app.tsx@@ -54,7 +54,6 @@ export default function App({<link rel="manifest" href="/site.webmanifest" /></Head><AuthRedirect>-<Toasterposition="top-center"reverseOrder={false}