diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsx index 53abfcc..28a0052 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([]); + 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 order setLocalCollectionOrder(updatedCollectionOrder); @@ -134,18 +148,20 @@ const CollectionItem = ({
@@ -189,10 +205,11 @@ const CollectionItem = ({

Collections

Tags

{e.name}

diff --git a/lib/api/controllers/collections/postCollection.ts b/lib/api/controllers/collections/postCollection.ts index 6b41ea1..0969f1c 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.ts index bc92728..fa0e21d 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.tsx index e4005e9..b965941 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -54,7 +54,6 @@ export default function App({ -