Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: display monograph view count

kashaf-ansari-dev657f0e428ab0
diff --git a/apps/mobile/app/components/sheets/publish-note/index.tsx b/apps/mobile/app/components/sheets/publish-note/index.tsx
index 22f2dbfae..106d3b1a1 100644
--- a/apps/mobile/app/components/sheets/publish-note/index.tsx
+++ b/apps/mobile/app/components/sheets/publish-note/index.tsx
@@ -168,6 +168,14 @@ const PublishNoteSheet = ({
setPublishLoading(false);
};
+ const analytics = useAsync(async () => {
+ if (!isFeatureAvailable?.isAllowed || !monograph) {
+ return { totalViews: 0 };
+ }
+
+ return await db.monographs.analytics(monograph.id);
+ }, [monograph?.id, isFeatureAvailable?.isAllowed]);
+
return (
<View
style={{
@@ -396,6 +404,10 @@ const PublishNoteSheet = ({
}}
>
<Paragraph size={AppFontSize.sm}>{strings.views()}</Paragraph>
+
+ <Paragraph size={AppFontSize.sm}>
+ {analytics.result?.totalViews}
+ </Paragraph>
</View>
</View>
</View>