From 9a9cd8e6a5176230e970c44062656aef81aa245d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 30 Dec 2025 00:16:45 +0200 Subject: [PATCH] feat(right_pane): add count in title for PDF items --- apps/client/src/translations/en/translation.json | 8 ++++++++ apps/client/src/widgets/sidebar/PdfAttachments.tsx | 3 ++- apps/client/src/widgets/sidebar/PdfLayers.tsx | 3 ++- apps/client/src/widgets/sidebar/PdfPages.tsx | 13 +++++++------ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 7712ee91a..76c293a76 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2234,5 +2234,13 @@ "empty_button": "Hide the panel", "toggle": "Toggle right panel", "custom_widget_go_to_source": "Go to source code" + }, + "pdf": { + "attachments_one": "{{count}} attachment", + "attachments_other": "{{count}} attachments", + "layers_one": "{{count}} layer", + "layers_other": "{{count}} layers", + "pages_one": "{{count}} page", + "pages_other": "{{count}} pages" } } diff --git a/apps/client/src/widgets/sidebar/PdfAttachments.tsx b/apps/client/src/widgets/sidebar/PdfAttachments.tsx index a9ef8c74e..3b6c21e71 100644 --- a/apps/client/src/widgets/sidebar/PdfAttachments.tsx +++ b/apps/client/src/widgets/sidebar/PdfAttachments.tsx @@ -1,5 +1,6 @@ import "./PdfAttachments.css"; +import { t } from "../../services/i18n"; import { formatSize } from "../../services/utils"; import { useActiveNoteContext, useGetContextData, useNoteProperty } from "../react/hooks"; import Icon from "../react/Icon"; @@ -25,7 +26,7 @@ export default function PdfAttachments() { } return ( - +
{attachmentsData.attachments.map((attachment) => ( 0 && - +
{layersData.layers.map((layer) => ( - + return (pagesData && + + ); } -function PdfPagesList() { - const pagesData = useGetContextData("pdfPages"); +function PdfPagesList({ pagesData }: { pagesData: NoteContextDataMap["pdfPages"] }) { const [thumbnails, setThumbnails] = useState>(new Map()); const requestedThumbnails = useRef>(new Set()); @@ -42,7 +44,6 @@ function PdfPagesList() { const requestThumbnail = useCallback((pageNumber: number) => { // Only request if we haven't already requested it and don't have it if (!requestedThumbnails.current.has(pageNumber) && !thumbnails.has(pageNumber) && pagesData) { - console.log("[PdfPages] Requesting thumbnail for page:", pageNumber); requestedThumbnails.current.add(pageNumber); pagesData.requestThumbnail(pageNumber); }