diff --git a/apps/client/src/widgets/sidebar/PdfAttachments.tsx b/apps/client/src/widgets/sidebar/PdfAttachments.tsx
index 3269db627..a9ef8c74e 100644
--- a/apps/client/src/widgets/sidebar/PdfAttachments.tsx
+++ b/apps/client/src/widgets/sidebar/PdfAttachments.tsx
@@ -14,35 +14,28 @@ export default function PdfAttachments() {
const { note } = useActiveNoteContext();
const noteType = useNoteProperty(note, "type");
const noteMime = useNoteProperty(note, "mime");
+ const attachmentsData = useGetContextData("pdfAttachments");
if (noteType !== "file" || noteMime !== "application/pdf") {
return null;
}
- return (
-
-
-
- );
-}
-
-function PdfAttachmentsList() {
- const attachmentsData = useGetContextData("pdfAttachments");
-
if (!attachmentsData || attachmentsData.attachments.length === 0) {
- return
No attachments
;
+ return null;
}
return (
-
- {attachmentsData.attachments.map((attachment) => (
-
- ))}
-
+
+
+ {attachmentsData.attachments.map((attachment) => (
+
+ ))}
+
+
);
}
diff --git a/apps/client/src/widgets/sidebar/PdfLayers.tsx b/apps/client/src/widgets/sidebar/PdfLayers.tsx
index d950783c3..407b188f5 100644
--- a/apps/client/src/widgets/sidebar/PdfLayers.tsx
+++ b/apps/client/src/widgets/sidebar/PdfLayers.tsx
@@ -14,47 +14,36 @@ export default function PdfLayers() {
const { note } = useActiveNoteContext();
const noteType = useNoteProperty(note, "type");
const noteMime = useNoteProperty(note, "mime");
+ const layersData = useGetContextData("pdfLayers");
if (noteType !== "file" || noteMime !== "application/pdf") {
return null;
}
- return (
+ return (layersData?.layers && layersData.layers.length > 0 &&
-
+
+ {layersData.layers.map((layer) => (
+
+ ))}
+
);
}
-function PdfLayersList() {
- const layersData = useGetContextData("pdfLayers");
-
- if (!layersData || layersData.layers.length === 0) {
- return No layers
;
- }
-
- return (
-
- {layersData.layers.map((layer) => (
-
- ))}
-
- );
-}
-
-function PdfLayerItem({
- layer,
- onToggle
-}: {
- layer: LayerInfo;
+function PdfLayerItem({
+ layer,
+ onToggle
+}: {
+ layer: LayerInfo;
onToggle: (layerId: string, visible: boolean) => void;
}) {
return (
- onToggle(layer.id, !layer.visible)}
>