A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
refactor: migrate toasts to sonner
Mohamed Bassem173fb99aed95
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsxindex 8514b8ad..ba09a973 100644--- a/apps/web/app/layout.tsx+++ b/apps/web/app/layout.tsx@@ -8,11 +8,11 @@ import "@karakeep/tailwind-config/globals.css";import type { Viewport } from "next";import React from "react";-import { Toaster } from "@/components/ui/toaster";import Providers from "@/lib/providers";import { getUserLocalSettings } from "@/lib/userLocalSettings/userLocalSettings";import { getServerAuthSession } from "@/server/auth";import { ReactQueryDevtools } from "@tanstack/react-query-devtools";+import { Toaster } from "sonner";import { clientConfig } from "@karakeep/shared/config";diff --git a/apps/web/app/settings/assets/page.tsx b/apps/web/app/settings/assets/page.tsxindex 14144455..a2d2c9ab 100644--- a/apps/web/app/settings/assets/page.tsx+++ b/apps/web/app/settings/assets/page.tsx@@ -5,6 +5,7 @@ import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";import { Button } from "@/components/ui/button";import { FullPageSpinner } from "@/components/ui/full-page-spinner";+import { toast } from "@/components/ui/sonner";import {Table,TableBody,@@ -13,7 +14,6 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";import { ASSET_TYPE_TO_ICON } from "@/lib/attachments";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";diff --git a/apps/web/app/settings/broken-links/page.tsx b/apps/web/app/settings/broken-links/page.tsxindex e2b42d07..139e8f91 100644--- a/apps/web/app/settings/broken-links/page.tsx+++ b/apps/web/app/settings/broken-links/page.tsx@@ -2,6 +2,7 @@import { ActionButton } from "@/components/ui/action-button";import { FullPageSpinner } from "@/components/ui/full-page-spinner";+import { toast } from "@/components/ui/sonner";import {Table,TableBody,@@ -10,7 +11,6 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";import { RefreshCw, Trash2 } from "lucide-react";import { useTranslation } from "react-i18next";diff --git a/apps/web/components/admin/AddUserDialog.tsx b/apps/web/components/admin/AddUserDialog.tsxindex 67c38501..3c578eca 100644--- a/apps/web/components/admin/AddUserDialog.tsx+++ b/apps/web/components/admin/AddUserDialog.tsx@@ -26,7 +26,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";import { TRPCClientError } from "@trpc/client";diff --git a/apps/web/components/admin/BackgroundJobs.tsx b/apps/web/components/admin/BackgroundJobs.tsxindex ba73db2e..26015eb4 100644--- a/apps/web/components/admin/BackgroundJobs.tsx+++ b/apps/web/components/admin/BackgroundJobs.tsx@@ -11,7 +11,7 @@ import {CardTitle,} from "@/components/ui/card";import { Skeleton } from "@/components/ui/skeleton";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { keepPreviousData } from "@tanstack/react-query";diff --git a/apps/web/components/admin/CreateInviteDialog.tsx b/apps/web/components/admin/CreateInviteDialog.tsxindex 84f5c60f..6738adc9 100644--- a/apps/web/components/admin/CreateInviteDialog.tsx+++ b/apps/web/components/admin/CreateInviteDialog.tsx@@ -19,7 +19,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";import { TRPCClientError } from "@trpc/client";diff --git a/apps/web/components/admin/InvitesList.tsx b/apps/web/components/admin/InvitesList.tsxindex 1418c9bb..fdc39798 100644--- a/apps/web/components/admin/InvitesList.tsx+++ b/apps/web/components/admin/InvitesList.tsx@@ -2,6 +2,7 @@import { ActionButton } from "@/components/ui/action-button";import { ButtonWithTooltip } from "@/components/ui/button";+import { toast } from "@/components/ui/sonner";import LoadingSpinner from "@/components/ui/spinner";import {Table,@@ -11,7 +12,6 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";import { api } from "@/lib/trpc";import { formatDistanceToNow } from "date-fns";import { Mail, MailX, UserPlus } from "lucide-react";diff --git a/apps/web/components/admin/ResetPasswordDialog.tsx b/apps/web/components/admin/ResetPasswordDialog.tsxindex cc2a95f5..4e71d42b 100644--- a/apps/web/components/admin/ResetPasswordDialog.tsx+++ b/apps/web/components/admin/ResetPasswordDialog.tsx@@ -19,7 +19,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc"; // Adjust the import path as neededimport { zodResolver } from "@hookform/resolvers/zod";import { TRPCClientError } from "@trpc/client";diff --git a/apps/web/components/admin/UpdateUserDialog.tsx b/apps/web/components/admin/UpdateUserDialog.tsxindex 7093ccda..453f4fab 100644--- a/apps/web/components/admin/UpdateUserDialog.tsx+++ b/apps/web/components/admin/UpdateUserDialog.tsx@@ -26,7 +26,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";import { TRPCClientError } from "@trpc/client";diff --git a/apps/web/components/admin/UserList.tsx b/apps/web/components/admin/UserList.tsxindex f386a8cd..3a382a3b 100644--- a/apps/web/components/admin/UserList.tsx+++ b/apps/web/components/admin/UserList.tsx@@ -2,6 +2,7 @@import { ActionButton } from "@/components/ui/action-button";import { ButtonWithTooltip } from "@/components/ui/button";+import { toast } from "@/components/ui/sonner";import LoadingSpinner from "@/components/ui/spinner";import {Table,@@ -11,7 +12,6 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { Check, KeyRound, Pencil, Trash, UserPlus, X } from "lucide-react";diff --git a/apps/web/components/dashboard/BulkBookmarksAction.tsx b/apps/web/components/dashboard/BulkBookmarksAction.tsxindex 817521ff..9e248c03 100644--- a/apps/web/components/dashboard/BulkBookmarksAction.tsx+++ b/apps/web/components/dashboard/BulkBookmarksAction.tsx@@ -7,7 +7,7 @@ import {ActionButtonWithTooltip,} from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";-import { useToast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import useBulkActionsStore from "@/lib/bulkActions";import { useTranslation } from "@/lib/i18n/client";import {@@ -49,7 +49,6 @@ export default function BulkBookmarksAction() {const isEverythingSelected = useBulkActionsStore((state) => state.isEverythingSelected,);- const { toast } = useToast();const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);const [manageListsModal, setManageListsModalOpen] = useState(false);const [bulkTagModal, setBulkTagModalOpen] = useState(false);diff --git a/apps/web/components/dashboard/UploadDropzone.tsx b/apps/web/components/dashboard/UploadDropzone.tsxindex 8d119467..d3945cc3 100644--- a/apps/web/components/dashboard/UploadDropzone.tsx+++ b/apps/web/components/dashboard/UploadDropzone.tsx@@ -1,6 +1,7 @@"use client";import React, { useCallback, useState } from "react";+import { toast } from "@/components/ui/sonner";import useUpload from "@/lib/hooks/upload-file";import { cn } from "@/lib/utils";import { TRPCClientError } from "@trpc/client";@@ -10,7 +11,6 @@ import { useCreateBookmarkWithPostHook } from "@karakeep/shared-react/hooks/bookimport { BookmarkTypes } from "@karakeep/shared/types/bookmarks";import LoadingSpinner from "../ui/spinner";-import { toast } from "../ui/use-toast";import BookmarkAlreadyExistsToast from "../utils/BookmarkAlreadyExistsToast";export function useUploadAsset() {diff --git a/apps/web/components/dashboard/bookmarks/BookmarkMarkdownComponent.tsx b/apps/web/components/dashboard/bookmarks/BookmarkMarkdownComponent.tsxindex e7fea2c3..a1eab830 100644--- a/apps/web/components/dashboard/bookmarks/BookmarkMarkdownComponent.tsx+++ b/apps/web/components/dashboard/bookmarks/BookmarkMarkdownComponent.tsx@@ -1,6 +1,6 @@import MarkdownEditor from "@/components/ui/markdown/markdown-editor";import { MarkdownReadonly } from "@/components/ui/markdown/markdown-readonly";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useUpdateBookmark } from "@karakeep/shared-react/hooks/bookmarks";diff --git a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsxindex eb746efc..696e1265 100644--- a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx+++ b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx@@ -11,7 +11,7 @@ import {DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import { useToast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import {@@ -74,7 +74,6 @@ function isSubsectionItem(item: ActionItemType): item is SubsectionItem {export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {const { t } = useTranslation();- const { toast } = useToast();const linkId = bookmark.id;const { data: session } = useSession();diff --git a/apps/web/components/dashboard/bookmarks/BookmarkTagsEditor.tsx b/apps/web/components/dashboard/bookmarks/BookmarkTagsEditor.tsxindex 22b5408e..09843bce 100644--- a/apps/web/components/dashboard/bookmarks/BookmarkTagsEditor.tsx+++ b/apps/web/components/dashboard/bookmarks/BookmarkTagsEditor.tsx@@ -1,4 +1,4 @@-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import type { ZBookmark } from "@karakeep/shared/types/bookmarks";import { useUpdateBookmarkTags } from "@karakeep/shared-react/hooks/bookmarks";diff --git a/apps/web/components/dashboard/bookmarks/BulkManageListsModal.tsx b/apps/web/components/dashboard/bookmarks/BulkManageListsModal.tsxindex 23afa7d2..1d4f5814 100644--- a/apps/web/components/dashboard/bookmarks/BulkManageListsModal.tsx+++ b/apps/web/components/dashboard/bookmarks/BulkManageListsModal.tsx@@ -15,7 +15,7 @@ import {FormItem,FormMessage,} from "@/components/ui/form";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { zodResolver } from "@hookform/resolvers/zod";import { useForm } from "react-hook-form";import { z } from "zod";diff --git a/apps/web/components/dashboard/bookmarks/BulkTagModal.tsx b/apps/web/components/dashboard/bookmarks/BulkTagModal.tsxindex 431f0fcd..53d2d013 100644--- a/apps/web/components/dashboard/bookmarks/BulkTagModal.tsx+++ b/apps/web/components/dashboard/bookmarks/BulkTagModal.tsx@@ -7,7 +7,7 @@ import {DialogHeader,DialogTitle,} from "@/components/ui/dialog";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useUpdateBookmarkTags } from "@karakeep/shared-react/hooks/bookmarks";import { api } from "@karakeep/shared-react/trpc";diff --git a/apps/web/components/dashboard/bookmarks/DeleteBookmarkConfirmationDialog.tsx b/apps/web/components/dashboard/bookmarks/DeleteBookmarkConfirmationDialog.tsxindex 7e680706..8e7a4d34 100644--- a/apps/web/components/dashboard/bookmarks/DeleteBookmarkConfirmationDialog.tsx+++ b/apps/web/components/dashboard/bookmarks/DeleteBookmarkConfirmationDialog.tsx@@ -1,7 +1,7 @@import { usePathname, useRouter } from "next/navigation";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { useDeleteBookmark } from "@karakeep/shared-react/hooks//bookmarks";diff --git a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsxindex 49d27eaa..de6c1ff6 100644--- a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx+++ b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx@@ -25,8 +25,8 @@ import {PopoverContent,PopoverTrigger,} from "@/components/ui/popover";+import { toast } from "@/components/ui/sonner";import { Textarea } from "@/components/ui/textarea";-import { toast } from "@/components/ui/use-toast";import { useDialogFormReset } from "@/lib/hooks/useDialogFormReset";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsxindex fa752c5f..4636bcb9 100644--- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx+++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx@@ -5,8 +5,8 @@ import { Form, FormControl, FormItem } from "@/components/ui/form";import { Kbd } from "@/components/ui/kbd";import MultipleChoiceDialog from "@/components/ui/multiple-choice-dialog";import { Separator } from "@/components/ui/separator";+import { toast } from "@/components/ui/sonner";import { Textarea } from "@/components/ui/textarea";-import { toast } from "@/components/ui/use-toast";import BookmarkAlreadyExistsToast from "@/components/utils/BookmarkAlreadyExistsToast";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";diff --git a/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx b/apps/web/components/dashboard/bookmarks/ManageListsModal.tsxindex 7c3827ab..34d797a6 100644--- a/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx+++ b/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx@@ -16,8 +16,8 @@ import {FormItem,FormMessage,} from "@/components/ui/form";+import { toast } from "@/components/ui/sonner";import LoadingSpinner from "@/components/ui/spinner";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";diff --git a/apps/web/components/dashboard/bookmarks/SummarizeBookmarkArea.tsx b/apps/web/components/dashboard/bookmarks/SummarizeBookmarkArea.tsxindex b2cf118e..5f107663 100644--- a/apps/web/components/dashboard/bookmarks/SummarizeBookmarkArea.tsx+++ b/apps/web/components/dashboard/bookmarks/SummarizeBookmarkArea.tsx@@ -1,8 +1,8 @@import React from "react";import { ActionButton } from "@/components/ui/action-button";import { MarkdownReadonly } from "@/components/ui/markdown/markdown-readonly";+import { toast } from "@/components/ui/sonner";import LoadingSpinner from "@/components/ui/spinner";-import { toast } from "@/components/ui/use-toast";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import { cn } from "@/lib/utils";diff --git a/apps/web/components/dashboard/bookmarks/action-buttons/ArchiveBookmarkButton.tsx b/apps/web/components/dashboard/bookmarks/action-buttons/ArchiveBookmarkButton.tsxindex d45cfc82..fd2780cd 100644--- a/apps/web/components/dashboard/bookmarks/action-buttons/ArchiveBookmarkButton.tsx+++ b/apps/web/components/dashboard/bookmarks/action-buttons/ArchiveBookmarkButton.tsx@@ -1,6 +1,6 @@import React from "react";import { ActionButton, ActionButtonProps } from "@/components/ui/action-button";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc";import { useUpdateBookmark } from "@karakeep/shared-react/hooks/bookmarks";diff --git a/apps/web/components/dashboard/cleanups/TagDuplicationDetention.tsx b/apps/web/components/dashboard/cleanups/TagDuplicationDetention.tsxindex 52a9ab0c..89aff598 100644--- a/apps/web/components/dashboard/cleanups/TagDuplicationDetention.tsx+++ b/apps/web/components/dashboard/cleanups/TagDuplicationDetention.tsx@@ -11,6 +11,7 @@ import {CollapsibleContent,CollapsibleTrigger,} from "@/components/ui/collapsible";+import { toast } from "@/components/ui/sonner";import LoadingSpinner from "@/components/ui/spinner";import {Table,@@ -20,7 +21,6 @@ import {TableHeader,TableRow,} from "@/components/ui/table";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { cn } from "@/lib/utils";diff --git a/apps/web/components/dashboard/highlights/HighlightCard.tsx b/apps/web/components/dashboard/highlights/HighlightCard.tsxindex 51421e0f..e7e7c519 100644--- a/apps/web/components/dashboard/highlights/HighlightCard.tsx+++ b/apps/web/components/dashboard/highlights/HighlightCard.tsx@@ -1,5 +1,5 @@import { ActionButton } from "@/components/ui/action-button";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { cn } from "@/lib/utils";import { Trash2 } from "lucide-react";diff --git a/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx b/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsxindex 4996ddf1..6c091d7a 100644--- a/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx+++ b/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx@@ -3,8 +3,8 @@ import { usePathname, useRouter } from "next/navigation";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";import { Label } from "@/components/ui/label";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import type { ZBookmarkList } from "@karakeep/shared/types/lists";diff --git a/apps/web/components/dashboard/lists/EditListModal.tsx b/apps/web/components/dashboard/lists/EditListModal.tsxindex 5febf88c..4a14eccb 100644--- a/apps/web/components/dashboard/lists/EditListModal.tsx+++ b/apps/web/components/dashboard/lists/EditListModal.tsx@@ -34,7 +34,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import data from "@emoji-mart/data";import Picker from "@emoji-mart/react";diff --git a/apps/web/components/dashboard/lists/LeaveListConfirmationDialog.tsx b/apps/web/components/dashboard/lists/LeaveListConfirmationDialog.tsxindex 62dbbcef..f2a48062 100644--- a/apps/web/components/dashboard/lists/LeaveListConfirmationDialog.tsx+++ b/apps/web/components/dashboard/lists/LeaveListConfirmationDialog.tsx@@ -2,7 +2,7 @@ import React from "react";import { usePathname, useRouter } from "next/navigation";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";diff --git a/apps/web/components/dashboard/lists/ManageCollaboratorsModal.tsx b/apps/web/components/dashboard/lists/ManageCollaboratorsModal.tsxindex 80dbcf65..6c5dac1e 100644--- a/apps/web/components/dashboard/lists/ManageCollaboratorsModal.tsx+++ b/apps/web/components/dashboard/lists/ManageCollaboratorsModal.tsx@@ -22,7 +22,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { UserAvatar } from "@/components/ui/user-avatar";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";diff --git a/apps/web/components/dashboard/lists/MergeListModal.tsx b/apps/web/components/dashboard/lists/MergeListModal.tsxindex 0b7d362a..b22cd1a2 100644--- a/apps/web/components/dashboard/lists/MergeListModal.tsx+++ b/apps/web/components/dashboard/lists/MergeListModal.tsx@@ -19,8 +19,8 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { zodResolver } from "@hookform/resolvers/zod";import { X } from "lucide-react";diff --git a/apps/web/components/dashboard/lists/PendingInvitationsCard.tsx b/apps/web/components/dashboard/lists/PendingInvitationsCard.tsxindex c453a91f..d893f4dc 100644--- a/apps/web/components/dashboard/lists/PendingInvitationsCard.tsx+++ b/apps/web/components/dashboard/lists/PendingInvitationsCard.tsx@@ -8,7 +8,7 @@ import {CardHeader,CardTitle,} from "@/components/ui/card";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { Check, Loader2, Mail, X } from "lucide-react";diff --git a/apps/web/components/dashboard/preview/ActionBar.tsx b/apps/web/components/dashboard/preview/ActionBar.tsxindex 6e4cd5a2..9603465e 100644--- a/apps/web/components/dashboard/preview/ActionBar.tsx+++ b/apps/web/components/dashboard/preview/ActionBar.tsx@@ -1,12 +1,12 @@import { useState } from "react";import { ActionButton } from "@/components/ui/action-button";import { Button } from "@/components/ui/button";+import { toast } from "@/components/ui/sonner";import {Tooltip,TooltipContent,TooltipTrigger,} from "@/components/ui/tooltip";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { Pencil, Trash2 } from "lucide-react";diff --git a/apps/web/components/dashboard/preview/AttachmentBox.tsx b/apps/web/components/dashboard/preview/AttachmentBox.tsxindex 73eea640..654f3211 100644--- a/apps/web/components/dashboard/preview/AttachmentBox.tsx+++ b/apps/web/components/dashboard/preview/AttachmentBox.tsx@@ -8,7 +8,7 @@ import {CollapsibleTrigger,} from "@/components/ui/collapsible";import FilePickerButton from "@/components/ui/file-picker-button";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { ASSET_TYPE_TO_ICON } from "@/lib/attachments";import useUpload from "@/lib/hooks/upload-file";import { useTranslation } from "@/lib/i18n/client";diff --git a/apps/web/components/dashboard/preview/NoteEditor.tsx b/apps/web/components/dashboard/preview/NoteEditor.tsxindex 538aff2e..86807569 100644--- a/apps/web/components/dashboard/preview/NoteEditor.tsx+++ b/apps/web/components/dashboard/preview/NoteEditor.tsx@@ -1,5 +1,5 @@+import { toast } from "@/components/ui/sonner";import { Textarea } from "@/components/ui/textarea";-import { toast } from "@/components/ui/use-toast";import { useClientConfig } from "@/lib/clientConfig";import type { ZBookmark } from "@karakeep/shared/types/bookmarks";diff --git a/apps/web/components/dashboard/preview/ReaderView.tsx b/apps/web/components/dashboard/preview/ReaderView.tsxindex f2f843ee..9b765d55 100644--- a/apps/web/components/dashboard/preview/ReaderView.tsx+++ b/apps/web/components/dashboard/preview/ReaderView.tsx@@ -1,5 +1,5 @@import { FullPageSpinner } from "@/components/ui/full-page-spinner";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@/lib/trpc";import {diff --git a/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx b/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsxindex da10317a..d5658a70 100644--- a/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx+++ b/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx@@ -8,8 +8,8 @@ import { Button } from "@/components/ui/button";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";+import { toast } from "@/components/ui/sonner";import { Textarea } from "@/components/ui/textarea";-import { toast } from "@/components/ui/use-toast";import { Save, X } from "lucide-react";import { useTranslation } from "react-i18next";diff --git a/apps/web/components/dashboard/rules/RuleEngineRuleList.tsx b/apps/web/components/dashboard/rules/RuleEngineRuleList.tsxindex 206a3550..32262b31 100644--- a/apps/web/components/dashboard/rules/RuleEngineRuleList.tsx+++ b/apps/web/components/dashboard/rules/RuleEngineRuleList.tsx@@ -2,8 +2,8 @@ import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";import { Button } from "@/components/ui/button";import { Card, CardContent } from "@/components/ui/card";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useClientConfig } from "@/lib/clientConfig";import { Edit, Trash2 } from "lucide-react";import { useTranslation } from "react-i18next";diff --git a/apps/web/components/dashboard/tags/AllTagsView.tsx b/apps/web/components/dashboard/tags/AllTagsView.tsxindex c21f9aac..9708c37f 100644--- a/apps/web/components/dashboard/tags/AllTagsView.tsx+++ b/apps/web/components/dashboard/tags/AllTagsView.tsx@@ -22,9 +22,9 @@ import {import InfoTooltip from "@/components/ui/info-tooltip";import { Input } from "@/components/ui/input";import { Skeleton } from "@/components/ui/skeleton";+import { toast } from "@/components/ui/sonner";import Spinner from "@/components/ui/spinner";import { Toggle } from "@/components/ui/toggle";-import { toast } from "@/components/ui/use-toast";import useBulkTagActionsStore from "@/lib/bulkTagActions";import { useTranslation } from "@/lib/i18n/client";import { ArrowDownAZ, ChevronDown, Combine, Search, Tag } from "lucide-react";diff --git a/apps/web/components/dashboard/tags/BulkTagAction.tsx b/apps/web/components/dashboard/tags/BulkTagAction.tsxindex fbd044e0..c8061a1f 100644--- a/apps/web/components/dashboard/tags/BulkTagAction.tsx+++ b/apps/web/components/dashboard/tags/BulkTagAction.tsx@@ -4,8 +4,8 @@ import { useEffect, useState } from "react";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";import { ButtonWithTooltip } from "@/components/ui/button";+import { toast } from "@/components/ui/sonner";import { Toggle } from "@/components/ui/toggle";-import { useToast } from "@/components/ui/use-toast";import useBulkTagActionsStore from "@/lib/bulkTagActions";import { useTranslation } from "@/lib/i18n/client";import { CheckCheck, Pencil, Trash2, X } from "lucide-react";@@ -17,7 +17,6 @@ const MAX_CONCURRENT_BULK_ACTIONS = 50;export default function BulkTagAction() {const { t } = useTranslation();- const { toast } = useToast();const {selectedTagIds,diff --git a/apps/web/components/dashboard/tags/CreateTagModal.tsx b/apps/web/components/dashboard/tags/CreateTagModal.tsxindex 3a4c4995..e5cf4a45 100644--- a/apps/web/components/dashboard/tags/CreateTagModal.tsx+++ b/apps/web/components/dashboard/tags/CreateTagModal.tsx@@ -22,7 +22,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { zodResolver } from "@hookform/resolvers/zod";import { Plus } from "lucide-react";diff --git a/apps/web/components/dashboard/tags/DeleteTagConfirmationDialog.tsx b/apps/web/components/dashboard/tags/DeleteTagConfirmationDialog.tsxindex 0a589ee6..7df04e20 100644--- a/apps/web/components/dashboard/tags/DeleteTagConfirmationDialog.tsx+++ b/apps/web/components/dashboard/tags/DeleteTagConfirmationDialog.tsx@@ -1,7 +1,7 @@import { usePathname, useRouter } from "next/navigation";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useDeleteTag } from "@karakeep/shared-react/hooks/tags";diff --git a/apps/web/components/dashboard/tags/EditableTagName.tsx b/apps/web/components/dashboard/tags/EditableTagName.tsxindex 7854be32..e6df5086 100644--- a/apps/web/components/dashboard/tags/EditableTagName.tsx+++ b/apps/web/components/dashboard/tags/EditableTagName.tsx@@ -1,7 +1,7 @@"use client";import { usePathname, useRouter } from "next/navigation";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { cn } from "@/lib/utils";import { useUpdateTag } from "@karakeep/shared-react/hooks/tags";diff --git a/apps/web/components/dashboard/tags/MergeTagModal.tsx b/apps/web/components/dashboard/tags/MergeTagModal.tsxindex 84dcd478..22b07c98 100644--- a/apps/web/components/dashboard/tags/MergeTagModal.tsx+++ b/apps/web/components/dashboard/tags/MergeTagModal.tsx@@ -18,7 +18,7 @@ import {FormItem,FormMessage,} from "@/components/ui/form";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { zodResolver } from "@hookform/resolvers/zod";import { useForm } from "react-hook-form";import { z } from "zod";diff --git a/apps/web/components/dashboard/tags/TagPill.tsx b/apps/web/components/dashboard/tags/TagPill.tsxindex 65a42e08..09310f9f 100644--- a/apps/web/components/dashboard/tags/TagPill.tsx+++ b/apps/web/components/dashboard/tags/TagPill.tsx@@ -2,7 +2,7 @@ import React, { useRef, useState } from "react";import Link from "next/link";import { Button } from "@/components/ui/button";import { Separator } from "@/components/ui/separator";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useDragAndDrop } from "@/lib/drag-and-drop";import { X } from "lucide-react";import Draggable from "react-draggable";diff --git a/apps/web/components/settings/AISettings.tsx b/apps/web/components/settings/AISettings.tsxindex 48c45633..78e3ef56 100644--- a/apps/web/components/settings/AISettings.tsx+++ b/apps/web/components/settings/AISettings.tsx@@ -36,8 +36,8 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";diff --git a/apps/web/components/settings/AddApiKey.tsx b/apps/web/components/settings/AddApiKey.tsxindex c8baa626..9ef9047c 100644--- a/apps/web/components/settings/AddApiKey.tsx+++ b/apps/web/components/settings/AddApiKey.tsx@@ -24,7 +24,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";diff --git a/apps/web/components/settings/BackupSettings.tsx b/apps/web/components/settings/BackupSettings.tsxindex 18a80993..ad2b66c6 100644--- a/apps/web/components/settings/BackupSettings.tsx+++ b/apps/web/components/settings/BackupSettings.tsx@@ -21,8 +21,8 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { useUserSettings } from "@/lib/userSettings";diff --git a/apps/web/components/settings/ChangePassword.tsx b/apps/web/components/settings/ChangePassword.tsxindex a27741d9..1da92267 100644--- a/apps/web/components/settings/ChangePassword.tsx+++ b/apps/web/components/settings/ChangePassword.tsx@@ -12,7 +12,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";diff --git a/apps/web/components/settings/DeleteAccount.tsx b/apps/web/components/settings/DeleteAccount.tsxindex 6ebafff9..5ccbfaf7 100644--- a/apps/web/components/settings/DeleteAccount.tsx+++ b/apps/web/components/settings/DeleteAccount.tsx@@ -13,7 +13,7 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { zodResolver } from "@hookform/resolvers/zod";import { AlertTriangle, Eye, EyeOff, Trash2 } from "lucide-react";import { useForm } from "react-hook-form";diff --git a/apps/web/components/settings/DeleteApiKey.tsx b/apps/web/components/settings/DeleteApiKey.tsxindex 4efb7ea8..392f3122 100644--- a/apps/web/components/settings/DeleteApiKey.tsx+++ b/apps/web/components/settings/DeleteApiKey.tsx@@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";import { Button } from "@/components/ui/button";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { Trash } from "lucide-react";diff --git a/apps/web/components/settings/FeedSettings.tsx b/apps/web/components/settings/FeedSettings.tsxindex 23b639e4..a49bb0b2 100644--- a/apps/web/components/settings/FeedSettings.tsx+++ b/apps/web/components/settings/FeedSettings.tsx@@ -13,8 +13,8 @@ import {} from "@/components/ui/form";import { FullPageSpinner } from "@/components/ui/full-page-spinner";import { Input } from "@/components/ui/input";+import { toast } from "@/components/ui/sonner";import { Switch } from "@/components/ui/switch";-import { toast } from "@/components/ui/use-toast";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { cn } from "@/lib/utils";diff --git a/apps/web/components/settings/ImportExport.tsx b/apps/web/components/settings/ImportExport.tsxindex 1cef8483..4aa84e44 100644--- a/apps/web/components/settings/ImportExport.tsx+++ b/apps/web/components/settings/ImportExport.tsx@@ -12,6 +12,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { toast } from "@/components/ui/sonner";import { useBookmarkImport } from "@/lib/hooks/useBookmarkImport";import { useTranslation } from "@/lib/i18n/client";import { cn } from "@/lib/utils";@@ -19,7 +20,6 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";import { AlertCircle, Download, Loader2, Upload } from "lucide-react";import { Card, CardContent } from "../ui/card";-import { toast } from "../ui/use-toast";import { ImportSessionsSection } from "./ImportSessionsSection";function ImportCard({diff --git a/apps/web/components/settings/ReaderSettings.tsx b/apps/web/components/settings/ReaderSettings.tsxindex 28cc847e..d694bf02 100644--- a/apps/web/components/settings/ReaderSettings.tsx+++ b/apps/web/components/settings/ReaderSettings.tsx@@ -1,6 +1,7 @@"use client";import { useState } from "react";+import { toast } from "@/components/ui/sonner";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import { useReaderSettings } from "@/lib/readerSettings";@@ -43,7 +44,6 @@ import {SelectValue,} from "../ui/select";import { Slider } from "../ui/slider";-import { toast } from "../ui/use-toast";export default function ReaderSettings() {const { t } = useTranslation();diff --git a/apps/web/components/settings/RegenerateApiKey.tsx b/apps/web/components/settings/RegenerateApiKey.tsxindex 1c034026..f4914598 100644--- a/apps/web/components/settings/RegenerateApiKey.tsx+++ b/apps/web/components/settings/RegenerateApiKey.tsx@@ -14,7 +14,7 @@ import {DialogTitle,DialogTrigger,} from "@/components/ui/dialog";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { RefreshCcw } from "lucide-react";diff --git a/apps/web/components/settings/SubscriptionSettings.tsx b/apps/web/components/settings/SubscriptionSettings.tsxindex 53f1caf4..03337c1b 100644--- a/apps/web/components/settings/SubscriptionSettings.tsx+++ b/apps/web/components/settings/SubscriptionSettings.tsx@@ -1,6 +1,7 @@"use client";import { useEffect } from "react";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { CreditCard, Loader2 } from "lucide-react";@@ -16,7 +17,6 @@ import {CardTitle,} from "../ui/card";import { Skeleton } from "../ui/skeleton";-import { toast } from "../ui/use-toast";export default function SubscriptionSettings() {const { t } = useTranslation();diff --git a/apps/web/components/settings/UserAvatar.tsx b/apps/web/components/settings/UserAvatar.tsxindex fd773697..6baff7c2 100644--- a/apps/web/components/settings/UserAvatar.tsx+++ b/apps/web/components/settings/UserAvatar.tsx@@ -4,6 +4,7 @@ import type { ChangeEvent } from "react";import { useRef } from "react";import { ActionButton } from "@/components/ui/action-button";import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";+import { toast } from "@/components/ui/sonner";import { UserAvatar as UserAvatarImage } from "@/components/ui/user-avatar";import useUpload from "@/lib/hooks/upload-file";import { useTranslation } from "@/lib/i18n/client";@@ -16,7 +17,6 @@ import {import { Button } from "../ui/button";import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";-import { toast } from "../ui/use-toast";export default function UserAvatar() {const { t } = useTranslation();diff --git a/apps/web/components/settings/UserOptions.tsx b/apps/web/components/settings/UserOptions.tsxindex 0df1085e..763695c5 100644--- a/apps/web/components/settings/UserOptions.tsx+++ b/apps/web/components/settings/UserOptions.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useState } from "react";+import { toast } from "@/components/ui/sonner";import { useClientConfig } from "@/lib/clientConfig";import { useTranslation } from "@/lib/i18n/client";import { useInterfaceLang } from "@/lib/userLocalSettings/bookmarksLayout";@@ -28,7 +29,6 @@ import {SelectTrigger,SelectValue,} from "../ui/select";-import { toast } from "../ui/use-toast";const LanguageSelect = () => {const lang = useInterfaceLang();diff --git a/apps/web/components/settings/WebhookSettings.tsx b/apps/web/components/settings/WebhookSettings.tsxindex 8efd3ba6..73671787 100644--- a/apps/web/components/settings/WebhookSettings.tsx+++ b/apps/web/components/settings/WebhookSettings.tsx@@ -12,7 +12,7 @@ import {} from "@/components/ui/form";import { FullPageSpinner } from "@/components/ui/full-page-spinner";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { api } from "@/lib/trpc";import { zodResolver } from "@hookform/resolvers/zod";diff --git a/apps/web/components/ui/copy-button.tsx b/apps/web/components/ui/copy-button.tsxindex 8d8699f8..fb1f943f 100644--- a/apps/web/components/ui/copy-button.tsx+++ b/apps/web/components/ui/copy-button.tsx@@ -1,9 +1,9 @@import React, { useEffect, useState } from "react";+import { toast } from "@/components/ui/sonner";import { cn } from "@/lib/utils";import { Check, Copy } from "lucide-react";import { Button } from "./button";-import { toast } from "./use-toast";export default function CopyBtn({className,diff --git a/apps/web/components/ui/sonner.tsx b/apps/web/components/ui/sonner.tsxnew file mode 100644index 00000000..d281f4ae--- /dev/null+++ b/apps/web/components/ui/sonner.tsx@@ -0,0 +1,71 @@+"use client";++import {+ CircleCheck,+ Info,+ LoaderCircle,+ OctagonX,+ TriangleAlert,+} from "lucide-react";+import { useTheme } from "next-themes";+import { Toaster as Sonner, toast } from "sonner";++type ToasterProps = React.ComponentProps<typeof Sonner>;++const Toaster = ({ ...props }: ToasterProps) => {+ const { theme = "system" } = useTheme();++ return (+ <Sonner+ theme={theme as ToasterProps["theme"]}+ className="toaster group"+ icons={{+ success: <CircleCheck className="h-4 w-4" />,+ info: <Info className="h-4 w-4" />,+ warning: <TriangleAlert className="h-4 w-4" />,+ error: <OctagonX className="h-4 w-4" />,+ loading: <LoaderCircle className="h-4 w-4 animate-spin" />,+ }}+ toastOptions={{+ classNames: {+ toast:+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",+ description: "group-[.toast]:text-muted-foreground",+ actionButton:+ "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",+ cancelButton:+ "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",+ },+ }}+ {...props}+ />+ );+};++/**+ * Compat layer for migrating from old toaster to sonner+ * @deprecated Use sonner's natie toast instead+ */+const legacyToast = ({+ title,+ description,+ variant,+}: {+ title?: React.ReactNode;+ description?: React.ReactNode;+ variant?: "destructive" | "default";+}) => {+ let toastTitle = title;+ let toastDescription: React.ReactNode | undefined = description;+ if (!title) {+ toastTitle = description;+ toastDescription = undefined;+ }+ if (variant === "destructive") {+ toast.error(toastTitle, { description: toastDescription });+ } else {+ toast(toastTitle, { description: toastDescription });+ }+};++export { Toaster, legacyToast as toast };diff --git a/apps/web/components/ui/toaster.tsx b/apps/web/components/ui/toaster.tsxdeleted file mode 100644index 7d82ed55..00000000--- a/apps/web/components/ui/toaster.tsx+++ /dev/null@@ -1,35 +0,0 @@-"use client";--import {- Toast,- ToastClose,- ToastDescription,- ToastProvider,- ToastTitle,- ToastViewport,-} from "@/components/ui/toast";-import { useToast } from "@/components/ui/use-toast";--export function Toaster() {- const { toasts } = useToast();-- return (- <ToastProvider>- {toasts.map(function ({ id, title, description, action, ...props }) {- return (- <Toast key={id} {...props}>- <div className="grid gap-1">- {title && <ToastTitle>{title}</ToastTitle>}- {description && (- <ToastDescription>{description}</ToastDescription>- )}- </div>- {action}- <ToastClose />- </Toast>- );- })}- <ToastViewport />- </ToastProvider>- );-}diff --git a/apps/web/components/ui/use-toast.ts b/apps/web/components/ui/use-toast.tsdeleted file mode 100644index c3e7e884..00000000--- a/apps/web/components/ui/use-toast.ts+++ /dev/null@@ -1,188 +0,0 @@-// Inspired by react-hot-toast library-import type { ToastActionElement, ToastProps } from "@/components/ui/toast";-import * as React from "react";--const TOAST_LIMIT = 10;-const TOAST_REMOVE_DELAY = 1000000;--type ToasterToast = ToastProps & {- id: string;- title?: React.ReactNode;- description?: React.ReactNode;- action?: ToastActionElement;-};--const actionTypes = {- ADD_TOAST: "ADD_TOAST",- UPDATE_TOAST: "UPDATE_TOAST",- DISMISS_TOAST: "DISMISS_TOAST",- REMOVE_TOAST: "REMOVE_TOAST",-} as const;--let count = 0;--function genId() {- count = (count + 1) % Number.MAX_SAFE_INTEGER;- return count.toString();-}--type ActionType = typeof actionTypes;--type Action =- | {- type: ActionType["ADD_TOAST"];- toast: ToasterToast;- }- | {- type: ActionType["UPDATE_TOAST"];- toast: Partial<ToasterToast>;- }- | {- type: ActionType["DISMISS_TOAST"];- toastId?: ToasterToast["id"];- }- | {- type: ActionType["REMOVE_TOAST"];- toastId?: ToasterToast["id"];- };--interface State {- toasts: ToasterToast[];-}--const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();--const addToRemoveQueue = (toastId: string) => {- if (toastTimeouts.has(toastId)) {- return;- }-- const timeout = setTimeout(() => {- toastTimeouts.delete(toastId);- dispatch({- type: "REMOVE_TOAST",- toastId: toastId,- });- }, TOAST_REMOVE_DELAY);-- toastTimeouts.set(toastId, timeout);-};--export const reducer = (state: State, action: Action): State => {- switch (action.type) {- case "ADD_TOAST":- return {- ...state,- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),- };-- case "UPDATE_TOAST":- return {- ...state,- toasts: state.toasts.map((t) =>- t.id === action.toast.id ? { ...t, ...action.toast } : t,- ),- };-- case "DISMISS_TOAST": {- const { toastId } = action;-- // ! Side effects ! - This could be extracted into a dismissToast() action,- // but I'll keep it here for simplicity- if (toastId) {- addToRemoveQueue(toastId);- } else {- state.toasts.forEach((toast) => {- addToRemoveQueue(toast.id);- });- }-- return {- ...state,- toasts: state.toasts.map((t) =>- t.id === toastId || toastId === undefined- ? {- ...t,- open: false,- }- : t,- ),- };- }- case "REMOVE_TOAST":- if (action.toastId === undefined) {- return {- ...state,- toasts: [],- };- }- return {- ...state,- toasts: state.toasts.filter((t) => t.id !== action.toastId),- };- }-};--const listeners: ((_state: State) => void)[] = [];--let memoryState: State = { toasts: [] };--function dispatch(action: Action) {- memoryState = reducer(memoryState, action);- listeners.forEach((listener) => {- listener(memoryState);- });-}--type Toast = Omit<ToasterToast, "id">;--function toast({ ...props }: Toast) {- const id = genId();-- const update = (props: ToasterToast) =>- dispatch({- type: "UPDATE_TOAST",- toast: { ...props, id },- });- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });-- dispatch({- type: "ADD_TOAST",- toast: {- ...props,- id,- open: true,- onOpenChange: (open) => {- if (!open) dismiss();- },- },- });-- return {- id: id,- dismiss,- update,- };-}--function useToast() {- const [state, setState] = React.useState<State>(memoryState);-- React.useEffect(() => {- listeners.push(setState);- return () => {- const index = listeners.indexOf(setState);- if (index > -1) {- listeners.splice(index, 1);- }- };- }, [state]);-- return {- ...state,- toast,- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),- };-}--export { useToast, toast };diff --git a/apps/web/lib/hooks/useBookmarkImport.ts b/apps/web/lib/hooks/useBookmarkImport.tsindex 0d9bbaaf..f2522d9a 100644--- a/apps/web/lib/hooks/useBookmarkImport.ts+++ b/apps/web/lib/hooks/useBookmarkImport.ts@@ -1,7 +1,7 @@"use client";import { useState } from "react";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { useTranslation } from "@/lib/i18n/client";import { useMutation } from "@tanstack/react-query";diff --git a/apps/web/lib/hooks/useImportSessions.ts b/apps/web/lib/hooks/useImportSessions.tsindex cee99bbc..1482f33d 100644--- a/apps/web/lib/hooks/useImportSessions.ts+++ b/apps/web/lib/hooks/useImportSessions.ts@@ -1,6 +1,6 @@"use client";-import { toast } from "@/components/ui/use-toast";+import { toast } from "@/components/ui/sonner";import { api } from "@karakeep/shared-react/trpc";diff --git a/apps/web/package.json b/apps/web/package.jsonindex 0400bc5c..648ba92b 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -75,7 +75,7 @@"next-auth": "^4.24.11","next-i18next": "^15.3.1","next-pwa": "^5.6.0",- "next-themes": "^0.4.0",+ "next-themes": "^0.4.6","nuqs": "^2.4.3","prettier": "^3.4.2","react": "^19.1.0",@@ -97,6 +97,7 @@"remark-gfm": "^4.0.0","request-ip": "^3.3.0","sharp": "^0.33.3",+ "sonner": "^2.0.7","superjson": "^2.2.1","tailwind-merge": "^2.2.1","zod": "^3.24.2",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 719a4472..c06f410f 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -667,7 +667,7 @@ importers:specifier: ^5.6.0version: 5.6.0(@babel/[email protected])(@types/[email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])next-themes:- specifier: ^0.4.0+ specifier: ^0.4.6nuqs:specifier: ^2.4.3@@ -732,6 +732,9 @@ importers:sharp:specifier: ^0.33.3version: 0.33.3+ sonner:+ specifier: ^2.0.7superjson:specifier: ^2.2.1version: 2.2.1@@ -13637,6 +13640,12 @@ packages:resolution: {integrity: sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==}engines: {node: '>= 10.0.0', npm: '>= 3.0.0'}+ resolution: {integrity: sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0 || ^19.0.0-rc+ react-dom: ^18.0.0 || ^19.0.0 || ^19.0.0-rc+resolution: {integrity: sha512-0xtkGhWCC9MGt/EzgnvbbbKhqWjl1+/rncmhTh5qCpbYguXh6S/qwePfv/JQ8jePXXmqingylxoC49pCkSPIbA==}engines: {node: '>= 6.3.0'}@@ -14820,6 +14829,7 @@ packages:resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}engines: {node: '>=18'}+ deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementationresolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==}@@ -30841,6 +30851,11 @@ snapshots:ip-address: 9.0.5smart-buffer: 4.2.0+ dependencies:+ react: 19.1.0+ react-dom: 19.1.0([email protected])+