From 3bc1347e794b59476d8dab8b4db334cb44243859 Mon Sep 17 00:00:00 2001 From: Jerome Hardaway Date: Sat, 21 Dec 2024 18:10:31 -0500 Subject: [PATCH] Remove Static Views (#669) * Add course data for Core Fundamentals and Command Line Interface; update BlogCard component to remove views display * Remove instructor and course data for Core Fundamentals and Command Line Interface * Remove views display from BlogArea components across multiple layouts * Remove 'views' field from blog data retrieval across multiple components --- src/components/blog-card/blog-01.tsx | 10 ++---- src/components/blog-card/blog-02.tsx | 10 ++---- src/components/blog-card/blog-03.tsx | 10 ++---- src/components/blog-card/blog-04.tsx | 10 ++---- src/components/blog-card/blog-05.tsx | 9 ++--- src/components/blog-card/blog-06.tsx | 12 ++----- src/containers/blog-full/layout-01/index.tsx | 1 - src/containers/blog-full/layout-02/index.tsx | 1 - src/containers/blog-full/layout-03/index.tsx | 1 - src/containers/blog-full/layout-04/index.tsx | 1 - src/containers/blog-full/layout-05/index.tsx | 1 - src/containers/blog/layout-01/index.tsx | 16 ++------- src/containers/blog/layout-02/index.tsx | 1 - src/containers/blog/layout-03/index.tsx | 1 - src/data/instructors/arthur-will.json | 36 ------------------- src/pages/blogs/author/[author]/index.tsx | 2 +- .../blogs/author/[author]/page/[page].tsx | 2 +- src/pages/blogs/blog-classic/index.tsx | 2 +- src/pages/blogs/blog-classic/page/[page].tsx | 4 +-- src/pages/blogs/blog-grid-sidebar/index.tsx | 2 +- .../blogs/blog-grid-sidebar/page/[page].tsx | 4 +-- src/pages/blogs/blog-list/index.tsx | 2 +- src/pages/blogs/blog-list/page/[page].tsx | 4 +-- src/pages/blogs/blog/index.tsx | 2 +- src/pages/blogs/blog/page/[page].tsx | 4 +-- src/pages/blogs/category/[category]/index.tsx | 2 +- .../blogs/category/[category]/page/[page].tsx | 2 +- src/pages/blogs/search.tsx | 2 +- src/pages/blogs/tag/[tag]/index.tsx | 2 +- src/pages/blogs/tag/[tag]/page/[page].tsx | 2 +- src/pages/index.tsx | 4 +-- 31 files changed, 39 insertions(+), 123 deletions(-) delete mode 100644 src/data/instructors/arthur-will.json diff --git a/src/components/blog-card/blog-01.tsx b/src/components/blog-card/blog-01.tsx index f5115841a..79d65a651 100644 --- a/src/components/blog-card/blog-01.tsx +++ b/src/components/blog-card/blog-01.tsx @@ -3,12 +3,12 @@ import clsx from "clsx"; import Anchor from "@ui/anchor"; import { IBlog } from "@utils/types"; -type TProps = Pick & { +type TProps = Pick & { className?: string; }; const BlogCard = forwardRef( - ({ title, path, category, postedAt, image, views, className }, ref) => ( + ({ title, path, category, postedAt, image, className }, ref) => (
(

{title}

-
    +
    • {postedAt}
    • -
    • - - {views} views -
diff --git a/src/components/blog-card/blog-02.tsx b/src/components/blog-card/blog-02.tsx index 2d351e204..a63d1abba 100644 --- a/src/components/blog-card/blog-02.tsx +++ b/src/components/blog-card/blog-02.tsx @@ -3,12 +3,12 @@ import clsx from "clsx"; import Anchor from "@ui/anchor"; import { IBlog } from "@utils/types"; -type TProps = Pick & { +type TProps = Pick & { className?: string; }; const BlogCard = forwardRef( - ({ title, path, category, postedAt, image, views, className }, ref) => ( + ({ title, path, category, postedAt, image, className }, ref) => (
( {title} -
    +
    • {postedAt}
    • -
    • - - {views} views -
diff --git a/src/components/blog-card/blog-03.tsx b/src/components/blog-card/blog-03.tsx index 8be116ab7..51a8758f4 100644 --- a/src/components/blog-card/blog-03.tsx +++ b/src/components/blog-card/blog-03.tsx @@ -3,12 +3,12 @@ import clsx from "clsx"; import Anchor from "@ui/anchor"; import { IBlog } from "@utils/types"; -type TProps = Pick & { +type TProps = Pick & { className?: string; }; const BlogCard = forwardRef( - ({ className, image, path, title, category, postedAt, views }, ref) => { + ({ className, image, path, title, category, postedAt }, ref) => { return (
@@ -40,15 +40,11 @@ const BlogCard = forwardRef( {title} -
    +
    • {postedAt}
    • -
    • - - {views} views -
diff --git a/src/components/blog-card/blog-04.tsx b/src/components/blog-card/blog-04.tsx index 9b71d8c9d..ade1da21d 100644 --- a/src/components/blog-card/blog-04.tsx +++ b/src/components/blog-card/blog-04.tsx @@ -3,13 +3,13 @@ import clsx from "clsx"; import Anchor from "@ui/anchor"; import { BlogMetaType, IBlog } from "@utils/types"; -type TProps = Pick & { +type TProps = Pick & { className?: string; category?: BlogMetaType; }; const BlogCard = forwardRef( - ({ className, image, path, title, postedAt, views, category }, ref) => { + ({ className, image, path, title, postedAt, category }, ref) => { return (
( {title} -
    +
    • {postedAt}
    • -
    • - - {views} views -
diff --git a/src/components/blog-card/blog-05.tsx b/src/components/blog-card/blog-05.tsx index 01827cb1a..ed2a7aea6 100644 --- a/src/components/blog-card/blog-05.tsx +++ b/src/components/blog-card/blog-05.tsx @@ -9,13 +9,13 @@ import SocialShare from "@components/social-share/layout-03"; type TProps = Pick< IBlog, - "image" | "path" | "title" | "postedAt" | "views" | "category" | "author" | "excerpt" + "image" | "path" | "title" | "postedAt" | "category" | "author" | "excerpt" > & { className?: string; }; const BlogCard = forwardRef( - ({ className, image, path, title, postedAt, views, category, author, excerpt }, ref) => { + ({ className, image, path, title, postedAt, category, author, excerpt }, ref) => { return (
( text={postedAt} icon="far fa-calendar" /> -

diff --git a/src/components/blog-card/blog-06.tsx b/src/components/blog-card/blog-06.tsx index a7f281bd0..cd35e124f 100644 --- a/src/components/blog-card/blog-06.tsx +++ b/src/components/blog-card/blog-06.tsx @@ -7,15 +7,12 @@ import { IBlog } from "@utils/types"; import Button from "@components/ui/button"; import SocialShare from "@components/social-share/layout-03"; -type TProps = Pick< - IBlog, - "image" | "path" | "title" | "postedAt" | "views" | "author" | "excerpt" -> & { +type TProps = Pick & { className?: string; }; const BlogCard = forwardRef( - ({ className, image, path, title, postedAt, views, author, excerpt }, ref) => { + ({ className, image, path, title, postedAt, author, excerpt }, ref) => { return (
( text={postedAt} icon="far fa-calendar" /> -

diff --git a/src/containers/blog-full/layout-01/index.tsx b/src/containers/blog-full/layout-01/index.tsx index a95761276..7c05048d9 100644 --- a/src/containers/blog-full/layout-01/index.tsx +++ b/src/containers/blog-full/layout-01/index.tsx @@ -32,7 +32,6 @@ const BlogArea = ({ data: { blogs, pagiData } }: TProps) => { path={blog.path} category={blog.category} postedAt={blog.postedAt} - views={blog.views} initial="offscreen" whileInView="onscreen" viewport={{ once: true, amount: 0.2 }} diff --git a/src/containers/blog-full/layout-02/index.tsx b/src/containers/blog-full/layout-02/index.tsx index a2b504b53..1d0d8524e 100644 --- a/src/containers/blog-full/layout-02/index.tsx +++ b/src/containers/blog-full/layout-02/index.tsx @@ -36,7 +36,6 @@ const BlogArea = ({ data: { blogs, recentPosts, tags, pagiData } }: TProps) => { path={blog.path} image={blog.image} postedAt={blog.postedAt} - views={blog.views} initial="offscreen" whileInView="onscreen" viewport={{ once: true, amount: 0.2 }} diff --git a/src/containers/blog-full/layout-03/index.tsx b/src/containers/blog-full/layout-03/index.tsx index 797267599..aae2f1575 100644 --- a/src/containers/blog-full/layout-03/index.tsx +++ b/src/containers/blog-full/layout-03/index.tsx @@ -35,7 +35,6 @@ const BlogArea = ({ data: { blogs, recentPosts, tags, pagiData } }: TProps) => { path={blog.path} image={blog.image} postedAt={blog.postedAt} - views={blog.views} category={blog.category} author={blog.author} excerpt={blog.excerpt} diff --git a/src/containers/blog-full/layout-04/index.tsx b/src/containers/blog-full/layout-04/index.tsx index 96f1f71ac..f869f702c 100644 --- a/src/containers/blog-full/layout-04/index.tsx +++ b/src/containers/blog-full/layout-04/index.tsx @@ -31,7 +31,6 @@ const BlogArea = ({ data: { blogs, pagiData } }: TProps) => { path={blog.path} image={blog.image} postedAt={blog.postedAt} - views={blog.views} author={blog.author} excerpt={blog.excerpt} initial="offscreen" diff --git a/src/containers/blog-full/layout-05/index.tsx b/src/containers/blog-full/layout-05/index.tsx index c58023de6..bdf094841 100644 --- a/src/containers/blog-full/layout-05/index.tsx +++ b/src/containers/blog-full/layout-05/index.tsx @@ -31,7 +31,6 @@ const BlogArea = ({ data: { blogs } }: TProps) => { path={blog.path} category={blog.category} postedAt={blog.postedAt} - views={blog.views} initial="offscreen" whileInView="onscreen" viewport={{ once: true, amount: 0.2 }} diff --git a/src/containers/blog/layout-01/index.tsx b/src/containers/blog/layout-01/index.tsx index fbc9c6804..f4e0bd904 100644 --- a/src/containers/blog/layout-01/index.tsx +++ b/src/containers/blog/layout-01/index.tsx @@ -19,20 +19,11 @@ type TProps = TSection & { }; }; -const BlogArea = ({ - data: { section_title, motto, blogs }, - space, - bg, - titleSize, -}: TProps) => { +const BlogArea = ({ data: { section_title, motto, blogs }, space, bg, titleSize }: TProps) => { const { trans1, trans2 } = useUI(); return ( -
+
diff --git a/src/containers/blog/layout-02/index.tsx b/src/containers/blog/layout-02/index.tsx index 12b96cf71..a99224e92 100644 --- a/src/containers/blog/layout-02/index.tsx +++ b/src/containers/blog/layout-02/index.tsx @@ -58,7 +58,6 @@ const BlogArea = ({ image={blog.image} path={blog.path} postedAt={blog.postedAt} - views={blog.views} category={blog.category} initial="offscreen" whileInView="onscreen" diff --git a/src/containers/blog/layout-03/index.tsx b/src/containers/blog/layout-03/index.tsx index c9fea32b3..95d7f8983 100644 --- a/src/containers/blog/layout-03/index.tsx +++ b/src/containers/blog/layout-03/index.tsx @@ -41,7 +41,6 @@ const BlogArea = ({ data: { section_title, blogs }, space, bg, titleSize }: TPro category={blog.category} postedAt={blog.postedAt} image={blog.image} - views={blog.views} initial="offscreen" whileInView="onscreen" viewport={{ once: true, amount: 0.4 }} diff --git a/src/data/instructors/arthur-will.json b/src/data/instructors/arthur-will.json deleted file mode 100644 index 61353306e..000000000 --- a/src/data/instructors/arthur-will.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "id": 1, - "name": "Arthur Will", - "image": { - "src": "/images/profile/instructor.jpeg" - }, - "designation": "Advanced Educator", - "bio": "Arthur is a brilliant educator, whose life was spent for computer science and love of nature. Being a female, she encountered a lot of obstacles and was forbidden to work in this field by her family. With a true spirit and talented gift, she was able to succeed and set an example for others.", - "socials": [ - { - "label": "twitter", - "icon": "fab fa-twitter", - "url": "https://twitter.com" - }, - { - "label": "facebook", - "icon": "fab fa-facebook-f", - "url": "https://www.facebook.com" - }, - { - "label": "instagram", - "icon": "fab fa-instagram", - "url": "https://www.instagram.com" - }, - { - "label": "pinterest", - "icon": "fab fa-pinterest", - "url": "https://www.pinterest.com" - }, - { - "label": "youtube", - "icon": "fab fa-youtube", - "url": "https://www.youtube.com" - } - ] -} \ No newline at end of file diff --git a/src/pages/blogs/author/[author]/index.tsx b/src/pages/blogs/author/[author]/index.tsx index 54f55ad92..9ad94a651 100644 --- a/src/pages/blogs/author/[author]/index.tsx +++ b/src/pages/blogs/author/[author]/index.tsx @@ -82,7 +82,7 @@ export const getStaticProps = ({ params }: Params) => { const author = getAuthorBySlug(params.author, ["id", "name", "slug"]); const { posts, count } = getPostsByAuthor( author.id, - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/author/[author]/page/[page].tsx b/src/pages/blogs/author/[author]/page/[page].tsx index 4d830fcf9..ae88fe21c 100644 --- a/src/pages/blogs/author/[author]/page/[page].tsx +++ b/src/pages/blogs/author/[author]/page/[page].tsx @@ -106,7 +106,7 @@ export const getStaticProps = ({ params }: Params) => { const skip = (currentPage - 1) * POSTS_PER_PAGE; const { posts, count } = getPostsByAuthor( author.id, - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-classic/index.tsx b/src/pages/blogs/blog-classic/index.tsx index 132717025..c450dbd37 100644 --- a/src/pages/blogs/blog-classic/index.tsx +++ b/src/pages/blogs/blog-classic/index.tsx @@ -49,7 +49,7 @@ BlogClassic.Layout = Layout01; export const getStaticProps: GetStaticProps = () => { const { blogs, count } = getAllBlogs( - ["title", "image", "category", "postedAt", "views", "author", "excerpt"], + ["title", "image", "category", "postedAt", "author", "excerpt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-classic/page/[page].tsx b/src/pages/blogs/blog-classic/page/[page].tsx index ab608d601..31e5bba89 100644 --- a/src/pages/blogs/blog-classic/page/[page].tsx +++ b/src/pages/blogs/blog-classic/page/[page].tsx @@ -60,7 +60,7 @@ export const getStaticPaths: GetStaticPaths = () => { .filter(Boolean); const paths = pagesToGenerate.map((page) => { - return { params: { page: String(page) } }; // cast page to string + return { params: { page: String(page) } }; }); return { @@ -78,7 +78,7 @@ export const getStaticProps: GetStaticProps = ({ params }) => { const currentPage = !page || Number.isNaN(+page) ? 1 : +page; const skip = (currentPage - 1) * POSTS_PER_PAGE; const { blogs, count } = getAllBlogs( - ["title", "image", "category", "postedAt", "views", "author", "excerpt"], + ["title", "image", "category", "postedAt", "author", "excerpt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-grid-sidebar/index.tsx b/src/pages/blogs/blog-grid-sidebar/index.tsx index 1a1a26350..06a55be25 100644 --- a/src/pages/blogs/blog-grid-sidebar/index.tsx +++ b/src/pages/blogs/blog-grid-sidebar/index.tsx @@ -49,7 +49,7 @@ BlogGridSidebar.Layout = Layout01; export const getStaticProps: GetStaticProps = () => { const { blogs, count } = getAllBlogs( - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-grid-sidebar/page/[page].tsx b/src/pages/blogs/blog-grid-sidebar/page/[page].tsx index ebbec8967..be4dcd3e3 100644 --- a/src/pages/blogs/blog-grid-sidebar/page/[page].tsx +++ b/src/pages/blogs/blog-grid-sidebar/page/[page].tsx @@ -60,7 +60,7 @@ export const getStaticPaths: GetStaticPaths = () => { .filter(Boolean); const paths = pagesToGenerate.map((page) => { - return { params: { page: String(page) } }; // cast page to string + return { params: { page: String(page) } }; }); return { @@ -78,7 +78,7 @@ export const getStaticProps: GetStaticProps = ({ params }) => { const currentPage = !page || Number.isNaN(+page) ? 1 : +page; const skip = (currentPage - 1) * POSTS_PER_PAGE; const { blogs, count } = getAllBlogs( - ["title", "slug", "image", "category", "postedAt", "views"], + ["title", "slug", "image", "category", "postedAt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-list/index.tsx b/src/pages/blogs/blog-list/index.tsx index 06daa4284..73b41a63e 100644 --- a/src/pages/blogs/blog-list/index.tsx +++ b/src/pages/blogs/blog-list/index.tsx @@ -43,7 +43,7 @@ BlogList.Layout = Layout01; export const getStaticProps: GetStaticProps = () => { const { blogs, count } = getAllBlogs( - ["title", "image", "postedAt", "views", "author", "excerpt"], + ["title", "image", "postedAt", "author", "excerpt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog-list/page/[page].tsx b/src/pages/blogs/blog-list/page/[page].tsx index 635266c8d..988cad355 100644 --- a/src/pages/blogs/blog-list/page/[page].tsx +++ b/src/pages/blogs/blog-list/page/[page].tsx @@ -54,7 +54,7 @@ export const getStaticPaths: GetStaticPaths = () => { .filter(Boolean); const paths = pagesToGenerate.map((page) => { - return { params: { page: String(page) } }; // cast page to string + return { params: { page: String(page) } }; }); return { @@ -72,7 +72,7 @@ export const getStaticProps: GetStaticProps = ({ params }) => { const currentPage = !page || Number.isNaN(+page) ? 1 : +page; const skip = (currentPage - 1) * POSTS_PER_PAGE; const { blogs, count } = getAllBlogs( - ["title", "image", "category", "postedAt", "views", "author", "excerpt"], + ["title", "image", "category", "postedAt", "author", "excerpt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog/index.tsx b/src/pages/blogs/blog/index.tsx index 8509f1ff7..a9ef9a686 100644 --- a/src/pages/blogs/blog/index.tsx +++ b/src/pages/blogs/blog/index.tsx @@ -39,7 +39,7 @@ BlogGrid.Layout = Layout01; export const getStaticProps: GetStaticProps = () => { const { blogs, count } = getAllBlogs( - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/blog/page/[page].tsx b/src/pages/blogs/blog/page/[page].tsx index fa09286d6..d36d63b2e 100644 --- a/src/pages/blogs/blog/page/[page].tsx +++ b/src/pages/blogs/blog/page/[page].tsx @@ -50,7 +50,7 @@ export const getStaticPaths: GetStaticPaths = () => { .filter(Boolean); const paths = pagesToGenerate.map((page) => { - return { params: { page: String(page) } }; // cast page to string + return { params: { page: String(page) } }; }); return { paths, @@ -67,7 +67,7 @@ export const getStaticProps: GetStaticProps = ({ params }) => { const currentPage = !page || Number.isNaN(+page) ? 1 : +page; const skip = (currentPage - 1) * POSTS_PER_PAGE; const { blogs, count } = getAllBlogs( - ["title", "slug", "image", "category", "postedAt", "views"], + ["title", "slug", "image", "category", "postedAt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/category/[category]/index.tsx b/src/pages/blogs/category/[category]/index.tsx index de98d10f8..0b6e0e168 100644 --- a/src/pages/blogs/category/[category]/index.tsx +++ b/src/pages/blogs/category/[category]/index.tsx @@ -80,7 +80,7 @@ type Params = { export const getStaticProps = ({ params }: Params) => { const { posts, count } = getPostsByCategory( params.category, - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/category/[category]/page/[page].tsx b/src/pages/blogs/category/[category]/page/[page].tsx index 87b8b5d14..18be8a2bd 100644 --- a/src/pages/blogs/category/[category]/page/[page].tsx +++ b/src/pages/blogs/category/[category]/page/[page].tsx @@ -104,7 +104,7 @@ export const getStaticProps = ({ params }: Params) => { const skip = (currentPage - 1) * POSTS_PER_PAGE; const { posts, count } = getPostsByCategory( params.category, - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/search.tsx b/src/pages/blogs/search.tsx index 184932b43..fa7ef0ea0 100644 --- a/src/pages/blogs/search.tsx +++ b/src/pages/blogs/search.tsx @@ -69,7 +69,7 @@ const BlogSearch: PageProps = ({ data }) => { BlogSearch.Layout = Layout01; export const getStaticProps: GetStaticProps = () => { - const { blogs } = getAllBlogs(["title", "image", "category", "postedAt", "views", "content"]); + const { blogs } = getAllBlogs(["title", "image", "category", "postedAt", "content"]); return { props: { diff --git a/src/pages/blogs/tag/[tag]/index.tsx b/src/pages/blogs/tag/[tag]/index.tsx index 52fa6c2f9..6212c07f5 100644 --- a/src/pages/blogs/tag/[tag]/index.tsx +++ b/src/pages/blogs/tag/[tag]/index.tsx @@ -80,7 +80,7 @@ type Params = { export const getStaticProps = ({ params }: Params) => { const { posts, count } = getPostsByTag( params.tag, - ["title", "image", "tags", "postedAt", "views"], + ["title", "image", "tags", "postedAt"], 0, POSTS_PER_PAGE ); diff --git a/src/pages/blogs/tag/[tag]/page/[page].tsx b/src/pages/blogs/tag/[tag]/page/[page].tsx index 28a5e7d20..0773061fe 100644 --- a/src/pages/blogs/tag/[tag]/page/[page].tsx +++ b/src/pages/blogs/tag/[tag]/page/[page].tsx @@ -103,7 +103,7 @@ export const getStaticProps = ({ params }: Params) => { const skip = (currentPage - 1) * POSTS_PER_PAGE; const { posts, count } = getPostsByTag( params.tag, - ["title", "image", "category", "postedAt", "views"], + ["title", "image", "category", "postedAt"], skip, POSTS_PER_PAGE ); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 58a5f39e7..d9d66bd09 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -24,7 +24,7 @@ import { getallEvents } from "../lib/event"; interface PageContent { section: string; - [key: string]: unknown; // Add index signature + [key: string]: unknown; } interface PageData { @@ -78,7 +78,7 @@ export const getStaticProps: GetStaticProps = () => { const page = getPageData("home", "index"); const courses = getallCourses(["title", "thumbnail"], 0, 6); const events = getallEvents(["title", "thumbnail", "start_date", "location"], 0, 6); - const { blogs } = getAllBlogs(["title", "image", "category", "postedAt", "views"], 0, 3); + const { blogs } = getAllBlogs(["title", "image", "category", "postedAt"], 0, 3); return { props: { data: {