Skip to content

Commit

Permalink
add delete bookmark description to i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
lexafaxine committed Dec 31, 2024
1 parent 3b39327 commit 52924c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
10 changes: 5 additions & 5 deletions apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
<>
{tagModal}
{manageListsModal}
<DeleteBookmarkConfirmationDialog
bookmark={bookmark}
open={deleteBookmarkDialogOpen}
setOpen={setDeleteBookmarkDialogOpen}
/>
<BookmarkedTextEditor
bookmark={bookmark}
open={isTextEditorOpen}
setOpen={setTextEditorOpen}
/>
<DropdownMenu>
<DeleteBookmarkConfirmationDialog
bookmark={bookmark}
open={deleteBookmarkDialogOpen}
setOpen={setDeleteBookmarkDialogOpen}
/>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect } from "react";
import { usePathname, useRouter } from "next/navigation";
import { ActionButton } from "@/components/ui/action-button";
import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog";
Expand All @@ -13,13 +12,11 @@ export default function DeleteBookmarkConfirmationDialog({
children,
open,
setOpen,
onPendingChange,
}: {
bookmark: ZBookmark;
children?: React.ReactNode;
open: boolean;
setOpen: (v: boolean) => void;
onPendingChange?: (isPending: boolean) => void;
}) {
const { t } = useTranslation();
const currentPath = usePathname();
Expand All @@ -43,16 +40,12 @@ export default function DeleteBookmarkConfirmationDialog({
},
});

useEffect(() => {
onPendingChange?.(isPending);
}, [isPending, onPendingChange]);

return (
<ActionConfirmingDialog
open={open}
setOpen={setOpen}
title={`Delete ${bookmark.title ?? "Bookmark"}?`}
description={`Are you sure you want to delete this bookmark?`}
title={t("toasts.bookmarks.delete_confirmation_title")}
description={t("toasts.bookmarks.delete_confirmation_description")}
actionButton={() => (
<ActionButton
type="button"
Expand Down
8 changes: 3 additions & 5 deletions apps/web/components/dashboard/preview/ActionBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import { ActionButton } from "@/components/ui/action-button";
import { Button } from "@/components/ui/button";
import {
Tooltip,
TooltipContent,
Expand All @@ -20,7 +21,6 @@ export default function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
const [deleteBookmarkDialogOpen, setDeleteBookmarkDialogOpen] =
useState(false);

const [isPendingDelete, setIsPendingDelete] = useState(false);
const onError = () => {
toast({
variant: "destructive",
Expand Down Expand Up @@ -95,17 +95,15 @@ export default function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
bookmark={bookmark}
open={deleteBookmarkDialogOpen}
setOpen={setDeleteBookmarkDialogOpen}
onPendingChange={setIsPendingDelete}
/>
<TooltipTrigger asChild>
<ActionButton
loading={isPendingDelete}
<Button
className="size-14 rounded-full bg-background"
variant="none"
onClick={() => setDeleteBookmarkDialogOpen(true)}
>
<Trash2 />
</ActionButton>
</Button>
</TooltipTrigger>
<TooltipContent side="bottom">{t("actions.delete")}</TooltipContent>
</Tooltip>
Expand Down
4 changes: 3 additions & 1 deletion apps/web/lib/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@
"refetch": "Re-fetch has been enqueued!",
"full_page_archive": "Full Page Archive creation has been triggered",
"delete_from_list": "The bookmark has been deleted from the list",
"clipboard_copied": "Link has been added to your clipboard!"
"clipboard_copied": "Link has been added to your clipboard!",
"delete_confirmation_title": "Delete Bookmark?",
"delete_confirmation_description": "Are you sure you want to delete this bookmark?"
},
"lists": {
"created": "List has been created!",
Expand Down

0 comments on commit 52924c6

Please sign in to comment.