From 3208dda3848ad739f54cebf44c423e2b68e85b2d Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 28 Feb 2024 20:45:28 +0000 Subject: feature: Add support for storing and previewing raw notes --- .../app/dashboard/bookmarks/components/AddLink.tsx | 71 ---------------------- 1 file changed, 71 deletions(-) delete mode 100644 packages/web/app/dashboard/bookmarks/components/AddLink.tsx (limited to 'packages/web/app/dashboard/bookmarks/components/AddLink.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/AddLink.tsx b/packages/web/app/dashboard/bookmarks/components/AddLink.tsx deleted file mode 100644 index 242a52a5..00000000 --- a/packages/web/app/dashboard/bookmarks/components/AddLink.tsx +++ /dev/null @@ -1,71 +0,0 @@ -"use client"; - -import { Form, FormControl, FormField, FormItem } from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { Plus } from "lucide-react"; -import { useForm, SubmitErrorHandler } from "react-hook-form"; -import { z } from "zod"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { toast } from "@/components/ui/use-toast"; -import { api } from "@/lib/trpc"; -import { ActionButton } from "@/components/ui/action-button"; - -const formSchema = z.object({ - url: z.string().url({ message: "The link must be a valid URL" }), -}); - -export default function AddLink() { - const form = useForm>({ - resolver: zodResolver(formSchema), - }); - - const invalidateBookmarksCache = api.useUtils().bookmarks.invalidate; - const bookmarkLinkMutator = api.bookmarks.bookmarkLink.useMutation({ - onSuccess: () => { - invalidateBookmarksCache(); - }, - onError: () => { - toast({ description: "Something went wrong", variant: "destructive" }); - }, - }); - - const onError: SubmitErrorHandler> = (errors) => { - toast({ - description: Object.values(errors) - .map((v) => v.message) - .join("\n"), - variant: "destructive", - }); - }; - - return ( -
- - bookmarkLinkMutator.mutate({ url: value.url, type: "link" }), - onError, - )} - > -
- { - return ( - - - - - - ); - }} - /> - - - -
-
- - ); -} -- cgit v1.2.3-70-g09d2