From a03f1dc2ac25579df30e8cb59d2703110c3e564d Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 13 Mar 2024 22:37:41 +0000 Subject: lint: Lint and format the entire repo with the new configs --- apps/web/app/api/trpc/[trpc]/route.ts | 9 +++--- apps/web/app/dashboard/admin/page.tsx | 2 +- apps/web/app/dashboard/bookmarks/layout.tsx | 2 +- apps/web/app/dashboard/layout.tsx | 2 +- apps/web/app/dashboard/lists/[listId]/page.tsx | 6 ++-- apps/web/app/dashboard/lists/page.tsx | 2 +- .../app/dashboard/preview/[bookmarkId]/page.tsx | 2 +- apps/web/app/dashboard/search/page.tsx | 5 ++-- apps/web/app/dashboard/settings/page.tsx | 1 + apps/web/app/dashboard/tags/[tagName]/page.tsx | 7 +++-- apps/web/app/dashboard/tags/page.tsx | 9 +++--- apps/web/app/layout.tsx | 6 ++-- apps/web/app/page.tsx | 2 +- apps/web/app/signin/page.tsx | 4 +-- .../dashboard/bookmarks/AddLinkButton.tsx | 17 ++++++----- .../dashboard/bookmarks/AddToListModal.tsx | 23 +++++++-------- .../dashboard/bookmarks/BookmarkCardSkeleton.tsx | 2 +- .../dashboard/bookmarks/BookmarkOptions.tsx | 14 +++++---- .../dashboard/bookmarks/BookmarkPreview.tsx | 9 +++--- .../dashboard/bookmarks/BookmarkedTextEditor.tsx | 11 +++---- .../components/dashboard/bookmarks/Bookmarks.tsx | 6 ++-- .../dashboard/bookmarks/BookmarksGrid.tsx | 15 ++++++---- .../components/dashboard/bookmarks/LinkCard.tsx | 14 +++++---- .../web/components/dashboard/bookmarks/TagList.tsx | 7 +++-- .../components/dashboard/bookmarks/TagModal.tsx | 14 ++++++--- .../components/dashboard/bookmarks/TextCard.tsx | 16 +++++----- apps/web/components/dashboard/bookmarks/TopNav.tsx | 9 +++--- .../components/dashboard/lists/AllListsView.tsx | 9 +++--- .../dashboard/lists/DeleteListButton.tsx | 11 +++---- apps/web/components/dashboard/lists/ListView.tsx | 5 ++-- .../components/dashboard/search/SearchInput.tsx | 2 +- .../components/dashboard/settings/AddApiKey.tsx | 34 +++++++++++----------- .../dashboard/settings/ApiKeySettings.tsx | 3 +- .../components/dashboard/settings/DeleteApiKey.tsx | 9 +++--- apps/web/components/dashboard/sidebar/AllLists.tsx | 10 ++++--- .../components/dashboard/sidebar/ModileSidebar.tsx | 9 +++--- .../dashboard/sidebar/ModileSidebarItem.tsx | 2 +- .../components/dashboard/sidebar/NewListModal.tsx | 28 +++++++----------- apps/web/components/dashboard/sidebar/Sidebar.tsx | 16 +++++----- .../components/dashboard/sidebar/SidebarItem.tsx | 2 +- apps/web/components/signin/CredentialsForm.tsx | 20 +++++++------ apps/web/components/signin/SignInForm.tsx | 3 +- .../web/components/signin/SignInProviderButton.tsx | 4 ++- apps/web/components/ui/action-button.tsx | 3 +- apps/web/components/ui/back-button.tsx | 4 ++- apps/web/components/ui/badge.tsx | 12 ++++---- apps/web/components/ui/button.tsx | 10 +++---- apps/web/components/ui/card.tsx | 6 ++-- apps/web/components/ui/dialog.tsx | 11 ++++--- apps/web/components/ui/dropdown-menu.tsx | 17 +++++------ apps/web/components/ui/form.tsx | 31 ++++++++------------ apps/web/components/ui/imageCard.tsx | 1 - apps/web/components/ui/input.tsx | 6 ++-- apps/web/components/ui/label.tsx | 6 ++-- apps/web/components/ui/popover.tsx | 5 ++-- apps/web/components/ui/scroll-area.tsx | 5 ++-- apps/web/components/ui/select.tsx | 11 ++++--- apps/web/components/ui/separator.tsx | 5 ++-- apps/web/components/ui/skeleton.tsx | 2 +- apps/web/components/ui/table.tsx | 9 +++--- apps/web/components/ui/tabs.tsx | 9 +++--- apps/web/components/ui/textarea.tsx | 6 ++-- apps/web/components/ui/toast.tsx | 16 +++++----- apps/web/components/ui/use-toast.ts | 5 ++-- apps/web/lib/bookmarkUtils.tsx | 2 +- apps/web/lib/hooks/bookmark-search.ts | 4 +-- apps/web/lib/providers.tsx | 12 ++++---- apps/web/lib/trpc.tsx | 4 ++- apps/web/lib/utils.ts | 3 +- apps/web/next.config.mjs | 6 +--- apps/web/server/api/client.ts | 5 ++-- apps/web/server/auth.ts | 17 ++++++----- apps/web/vitest.config.ts | 2 +- 73 files changed, 319 insertions(+), 299 deletions(-) (limited to 'apps/web') diff --git a/apps/web/app/api/trpc/[trpc]/route.ts b/apps/web/app/api/trpc/[trpc]/route.ts index 02ca966d..23df286f 100644 --- a/apps/web/app/api/trpc/[trpc]/route.ts +++ b/apps/web/app/api/trpc/[trpc]/route.ts @@ -1,8 +1,9 @@ -import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; -import { appRouter } from "@hoarder/trpc/routers/_app"; import { createContext } from "@/server/api/client"; -import { authenticateApiKey } from "@hoarder/trpc/auth"; +import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; + import { db } from "@hoarder/db"; +import { authenticateApiKey } from "@hoarder/trpc/auth"; +import { appRouter } from "@hoarder/trpc/routers/_app"; const handler = (req: Request) => fetchRequestHandler({ @@ -21,7 +22,7 @@ const handler = (req: Request) => // Check if the request has an Authorization token, if it does, assume that API key authentication is requested. const authorizationHeader = opts.req.headers.get("Authorization"); if (authorizationHeader && authorizationHeader.startsWith("Bearer ")) { - const token = authorizationHeader.split(" ")[1]!; + const token = authorizationHeader.split(" ")[1]; try { const user = await authenticateApiKey(token); return { user, db }; diff --git a/apps/web/app/dashboard/admin/page.tsx b/apps/web/app/dashboard/admin/page.tsx index 6babdd79..7b4c3cdd 100644 --- a/apps/web/app/dashboard/admin/page.tsx +++ b/apps/web/app/dashboard/admin/page.tsx @@ -1,5 +1,6 @@ "use client"; +import { useRouter } from "next/navigation"; import { ActionButton } from "@/components/ui/action-button"; import LoadingSpinner from "@/components/ui/spinner"; import { @@ -15,7 +16,6 @@ import { api } from "@/lib/trpc"; import { keepPreviousData } from "@tanstack/react-query"; import { Trash } from "lucide-react"; import { useSession } from "next-auth/react"; -import { useRouter } from "next/navigation"; function ActionsSection() { const { mutate: recrawlLinks, isPending: isRecrawlPending } = diff --git a/apps/web/app/dashboard/bookmarks/layout.tsx b/apps/web/app/dashboard/bookmarks/layout.tsx index 71ee143b..ca99a87b 100644 --- a/apps/web/app/dashboard/bookmarks/layout.tsx +++ b/apps/web/app/dashboard/bookmarks/layout.tsx @@ -1,6 +1,6 @@ +import type { Metadata } from "next"; import React from "react"; import TopNav from "@/components/dashboard/bookmarks/TopNav"; -import type { Metadata } from "next"; export const metadata: Metadata = { title: "Hoarder - Bookmarks", diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsx index 31d592fb..dc3af9c7 100644 --- a/apps/web/app/dashboard/layout.tsx +++ b/apps/web/app/dashboard/layout.tsx @@ -1,6 +1,6 @@ -import { Separator } from "@/components/ui/separator"; import MobileSidebar from "@/components/dashboard/sidebar/ModileSidebar"; import Sidebar from "@/components/dashboard/sidebar/Sidebar"; +import { Separator } from "@/components/ui/separator"; export default async function Dashboard({ children, diff --git a/apps/web/app/dashboard/lists/[listId]/page.tsx b/apps/web/app/dashboard/lists/[listId]/page.tsx index 006fd3ad..4e35c377 100644 --- a/apps/web/app/dashboard/lists/[listId]/page.tsx +++ b/apps/web/app/dashboard/lists/[listId]/page.tsx @@ -1,9 +1,9 @@ +import { notFound, redirect } from "next/navigation"; +import DeleteListButton from "@/components/dashboard/lists/DeleteListButton"; +import ListView from "@/components/dashboard/lists/ListView"; import { api } from "@/server/api/client"; import { getServerAuthSession } from "@/server/auth"; import { TRPCError } from "@trpc/server"; -import { notFound, redirect } from "next/navigation"; -import ListView from "@/components/dashboard/lists/ListView"; -import DeleteListButton from "@/components/dashboard/lists/DeleteListButton"; export default async function ListPage({ params, diff --git a/apps/web/app/dashboard/lists/page.tsx b/apps/web/app/dashboard/lists/page.tsx index 88eeda47..a8c53eb6 100644 --- a/apps/web/app/dashboard/lists/page.tsx +++ b/apps/web/app/dashboard/lists/page.tsx @@ -1,5 +1,5 @@ -import { api } from "@/server/api/client"; import AllListsView from "@/components/dashboard/lists/AllListsView"; +import { api } from "@/server/api/client"; export default async function ListsPage() { const lists = await api.lists.list(); diff --git a/apps/web/app/dashboard/preview/[bookmarkId]/page.tsx b/apps/web/app/dashboard/preview/[bookmarkId]/page.tsx index 707d2b69..5f10b56e 100644 --- a/apps/web/app/dashboard/preview/[bookmarkId]/page.tsx +++ b/apps/web/app/dashboard/preview/[bookmarkId]/page.tsx @@ -1,5 +1,5 @@ -import { api } from "@/server/api/client"; import BookmarkPreview from "@/components/dashboard/bookmarks/BookmarkPreview"; +import { api } from "@/server/api/client"; export default async function BookmarkPreviewPage({ params, diff --git a/apps/web/app/dashboard/search/page.tsx b/apps/web/app/dashboard/search/page.tsx index 602f6aa0..38099c18 100644 --- a/apps/web/app/dashboard/search/page.tsx +++ b/apps/web/app/dashboard/search/page.tsx @@ -1,11 +1,12 @@ "use client"; -import BookmarksGrid from "@/components/dashboard/bookmarks/BookmarksGrid"; -import Loading from "../bookmarks/loading"; import { Suspense, useRef } from "react"; +import BookmarksGrid from "@/components/dashboard/bookmarks/BookmarksGrid"; import { SearchInput } from "@/components/dashboard/search/SearchInput"; import { useBookmarkSearch } from "@/lib/hooks/bookmark-search"; +import Loading from "../bookmarks/loading"; + function SearchComp() { const { data, isPending, isPlaceholderData } = useBookmarkSearch(); diff --git a/apps/web/app/dashboard/settings/page.tsx b/apps/web/app/dashboard/settings/page.tsx index 38091e6c..3d54d2d7 100644 --- a/apps/web/app/dashboard/settings/page.tsx +++ b/apps/web/app/dashboard/settings/page.tsx @@ -1,4 +1,5 @@ import ApiKeySettings from "@/components/dashboard/settings/ApiKeySettings"; + export default async function Settings() { return (
diff --git a/apps/web/app/dashboard/tags/[tagName]/page.tsx b/apps/web/app/dashboard/tags/[tagName]/page.tsx index c978b86a..51b3cb0b 100644 --- a/apps/web/app/dashboard/tags/[tagName]/page.tsx +++ b/apps/web/app/dashboard/tags/[tagName]/page.tsx @@ -1,11 +1,12 @@ -import { getServerAuthSession } from "@/server/auth"; -import { db } from "@hoarder/db"; import { notFound, redirect } from "next/navigation"; import BookmarksGrid from "@/components/dashboard/bookmarks/BookmarksGrid"; import { api } from "@/server/api/client"; -import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema"; +import { getServerAuthSession } from "@/server/auth"; import { and, eq } from "drizzle-orm"; +import { db } from "@hoarder/db"; +import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema"; + export default async function TagPage({ params, }: { diff --git a/apps/web/app/dashboard/tags/page.tsx b/apps/web/app/dashboard/tags/page.tsx index 44c164e1..08acd968 100644 --- a/apps/web/app/dashboard/tags/page.tsx +++ b/apps/web/app/dashboard/tags/page.tsx @@ -1,15 +1,16 @@ +import Link from "next/link"; +import { redirect } from "next/navigation"; import { Separator } from "@/components/ui/separator"; import { getServerAuthSession } from "@/server/auth"; +import { count, eq } from "drizzle-orm"; + import { db } from "@hoarder/db"; import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema"; -import { count, eq } from "drizzle-orm"; -import Link from "next/link"; -import { redirect } from "next/navigation"; function TagPill({ name, count }: { name: string; count: number }) { return ( {name} {count} diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index b1790a1f..6ec9c3e4 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,12 +1,14 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; + import "./globals.css"; + +import type { Viewport } from "next"; import React from "react"; import { Toaster } from "@/components/ui/toaster"; import Providers from "@/lib/providers"; -import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; import { getServerAuthSession } from "@/server/auth"; -import type { Viewport } from "next"; +import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; const inter = Inter({ subsets: ["latin"] }); diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index f467b64b..ca076cbf 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,5 +1,5 @@ -import { getServerAuthSession } from "@/server/auth"; import { redirect } from "next/navigation"; +import { getServerAuthSession } from "@/server/auth"; export default async function Home() { // TODO: Home currently just redirects between pages until we build a proper landing page diff --git a/apps/web/app/signin/page.tsx b/apps/web/app/signin/page.tsx index fed71b62..4dc81376 100644 --- a/apps/web/app/signin/page.tsx +++ b/apps/web/app/signin/page.tsx @@ -1,7 +1,7 @@ -import { PackageOpen } from "lucide-react"; -import SignInForm from "@/components/signin/SignInForm"; import { redirect } from "next/dist/client/components/navigation"; +import SignInForm from "@/components/signin/SignInForm"; import { getServerAuthSession } from "@/server/auth"; +import { PackageOpen } from "lucide-react"; export default async function SignInPage() { const session = await getServerAuthSession(); diff --git a/apps/web/components/dashboard/bookmarks/AddLinkButton.tsx b/apps/web/components/dashboard/bookmarks/AddLinkButton.tsx index 5973f909..45a67020 100644 --- a/apps/web/components/dashboard/bookmarks/AddLinkButton.tsx +++ b/apps/web/components/dashboard/bookmarks/AddLinkButton.tsx @@ -1,10 +1,5 @@ -import { Form, FormControl, FormField, FormItem } from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -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 type { SubmitErrorHandler } from "react-hook-form"; +import { useState } from "react"; import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { @@ -16,7 +11,13 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; -import { useState } from "react"; +import { Form, FormControl, FormField, FormItem } from "@/components/ui/form"; +import { Input } from "@/components/ui/input"; +import { toast } from "@/components/ui/use-toast"; +import { api } from "@/lib/trpc"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; export function AddLinkButton({ children }: { children: React.ReactNode }) { const [isOpen, setOpen] = useState(false); diff --git a/apps/web/components/dashboard/bookmarks/AddToListModal.tsx b/apps/web/components/dashboard/bookmarks/AddToListModal.tsx index c9fd5da0..6242aa27 100644 --- a/apps/web/components/dashboard/bookmarks/AddToListModal.tsx +++ b/apps/web/components/dashboard/bookmarks/AddToListModal.tsx @@ -1,3 +1,4 @@ +import { useState } from "react"; import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { @@ -15,11 +16,6 @@ import { FormItem, FormMessage, } from "@/components/ui/form"; - -import { toast } from "@/components/ui/use-toast"; -import { api } from "@/lib/trpc"; -import { useState } from "react"; - import { Select, SelectContent, @@ -29,9 +25,11 @@ import { SelectValue, } from "@/components/ui/select"; import LoadingSpinner from "@/components/ui/spinner"; -import { z } from "zod"; -import { useForm } from "react-hook-form"; +import { toast } from "@/components/ui/use-toast"; +import { api } from "@/lib/trpc"; import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; export default function AddToListModal({ bookmarkId, @@ -115,12 +113,11 @@ export default function AddToListModal({ - {lists && - lists.lists.map((l) => ( - - {l.icon} {l.name} - - ))} + {lists?.lists.map((l) => ( + + {l.icon} {l.name} + + ))} diff --git a/apps/web/components/dashboard/bookmarks/BookmarkCardSkeleton.tsx b/apps/web/components/dashboard/bookmarks/BookmarkCardSkeleton.tsx index 1f5fa433..026b8d37 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkCardSkeleton.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkCardSkeleton.tsx @@ -1,10 +1,10 @@ import { ImageCard, + ImageCardBanner, ImageCardBody, ImageCardContent, ImageCardFooter, ImageCardTitle, - ImageCardBanner, } from "@/components/ui/imageCard"; import { Skeleton } from "@/components/ui/skeleton"; diff --git a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx index 4f08ebee..3656a435 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx @@ -1,8 +1,6 @@ "use client"; -import { useToast } from "@/components/ui/use-toast"; -import { api } from "@/lib/trpc"; -import { ZBookmark, ZBookmarkedLink } from "@hoarder/trpc/types/bookmarks"; +import { useState } from "react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, @@ -10,6 +8,8 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; +import { useToast } from "@/components/ui/use-toast"; +import { api } from "@/lib/trpc"; import { Archive, Link, @@ -21,10 +21,12 @@ import { Tags, Trash2, } from "lucide-react"; -import { useTagModel } from "./TagModal"; -import { useState } from "react"; -import { BookmarkedTextEditor } from "./BookmarkedTextEditor"; + +import type { ZBookmark, ZBookmarkedLink } from "@hoarder/trpc/types/bookmarks"; + import { useAddToListModal } from "./AddToListModal"; +import { BookmarkedTextEditor } from "./BookmarkedTextEditor"; +import { useTagModel } from "./TagModal"; export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) { const { toast } = useToast(); diff --git a/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx b/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx index 2a8ae1b1..69aa60a3 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx @@ -1,14 +1,15 @@ "use client"; +import Link from "next/link"; import { BackButton } from "@/components/ui/back-button"; import { Skeleton } from "@/components/ui/skeleton"; import { isBookmarkStillCrawling } from "@/lib/bookmarkUtils"; import { api } from "@/lib/trpc"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; import { ArrowLeftCircle, CalendarDays, ExternalLink } from "lucide-react"; -import Link from "next/link"; import Markdown from "react-markdown"; +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; + export default function BookmarkPreview({ initialData, }: { @@ -37,7 +38,7 @@ export default function BookmarkPreview({ const linkHeader = bookmark.content.type == "link" && (

- {bookmark.content.title || bookmark.content.url} + {bookmark.content.title ?? bookmark.content.url}

View Original @@ -72,7 +73,7 @@ export default function BookmarkPreview({ } return ( -
+
diff --git a/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx b/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx index a5b58f1a..eb618474 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx @@ -1,4 +1,6 @@ -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; +import { useState } from "react"; +import { ActionButton } from "@/components/ui/action-button"; +import { Button } from "@/components/ui/button"; import { Dialog, DialogClose, @@ -8,12 +10,11 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog"; -import { ActionButton } from "@/components/ui/action-button"; -import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; -import { api } from "@/lib/trpc"; -import { useState } from "react"; import { toast } from "@/components/ui/use-toast"; +import { api } from "@/lib/trpc"; + +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; export function BookmarkedTextEditor({ bookmark, diff --git a/apps/web/components/dashboard/bookmarks/Bookmarks.tsx b/apps/web/components/dashboard/bookmarks/Bookmarks.tsx index 1ad3670c..9f001551 100644 --- a/apps/web/components/dashboard/bookmarks/Bookmarks.tsx +++ b/apps/web/components/dashboard/bookmarks/Bookmarks.tsx @@ -1,9 +1,11 @@ import { redirect } from "next/navigation"; -import BookmarksGrid from "./BookmarksGrid"; -import { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks"; import { api } from "@/server/api/client"; import { getServerAuthSession } from "@/server/auth"; +import type { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks"; + +import BookmarksGrid from "./BookmarksGrid"; + export default async function Bookmarks({ favourited, archived, diff --git a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx index 4d5b6b0a..dd529a8b 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx @@ -1,14 +1,19 @@ "use client"; -import LinkCard from "./LinkCard"; -import { ZBookmark, ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks"; +import { useMemo } from "react"; import { api } from "@/lib/trpc"; -import TextCard from "./TextCard"; +import tailwindConfig from "@/tailwind.config"; import { Slot } from "@radix-ui/react-slot"; import Masonry from "react-masonry-css"; import resolveConfig from "tailwindcss/resolveConfig"; -import tailwindConfig from "@/tailwind.config"; -import { useMemo } from "react"; + +import type { + ZBookmark, + ZGetBookmarksRequest, +} from "@hoarder/trpc/types/bookmarks"; + +import LinkCard from "./LinkCard"; +import TextCard from "./TextCard"; function getBreakpointConfig() { const fullConfig = resolveConfig(tailwindConfig); diff --git a/apps/web/components/dashboard/bookmarks/LinkCard.tsx b/apps/web/components/dashboard/bookmarks/LinkCard.tsx index 50f30e47..808e6d91 100644 --- a/apps/web/components/dashboard/bookmarks/LinkCard.tsx +++ b/apps/web/components/dashboard/bookmarks/LinkCard.tsx @@ -1,5 +1,6 @@ "use client"; +import Link from "next/link"; import { ImageCard, ImageCardBanner, @@ -8,17 +9,18 @@ import { ImageCardFooter, ImageCardTitle, } from "@/components/ui/imageCard"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; -import Link from "next/link"; -import BookmarkOptions from "./BookmarkOptions"; -import { api } from "@/lib/trpc"; -import { Maximize2, Star } from "lucide-react"; -import TagList from "./TagList"; import { isBookmarkStillCrawling, isBookmarkStillLoading, isBookmarkStillTagging, } from "@/lib/bookmarkUtils"; +import { api } from "@/lib/trpc"; +import { Maximize2, Star } from "lucide-react"; + +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; + +import BookmarkOptions from "./BookmarkOptions"; +import TagList from "./TagList"; export default function LinkCard({ bookmark: initialData, diff --git a/apps/web/components/dashboard/bookmarks/TagList.tsx b/apps/web/components/dashboard/bookmarks/TagList.tsx index 6c9d2d22..cb94e5d7 100644 --- a/apps/web/components/dashboard/bookmarks/TagList.tsx +++ b/apps/web/components/dashboard/bookmarks/TagList.tsx @@ -1,9 +1,10 @@ -import { badgeVariants } from "@/components/ui/badge"; import Link from "next/link"; +import { badgeVariants } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; import { cn } from "@/lib/utils"; +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; + export default function TagList({ bookmark, loading, @@ -26,7 +27,7 @@ export default function TagList({ diff --git a/apps/web/components/dashboard/bookmarks/TagModal.tsx b/apps/web/components/dashboard/bookmarks/TagModal.tsx index 8c09d00e..367e6e7d 100644 --- a/apps/web/components/dashboard/bookmarks/TagModal.tsx +++ b/apps/web/components/dashboard/bookmarks/TagModal.tsx @@ -1,3 +1,5 @@ +import type { KeyboardEvent } from "react"; +import { useEffect, useState } from "react"; import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { @@ -11,13 +13,17 @@ import { import { Input } from "@/components/ui/input"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; -import { ZAttachedByEnum } from "@hoarder/trpc/types/tags"; import { cn } from "@/lib/utils"; import { Sparkles, X } from "lucide-react"; -import { useState, KeyboardEvent, useEffect } from "react"; -type EditableTag = { attachedBy: ZAttachedByEnum; id?: string; name: string }; +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; +import type { ZAttachedByEnum } from "@hoarder/trpc/types/tags"; + +interface EditableTag { + attachedBy: ZAttachedByEnum; + id?: string; + name: string; +} function TagAddInput({ addTag }: { addTag: (tag: string) => void }) { const onKeyUp = (e: KeyboardEvent) => { diff --git a/apps/web/components/dashboard/bookmarks/TextCard.tsx b/apps/web/components/dashboard/bookmarks/TextCard.tsx index 2565e69d..5028c1bb 100644 --- a/apps/web/components/dashboard/bookmarks/TextCard.tsx +++ b/apps/web/components/dashboard/bookmarks/TextCard.tsx @@ -1,16 +1,18 @@ "use client"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; -import BookmarkOptions from "./BookmarkOptions"; +import { useState } from "react"; +import Link from "next/link"; +import { isBookmarkStillTagging } from "@/lib/bookmarkUtils"; import { api } from "@/lib/trpc"; -import { Maximize2, Star } from "lucide-react"; import { cn } from "@/lib/utils"; -import TagList from "./TagList"; +import { Maximize2, Star } from "lucide-react"; import Markdown from "react-markdown"; -import { useState } from "react"; + +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; + import { BookmarkedTextViewer } from "./BookmarkedTextViewer"; -import Link from "next/link"; -import { isBookmarkStillTagging } from "@/lib/bookmarkUtils"; +import BookmarkOptions from "./BookmarkOptions"; +import TagList from "./TagList"; export default function TextCard({ bookmark: initialData, diff --git a/apps/web/components/dashboard/bookmarks/TopNav.tsx b/apps/web/components/dashboard/bookmarks/TopNav.tsx index 6c0f18e5..4274762c 100644 --- a/apps/web/components/dashboard/bookmarks/TopNav.tsx +++ b/apps/web/components/dashboard/bookmarks/TopNav.tsx @@ -1,11 +1,12 @@ "use client"; -import { Link, NotebookPen } from "lucide-react"; -import { Button } from "@/components/ui/button"; -import { BookmarkedTextEditor } from "./BookmarkedTextEditor"; import { useState } from "react"; -import { AddLinkButton } from "./AddLinkButton"; +import { Button } from "@/components/ui/button"; +import { Link, NotebookPen } from "lucide-react"; + import { SearchInput } from "../search/SearchInput"; +import { AddLinkButton } from "./AddLinkButton"; +import { BookmarkedTextEditor } from "./BookmarkedTextEditor"; function AddText() { const [isEditorOpen, setEditorOpen] = useState(false); diff --git a/apps/web/components/dashboard/lists/AllListsView.tsx b/apps/web/components/dashboard/lists/AllListsView.tsx index 81f31cde..acb94edb 100644 --- a/apps/web/components/dashboard/lists/AllListsView.tsx +++ b/apps/web/components/dashboard/lists/AllListsView.tsx @@ -1,12 +1,13 @@ "use client"; +import Link from "next/link"; +import { useNewListModal } from "@/components/dashboard/sidebar/NewListModal"; import { Button } from "@/components/ui/button"; import { api } from "@/lib/trpc"; -import { ZBookmarkList } from "@hoarder/trpc/types/lists"; import { keepPreviousData } from "@tanstack/react-query"; import { Plus } from "lucide-react"; -import Link from "next/link"; -import { useNewListModal } from "@/components/dashboard/sidebar/NewListModal"; + +import type { ZBookmarkList } from "@hoarder/trpc/types/lists"; function ListItem({ name, @@ -19,7 +20,7 @@ function ListItem({ }) { return ( -
+

{icon} {name}

diff --git a/apps/web/components/dashboard/lists/DeleteListButton.tsx b/apps/web/components/dashboard/lists/DeleteListButton.tsx index 5303b217..f5fcb18b 100644 --- a/apps/web/components/dashboard/lists/DeleteListButton.tsx +++ b/apps/web/components/dashboard/lists/DeleteListButton.tsx @@ -1,5 +1,8 @@ "use client"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -10,13 +13,11 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; -import { Trash } from "lucide-react"; -import { useRouter } from "next/navigation"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; -import { ActionButton } from "@/components/ui/action-button"; -import { useState } from "react"; -import { ZBookmarkList } from "@hoarder/trpc/types/lists"; +import { Trash } from "lucide-react"; + +import type { ZBookmarkList } from "@hoarder/trpc/types/lists"; export default function DeleteListButton({ list }: { list: ZBookmarkList }) { const [isDialogOpen, setDialogOpen] = useState(false); diff --git a/apps/web/components/dashboard/lists/ListView.tsx b/apps/web/components/dashboard/lists/ListView.tsx index 2d48d9e3..beeea7f1 100644 --- a/apps/web/components/dashboard/lists/ListView.tsx +++ b/apps/web/components/dashboard/lists/ListView.tsx @@ -1,10 +1,11 @@ "use client"; import BookmarksGrid from "@/components/dashboard/bookmarks/BookmarksGrid"; -import { ZBookmark } from "@hoarder/trpc/types/bookmarks"; -import { ZBookmarkListWithBookmarks } from "@hoarder/trpc/types/lists"; import { api } from "@/lib/trpc"; +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; +import type { ZBookmarkListWithBookmarks } from "@hoarder/trpc/types/lists"; + export default function ListView({ bookmarks, list: initialData, diff --git a/apps/web/components/dashboard/search/SearchInput.tsx b/apps/web/components/dashboard/search/SearchInput.tsx index 73d14c90..abb19f5e 100644 --- a/apps/web/components/dashboard/search/SearchInput.tsx +++ b/apps/web/components/dashboard/search/SearchInput.tsx @@ -1,7 +1,7 @@ +import React from "react"; import { Input } from "@/components/ui/input"; import { useDoBookmarkSearch } from "@/lib/hooks/bookmark-search"; import { cn } from "@/lib/utils"; -import React from "react"; const SearchInput = React.forwardRef< HTMLInputElement, diff --git a/apps/web/components/dashboard/settings/AddApiKey.tsx b/apps/web/components/dashboard/settings/AddApiKey.tsx index a4fd9c25..15a78d56 100644 --- a/apps/web/components/dashboard/settings/AddApiKey.tsx +++ b/apps/web/components/dashboard/settings/AddApiKey.tsx @@ -1,17 +1,10 @@ "use client"; +import type { SubmitErrorHandler } from "react-hook-form"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form"; - import { Dialog, DialogClose, @@ -22,15 +15,22 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; -import { z } from "zod"; -import { useRouter } from "next/navigation"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm, SubmitErrorHandler } from "react-hook-form"; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form"; +import { Input } from "@/components/ui/input"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; -import { useState } from "react"; +import { zodResolver } from "@hookform/resolvers/zod"; import { Check, Copy } from "lucide-react"; -import { ActionButton } from "@/components/ui/action-button"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; function ApiKeySuccess({ apiKey }: { apiKey: string }) { const [isCopied, setCopied] = useState(false); diff --git a/apps/web/components/dashboard/settings/ApiKeySettings.tsx b/apps/web/components/dashboard/settings/ApiKeySettings.tsx index 1598f25f..a3680863 100644 --- a/apps/web/components/dashboard/settings/ApiKeySettings.tsx +++ b/apps/web/components/dashboard/settings/ApiKeySettings.tsx @@ -7,8 +7,9 @@ import { TableRow, } from "@/components/ui/table"; import { api } from "@/server/api/client"; -import DeleteApiKey from "./DeleteApiKey"; + import AddApiKey from "./AddApiKey"; +import DeleteApiKey from "./DeleteApiKey"; export default async function ApiKeys() { const keys = await api.apiKeys.list(); diff --git a/apps/web/components/dashboard/settings/DeleteApiKey.tsx b/apps/web/components/dashboard/settings/DeleteApiKey.tsx index 566136af..091f352c 100644 --- a/apps/web/components/dashboard/settings/DeleteApiKey.tsx +++ b/apps/web/components/dashboard/settings/DeleteApiKey.tsx @@ -1,8 +1,9 @@ "use client"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; -import { Trash } from "lucide-react"; - import { Dialog, DialogClose, @@ -13,11 +14,9 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; -import { useRouter } from "next/navigation"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; -import { ActionButton } from "@/components/ui/action-button"; -import { useState } from "react"; +import { Trash } from "lucide-react"; export default function DeleteApiKey({ name, diff --git a/apps/web/components/dashboard/sidebar/AllLists.tsx b/apps/web/components/dashboard/sidebar/AllLists.tsx index a77252d0..34680cdd 100644 --- a/apps/web/components/dashboard/sidebar/AllLists.tsx +++ b/apps/web/components/dashboard/sidebar/AllLists.tsx @@ -1,11 +1,13 @@ "use client"; +import Link from "next/link"; import { api } from "@/lib/trpc"; -import SidebarItem from "./SidebarItem"; -import NewListModal, { useNewListModal } from "./NewListModal"; import { Plus } from "lucide-react"; -import Link from "next/link"; -import { ZBookmarkList } from "@hoarder/trpc/types/lists"; + +import type { ZBookmarkList } from "@hoarder/trpc/types/lists"; + +import NewListModal, { useNewListModal } from "./NewListModal"; +import SidebarItem from "./SidebarItem"; export default function AllLists({ initialData, diff --git a/apps/web/components/dashboard/sidebar/ModileSidebar.tsx b/apps/web/components/dashboard/sidebar/ModileSidebar.tsx index 4bd6a347..3c68433a 100644 --- a/apps/web/components/dashboard/sidebar/ModileSidebar.tsx +++ b/apps/web/components/dashboard/sidebar/ModileSidebar.tsx @@ -1,11 +1,12 @@ -import MobileSidebarItem from "./ModileSidebarItem"; import { - Tag, + ClipboardList, PackageOpen, - Settings, Search, - ClipboardList, + Settings, + Tag, } from "lucide-react"; + +import MobileSidebarItem from "./ModileSidebarItem"; import SidebarProfileOptions from "./SidebarProfileOptions"; export default async function MobileSidebar() { diff --git a/apps/web/components/dashboard/sidebar/ModileSidebarItem.tsx b/apps/web/components/dashboard/sidebar/ModileSidebarItem.tsx index 9389d2e4..d2b4aad3 100644 --- a/apps/web/components/dashboard/sidebar/ModileSidebarItem.tsx +++ b/apps/web/components/dashboard/sidebar/ModileSidebarItem.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/utils"; import Link from "next/link"; import { usePathname } from "next/navigation"; +import { cn } from "@/lib/utils"; export default function MobileSidebarItem({ logo, diff --git a/apps/web/components/dashboard/sidebar/NewListModal.tsx b/apps/web/components/dashboard/sidebar/NewListModal.tsx index f51616ed..e244411d 100644 --- a/apps/web/components/dashboard/sidebar/NewListModal.tsx +++ b/apps/web/components/dashboard/sidebar/NewListModal.tsx @@ -1,14 +1,5 @@ "use client"; -import data from "@emoji-mart/data"; -import Picker from "@emoji-mart/react"; - -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; - import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { @@ -18,7 +9,6 @@ import { DialogFooter, DialogHeader, DialogTitle, - DialogTrigger, } from "@/components/ui/dialog"; import { Form, @@ -27,15 +17,19 @@ import { FormItem, FormMessage, } from "@/components/ui/form"; - +import { Input } from "@/components/ui/input"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; - -import { z } from "zod"; -import { useForm } from "react-hook-form"; +import data from "@emoji-mart/data"; +import Picker from "@emoji-mart/react"; import { zodResolver } from "@hookform/resolvers/zod"; -import { Input } from "@/components/ui/input"; - +import { useForm } from "react-hook-form"; +import { z } from "zod"; import { create } from "zustand"; export const useNewListModal = create<{ @@ -113,7 +107,7 @@ export default function NewListModal() { - + {field.value} diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx index a5c1d7a5..0351b889 100644 --- a/apps/web/components/dashboard/sidebar/Sidebar.tsx +++ b/apps/web/components/dashboard/sidebar/Sidebar.tsx @@ -1,13 +1,15 @@ -import { Tag, Home, PackageOpen, Settings, Search, Shield } from "lucide-react"; -import { redirect } from "next/navigation"; -import SidebarItem from "./SidebarItem"; -import { getServerAuthSession } from "@/server/auth"; import Link from "next/link"; -import SidebarProfileOptions from "./SidebarProfileOptions"; +import { redirect } from "next/navigation"; import { Separator } from "@/components/ui/separator"; -import AllLists from "./AllLists"; -import serverConfig from "@hoarder/shared/config"; import { api } from "@/server/api/client"; +import { getServerAuthSession } from "@/server/auth"; +import { Home, PackageOpen, Search, Settings, Shield, Tag } from "lucide-react"; + +import serverConfig from "@hoarder/shared/config"; + +import AllLists from "./AllLists"; +import SidebarItem from "./SidebarItem"; +import SidebarProfileOptions from "./SidebarProfileOptions"; export default async function Sidebar() { const session = await getServerAuthSession(); diff --git a/apps/web/components/dashboard/sidebar/SidebarItem.tsx b/apps/web/components/dashboard/sidebar/SidebarItem.tsx index 856bdffd..75a1f6ba 100644 --- a/apps/web/components/dashboard/sidebar/SidebarItem.tsx +++ b/apps/web/components/dashboard/sidebar/SidebarItem.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/utils"; import Link from "next/link"; import { usePathname } from "next/navigation"; +import { cn } from "@/lib/utils"; export default function SidebarItem({ name, diff --git a/apps/web/components/signin/CredentialsForm.tsx b/apps/web/components/signin/CredentialsForm.tsx index 5296e163..59dfeb21 100644 --- a/apps/web/components/signin/CredentialsForm.tsx +++ b/apps/web/components/signin/CredentialsForm.tsx @@ -1,8 +1,8 @@ "use client"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { ActionButton } from "@/components/ui/action-button"; import { Form, FormControl, @@ -12,13 +12,15 @@ import { FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; -import { ActionButton } from "@/components/ui/action-button"; -import { zSignUpSchema } from "@hoarder/trpc/types/users"; -import { signIn } from "next-auth/react"; -import { useState } from "react"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { api } from "@/lib/trpc"; -import { useRouter } from "next/navigation"; +import { zodResolver } from "@hookform/resolvers/zod"; import { TRPCClientError } from "@trpc/client"; +import { signIn } from "next-auth/react"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; + +import { zSignUpSchema } from "@hoarder/trpc/types/users"; const signInSchema = z.object({ email: z.string().email(), diff --git a/apps/web/components/signin/SignInForm.tsx b/apps/web/components/signin/SignInForm.tsx index 7c8f8936..aa70e207 100644 --- a/apps/web/components/signin/SignInForm.tsx +++ b/apps/web/components/signin/SignInForm.tsx @@ -1,6 +1,7 @@ import { getProviders } from "next-auth/react"; -import SignInProviderButton from "./SignInProviderButton"; + import CredentialsForm from "./CredentialsForm"; +import SignInProviderButton from "./SignInProviderButton"; export default async function SignInForm() { const providers = await getProviders(); diff --git a/apps/web/components/signin/SignInProviderButton.tsx b/apps/web/components/signin/SignInProviderButton.tsx index 0831236c..0f208397 100644 --- a/apps/web/components/signin/SignInProviderButton.tsx +++ b/apps/web/components/signin/SignInProviderButton.tsx @@ -1,6 +1,8 @@ "use client"; + +import type { ClientSafeProvider } from "next-auth/react"; import { Button } from "@/components/ui/button"; -import { ClientSafeProvider, signIn } from "next-auth/react"; +import { signIn } from "next-auth/react"; export default function SignInProviderButton({ provider, diff --git a/apps/web/components/ui/action-button.tsx b/apps/web/components/ui/action-button.tsx index 42e16f65..11b02a5f 100644 --- a/apps/web/components/ui/action-button.tsx +++ b/apps/web/components/ui/action-button.tsx @@ -1,4 +1,5 @@ -import { Button, ButtonProps } from "./button"; +import type { ButtonProps } from "./button"; +import { Button } from "./button"; import LoadingSpinner from "./spinner"; export function ActionButton({ diff --git a/apps/web/components/ui/back-button.tsx b/apps/web/components/ui/back-button.tsx index 685930df..46c99f7c 100644 --- a/apps/web/components/ui/back-button.tsx +++ b/apps/web/components/ui/back-button.tsx @@ -1,7 +1,9 @@ "use client"; import { useRouter } from "next/navigation"; -import { Button, ButtonProps } from "./button"; + +import type { ButtonProps } from "./button"; +import { Button } from "./button"; export function BackButton({ ...props }: ButtonProps) { const router = useRouter(); diff --git a/apps/web/components/ui/badge.tsx b/apps/web/components/ui/badge.tsx index c30daca1..7950a5ee 100644 --- a/apps/web/components/ui/badge.tsx +++ b/apps/web/components/ui/badge.tsx @@ -1,19 +1,19 @@ +import type { VariantProps } from "class-variance-authority"; import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - import { cn } from "@/lib/utils"; +import { cva } from "class-variance-authority"; const badgeVariants = cva( - "focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { default: - "bg-primary text-primary-foreground hover:bg-primary/80 border-transparent", + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent", + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent", + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", outline: "text-foreground", }, }, diff --git a/apps/web/components/ui/button.tsx b/apps/web/components/ui/button.tsx index 79b45fa0..5ed8df91 100644 --- a/apps/web/components/ui/button.tsx +++ b/apps/web/components/ui/button.tsx @@ -1,11 +1,11 @@ +import type { VariantProps } from "class-variance-authority"; import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - import { cn } from "@/lib/utils"; +import { Slot } from "@radix-ui/react-slot"; +import { cva } from "class-variance-authority"; const buttonVariants = cva( - "ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", { variants: { variant: { @@ -13,7 +13,7 @@ const buttonVariants = cva( destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", outline: - "border-input bg-background hover:bg-accent hover:text-accent-foreground border", + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", diff --git a/apps/web/components/ui/card.tsx b/apps/web/components/ui/card.tsx index f4e57996..9df66460 100644 --- a/apps/web/components/ui/card.tsx +++ b/apps/web/components/ui/card.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; const Card = React.forwardRef< @@ -9,7 +8,7 @@ const Card = React.forwardRef<
>(({ className, ...props }, ref) => ( + // eslint-disable-next-line jsx-a11y/heading-has-content

(({ className, ...props }, ref) => (

)); diff --git a/apps/web/components/ui/dialog.tsx b/apps/web/components/ui/dialog.tsx index 8fe3fe35..8e0c3c6c 100644 --- a/apps/web/components/ui/dialog.tsx +++ b/apps/web/components/ui/dialog.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { X } from "lucide-react"; -import { cn } from "@/lib/utils"; - const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; @@ -21,7 +20,7 @@ const DialogOverlay = React.forwardRef< {children} - + Close @@ -102,7 +101,7 @@ const DialogDescription = React.forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/dropdown-menu.tsx b/apps/web/components/ui/dropdown-menu.tsx index 3a9a2ff7..2bab577e 100644 --- a/apps/web/components/ui/dropdown-menu.tsx +++ b/apps/web/components/ui/dropdown-menu.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; import { Check, ChevronRight, Circle } from "lucide-react"; -import { cn } from "@/lib/utils"; - const DropdownMenu = DropdownMenuPrimitive.Root; const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; @@ -27,7 +26,7 @@ const DropdownMenuSubTrigger = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/form.tsx b/apps/web/components/ui/form.tsx index e62e10e9..20ce3c4b 100644 --- a/apps/web/components/ui/form.tsx +++ b/apps/web/components/ui/form.tsx @@ -1,26 +1,19 @@ +import type * as LabelPrimitive from "@radix-ui/react-label"; +import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form"; import * as React from "react"; -import * as LabelPrimitive from "@radix-ui/react-label"; -import { Slot } from "@radix-ui/react-slot"; -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext, -} from "react-hook-form"; - -import { cn } from "@/lib/utils"; import { Label } from "@/components/ui/label"; +import { cn } from "@/lib/utils"; +import { Slot } from "@radix-ui/react-slot"; +import { Controller, FormProvider, useFormContext } from "react-hook-form"; const Form = FormProvider; -type FormFieldContextValue< +interface FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, -> = { +> { name: TName; -}; +} const FormFieldContext = React.createContext( {} as FormFieldContextValue, @@ -62,9 +55,9 @@ const useFormField = () => { }; }; -type FormItemContextValue = { +interface FormItemContextValue { id: string; -}; +} const FormItemContext = React.createContext( {} as FormItemContextValue, @@ -134,7 +127,7 @@ const FormDescription = React.forwardRef<

); @@ -156,7 +149,7 @@ const FormMessage = React.forwardRef<

{body} diff --git a/apps/web/components/ui/imageCard.tsx b/apps/web/components/ui/imageCard.tsx index f10ebdb5..e4941733 100644 --- a/apps/web/components/ui/imageCard.tsx +++ b/apps/web/components/ui/imageCard.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; export function ImageCard({ diff --git a/apps/web/components/ui/input.tsx b/apps/web/components/ui/input.tsx index 21aac7ad..5543446c 100644 --- a/apps/web/components/ui/input.tsx +++ b/apps/web/components/ui/input.tsx @@ -1,9 +1,7 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; -export interface InputProps - extends React.InputHTMLAttributes {} +export type InputProps = React.InputHTMLAttributes; const Input = React.forwardRef( ({ className, type, ...props }, ref) => { @@ -11,7 +9,7 @@ const Input = React.forwardRef( , @@ -40,7 +39,7 @@ const ScrollBar = React.forwardRef< )} {...props} > - + )); ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName; diff --git a/apps/web/components/ui/select.tsx b/apps/web/components/ui/select.tsx index efd4ff1e..9895e94a 100644 --- a/apps/web/components/ui/select.tsx +++ b/apps/web/components/ui/select.tsx @@ -1,11 +1,10 @@ "use client"; import * as React from "react"; +import { cn } from "@/lib/utils"; import * as SelectPrimitive from "@radix-ui/react-select"; import { Check, ChevronDown, ChevronUp } from "lucide-react"; -import { cn } from "@/lib/utils"; - const Select = SelectPrimitive.Root; const SelectGroup = SelectPrimitive.Group; @@ -19,7 +18,7 @@ const SelectTrigger = React.forwardRef< span]:line-clamp-1", + "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className, )} {...props} @@ -75,7 +74,7 @@ const SelectContent = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/separator.tsx b/apps/web/components/ui/separator.tsx index 3b9f2b84..09303128 100644 --- a/apps/web/components/ui/separator.tsx +++ b/apps/web/components/ui/separator.tsx @@ -1,9 +1,8 @@ "use client"; import * as React from "react"; -import * as SeparatorPrimitive from "@radix-ui/react-separator"; - import { cn } from "@/lib/utils"; +import * as SeparatorPrimitive from "@radix-ui/react-separator"; const Separator = React.forwardRef< React.ElementRef, @@ -18,7 +17,7 @@ const Separator = React.forwardRef< decorative={decorative} orientation={orientation} className={cn( - "bg-border shrink-0", + "shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className, )} diff --git a/apps/web/components/ui/skeleton.tsx b/apps/web/components/ui/skeleton.tsx index 5fab2023..2cdf440d 100644 --- a/apps/web/components/ui/skeleton.tsx +++ b/apps/web/components/ui/skeleton.tsx @@ -6,7 +6,7 @@ function Skeleton({ }: React.HTMLAttributes) { return (

); diff --git a/apps/web/components/ui/table.tsx b/apps/web/components/ui/table.tsx index 0fa9288e..95b43b8c 100644 --- a/apps/web/components/ui/table.tsx +++ b/apps/web/components/ui/table.tsx @@ -1,5 +1,4 @@ import * as React from "react"; - import { cn } from "@/lib/utils"; const Table = React.forwardRef< @@ -43,7 +42,7 @@ const TableFooter = React.forwardRef< tr]:last:border-b-0", + "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className, )} {...props} @@ -58,7 +57,7 @@ const TableRow = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/apps/web/components/ui/tabs.tsx b/apps/web/components/ui/tabs.tsx index 990017db..4c1b0ab1 100644 --- a/apps/web/components/ui/tabs.tsx +++ b/apps/web/components/ui/tabs.tsx @@ -1,9 +1,8 @@ "use client"; import * as React from "react"; -import * as TabsPrimitive from "@radix-ui/react-tabs"; - import { cn } from "@/lib/utils"; +import * as TabsPrimitive from "@radix-ui/react-tabs"; const Tabs = TabsPrimitive.Root; @@ -14,7 +13,7 @@ const TabsList = React.forwardRef< {} +export type TextareaProps = React.TextareaHTMLAttributes; const Textarea = React.forwardRef( ({ className, ...props }, ref) => { return (