Number of dislikes
sortBlogPostMetrics("dislikes")}
@@ -150,26 +132,28 @@ const BlogPostMetrics = () => {
{blogPostMetrics.map((item, idx) => {
return (
-
- {item.name}
+ |
+
+ {item.blogName}
+
|
-
- {item.visits}
+ |
+ {item.uniqueVisit || 0}
|
-
- {item.source.email}
+ |
+ {item.source.email || 0}
|
-
- {item.source.direct}
+ |
+ {item.source.direct || 0}
|
-
- {item.source.home}
+ |
+ {item.source.home || 0}
|
-
- {item.likes}
+ |
+ {item.likes || 0}
|
-
- {item.dislikes}
+ |
+ {item.dislikes || 0}
|
)
diff --git a/client/src/pages/dashboard/components/breadcrumb.jsx b/client/src/pages/dashboard/components/breadcrumb.jsx
new file mode 100644
index 0000000..6d57ff2
--- /dev/null
+++ b/client/src/pages/dashboard/components/breadcrumb.jsx
@@ -0,0 +1,33 @@
+// IMPORT LIBRARIES
+import React from 'react';
+
+const Breadcrumb = ({ postTitle }) => {
+ return (
+
+ );
+};
+
+export default Breadcrumb;
diff --git a/client/src/pages/dashboard/components/charts/barChart.jsx b/client/src/pages/dashboard/components/charts/barChart.jsx
index eeec4fc..b0f408a 100644
--- a/client/src/pages/dashboard/components/charts/barChart.jsx
+++ b/client/src/pages/dashboard/components/charts/barChart.jsx
@@ -24,20 +24,31 @@ const generateRandomColor = () => {
return '#' + Math.floor(Math.random() * 16777215).toString(16);
};
-const BarChart = ({ title, labels, datasets }) => {
- console.log(labels, datasets);
-
+const BarChart = ({ title, labels, datasets, ...props }) => {
const options = {
responsive: true,
plugins: {
legend: {
position: 'top',
+ labels: {
+ font: {
+ size: 14
+ }
+ }
},
title: {
display: true,
text: title,
+ font: {
+ size: 18
+ }
},
},
+ scale: {
+ ticks: {
+ precision: 0
+ }
+ }
};
const data = {
@@ -50,7 +61,7 @@ const BarChart = ({ title, labels, datasets }) => {
}))
};
- return
;
+ return
;
}
export default BarChart;
diff --git a/client/src/pages/dashboard/components/charts/pieChart.jsx b/client/src/pages/dashboard/components/charts/pieChart.jsx
index d6fe79c..387a2e7 100644
--- a/client/src/pages/dashboard/components/charts/pieChart.jsx
+++ b/client/src/pages/dashboard/components/charts/pieChart.jsx
@@ -10,53 +10,34 @@ ChartJS.register(
ArcElement, Tooltip, Legend
);
-const COLORS = ["#333333",
-"#4CAF50",
-"#2196F3",
-"#FF9800",
-"#F44336",
-"#9C27B0",
-"#03A9F4",
-"#7F8C8D",
-"#FFEB3B",
-"#C2C2F0",
-];
-
-
const PieChart = ({ title, labels, datasets }) => {
- console.log(labels, datasets);
-
const options = {
responsive: true,
plugins: {
legend: {
position: 'top',
+ labels: {
+ font: {
+ size: 14
+ }
+ }
},
title: {
display: true,
text: title,
+ font: {
+ size: 18
+ }
},
},
};
const data = {
labels,
- datasets: [
- {
- label: 'Likes',
- data: datasets ? datasets[0].data : [],
- backgroundColor: COLORS.slice(0, labels?.length),
- borderColor: 'rgb(54, 162, 235)'
- }
- ],
+ datasets
};
- return (
-
- );
-
+ return
}
export default PieChart;
diff --git a/client/src/pages/dashboard/components/individualBlogPostMetrics.jsx b/client/src/pages/dashboard/components/individualBlogPostMetrics.jsx
new file mode 100644
index 0000000..62f4c8e
--- /dev/null
+++ b/client/src/pages/dashboard/components/individualBlogPostMetrics.jsx
@@ -0,0 +1,77 @@
+// IMPORT LIBRARIES
+import React from 'react';
+
+const IndivdualBlogPostMetrics = ({ blogPostMetrics }) => {
+ return (
+
+
+
+
+
+ Blog Title
+ |
+
+
+ Number of Views
+
+ |
+
+
+ Source - Email
+
+ |
+
+
+ Source - Direct
+
+ |
+
+
+ Source - Home
+
+ |
+
+
+ Number of Likes
+
+ |
+
+
+ Number of dislikes
+
+ |
+
+
+
+
+
+
+ {blogPostMetrics.blogName}
+ |
+
+ {blogPostMetrics.uniqueVisit || 0}
+ |
+
+ {blogPostMetrics.source && blogPostMetrics.source.email ? blogPostMetrics.source.email : 0}
+ |
+
+ {blogPostMetrics.source && blogPostMetrics.source.direct ? blogPostMetrics.source.direct : 0}
+ |
+
+ {blogPostMetrics.source && blogPostMetrics.source.home ? blogPostMetrics.source.home : 0}
+ |
+
+ {blogPostMetrics.likes || 0}
+ |
+
+ {blogPostMetrics.dislikes || 0}
+ |
+
+
+
+
+
+ );
+};
+
+export default IndivdualBlogPostMetrics;
diff --git a/client/src/pages/dashboard/index.jsx b/client/src/pages/dashboard/index.jsx
index 2d1e547..37b7e89 100644
--- a/client/src/pages/dashboard/index.jsx
+++ b/client/src/pages/dashboard/index.jsx
@@ -6,7 +6,6 @@ import Cookie from 'js-cookie';
// IMPORT COMPONENTS
import Layout from './components/layout';
import BarChart from './components/charts/barChart';
-import PieChart from './components/charts/pieChart';
import BlogPostMetrics from './components/blogPostMetrics';
export default function Page() {
@@ -99,9 +98,9 @@ export default function Page() {
{dashboardMetrics && dashboardMetrics.uniqueVisit?.blog ?
Blog Post Metrics
-
+
- Unique visits to each blog page
+ Blog Post Metrics Visualization
post?.blogId)}
@@ -113,6 +112,7 @@ export default function Page() {
}
]}
/>
+
post?.blogId)}
@@ -129,6 +129,7 @@ export default function Page() {
}
]}
/>
+
post?.blogId)}
@@ -149,8 +150,11 @@ export default function Page() {
borderColor: 'rgb(54, 162, 235)'
}
]}
+ className="mb-8"
/>
-
+
+ {/* ADDED THIS AS BAR CHART ABOVE */}
+ {/*
Likes for each blog page
post?.count) }]}
/>
-
-
+
*/}
+
+
Category Wise Metrics Visualization
+
cat?.blogId)}
+ datasets={[
+ {
+ label: "Unique Visits", data: dashboardMetrics?.uniqueVisit?.category?.map(cat => cat?.count),
+ backgroundColor: 'rgba(54, 162, 235, 0.3)',
+ borderColor: 'rgb(54, 162, 235)'
+ }
+ ]}
+ className="mb-8"
+ />
+ {/* ADDED THIS AS BAR CHART ABOVE */}
+ {/*
Category wise Views
cat?.blogId)}
datasets={[{ label: "Views", data: dashboardMetrics?.uniqueVisit?.category?.map(cat => cat?.count) }]}
/>
-
+ */}
:
<>>
diff --git a/server/src/assets/images/blog/caps-building-communication.png b/server/src/assets/images/blog/caps-building-communication.png
new file mode 100644
index 0000000..6527bf0
Binary files /dev/null and b/server/src/assets/images/blog/caps-building-communication.png differ
diff --git a/server/src/assets/images/blog/caps-national-sleep-awareness.png b/server/src/assets/images/blog/caps-national-sleep-awareness.png
new file mode 100644
index 0000000..688a517
Binary files /dev/null and b/server/src/assets/images/blog/caps-national-sleep-awareness.png differ
diff --git a/server/src/assets/images/blog/caps-navigating-winter-break.png b/server/src/assets/images/blog/caps-navigating-winter-break.png
new file mode 100644
index 0000000..5ec3922
Binary files /dev/null and b/server/src/assets/images/blog/caps-navigating-winter-break.png differ
diff --git a/server/src/assets/images/blog/covid-testing.png b/server/src/assets/images/blog/covid-testing.png
new file mode 100644
index 0000000..61e5c6e
Binary files /dev/null and b/server/src/assets/images/blog/covid-testing.png differ
diff --git a/server/src/assets/images/blog/covid-vaccines-available.png b/server/src/assets/images/blog/covid-vaccines-available.png
new file mode 100644
index 0000000..66fdf2e
Binary files /dev/null and b/server/src/assets/images/blog/covid-vaccines-available.png differ
diff --git a/server/src/assets/images/blog/diet-time-breakfast.png b/server/src/assets/images/blog/diet-time-breakfast.png
new file mode 100644
index 0000000..6b5d78c
Binary files /dev/null and b/server/src/assets/images/blog/diet-time-breakfast.png differ
diff --git a/server/src/assets/images/blog/eat-with-love.png b/server/src/assets/images/blog/eat-with-love.png
new file mode 100644
index 0000000..c6bc743
Binary files /dev/null and b/server/src/assets/images/blog/eat-with-love.png differ