From 6974a5df5a703b201c067851f3199b3924a7437c Mon Sep 17 00:00:00 2001 From: ab7022 Date: Sun, 1 Dec 2024 00:35:59 +0530 Subject: [PATCH 01/20] changed tweet style from grid to carousel Signed-off-by: ab7022 --- components/Marquee.tsx | 50 ++++++ components/testimonials.tsx | 331 ++++++++++++++++++------------------ lib/utils.ts | 6 + package-lock.json | 21 +++ package.json | 2 + pages/index.tsx | 88 ++++++---- tailwind.config.js | 14 ++ 7 files changed, 310 insertions(+), 202 deletions(-) create mode 100644 components/Marquee.tsx create mode 100644 lib/utils.ts diff --git a/components/Marquee.tsx b/components/Marquee.tsx new file mode 100644 index 0000000..4f781e7 --- /dev/null +++ b/components/Marquee.tsx @@ -0,0 +1,50 @@ +import { cn } from "../lib/utils"; +interface MarqueeProps { + className?: string; + reverse?: boolean; + pauseOnHover?: boolean; + children?: React.ReactNode; + vertical?: boolean; + repeat?: number; + [key: string]: any; +} + +export function Marquee({ + className, + reverse, + pauseOnHover = false, + children, + vertical = false, + repeat = 4, + ...props +}: MarqueeProps) { + return ( +
+ {Array(repeat) + .fill(0) + .map((_, i) => ( +
+ {children} +
+ ))} +
+ ); +} diff --git a/components/testimonials.tsx b/components/testimonials.tsx index b4d7797..54e9367 100644 --- a/components/testimonials.tsx +++ b/components/testimonials.tsx @@ -1,175 +1,176 @@ import React from "react"; -import Tweet from "./tweets"; +import { Marquee } from "./Marquee"; +const tweets = [ + { + avatar: + "https://pbs.twimg.com/profile_images/1569793803313201154/Lso5fu1j_400x400.jpg", + name: "Jay Vasant", + id: "__alter123", + post: "https://x.com/__alter123/status/1731985031521014236?s=20", + content: + "The point being, maintaining unit tests is terribly difficult, and in general requires more efforts than the actual development itself. I've hardly seen any startups even at good scale able to manage unit tests. If you really think it's a requirement you can try tools like Keploy. But I feel even if you honestly think, manual testing should be always feasible", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1422864637532332033/mC1Nx0vj_400x400.jpg", + name: "matsuu@充電期間", + id: "matsuu", + post: "https://x.com/matsuu/status/1747448928575099236?s=20", + content: + "Based on the communication trace information that can be obtained using eBPF, it is possible to generate a test and a stub server to be used when executing the test.", + }, -const Testimonials = () => { - return ( - <> -
-

- What our community thinks -

-
-
- - - + { + avatar: + "https://pbs.twimg.com/profile_images/1763255658777120770/7SsuKwlS_400x400.jpg", + name: "Akash Singh", + id: "Kind_Of_Akash", + post: "https://x.com/Kind_Of_Akash/status/1754207010470736165?s=20", + content: + "Hey people, I wanted to share about my first month as an open source contributor at Keploy -Picked up 10 issues including bugs, features, documentation and opened 3 issues. -Submitted 8 PR's, out of which 2 have been merged and rest are on review", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1213737438830452736/5_5zXtXN_400x400.jpg", + name: "mugi", + id: "mugi_uno", + post: "https://x.com/mugi_uno/status/1745726154924003502?s=20", + content: + "I think the problem with mock data is that it is difficult to maintain, so if it makes it easier, I think it would be a good idea. The automated testing tool “Keploy” using eBPF is amazing", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1653250498127089665/x5RJbLq5_400x400.jpg", + name: "きょん/kyong", + id: "kyongshiii06", + post: "https://x.com/kyongshiii06/status/1746532217336250821?s=20", + content: + "Keploy can record and replay complex, distributed API flows as mocks and stubs. It's like having a time machine for your tests—saving you tons of time.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1653250498127089665/x5RJbLq5_400x400.jpg", + name: "きょん/kyong", + id: "kyongshiii06", + post: "https://x.com/kyongshiii06/status/1753030333128495470?s=20", + content: + "I tried keploy, it was amazing. Just wrap and start docker, and then just hit the API with curl or the client and you'll be able to test more and more. This is the golden test.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1741543460115812352/8x4aAI9k_400x400.jpg", + name: "Shivam Sourav Jha", + id: "ShivamSouravJha", + post: "https://x.com/ShivamSouravJha/status/1747517726749286713?s=20", + content: + "Why do I like keploy so much? Literally I see many tools and so hard to integrate. I mean update VScode , use the sdk , make this change make that change. With Keploy, don't worry buddy just run your application, we will literally do everything for you. You need to 0 efforts.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/837573171427487744/IGQLsM55_400x400.jpg", + name: "やまもと@視力2.0", + id: "yamamoto_febc", + post: "https://x.com/yamamoto_febc/status/1755802346188390531?s=20", + content: + "It is quite easy to create normal tests. On the other hand, abnormal systems may be a little difficult. I think it's okay to use it only for normal systems.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1712175220176355329/sLXbk_PZ_400x400.jpg", + name: "TadasG", + id: "JustADude404", + post: "https://x.com/JustADude404/status/1746888711491424681?s=20", + content: + "Keploy is a tool which can automatically generate tests based on data from your running app. It simply attaches to your app, reads the data being passed through, and generates tests with real data. Pretty cool, huh?", + }, - + { + avatar: + "https://pbs.twimg.com/profile_images/1482259385959464960/1pQMXwj7_400x400.jpg", + name: "yadon", + id: "Seipann11", + post: "https://x.com/Seipann11/status/1755989987039064103?s=20", + content: + "Keploy is seriously amazing, a genius tool crushing issues at lightning speed.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1701251291861712897/PiTZ0UO7_400x400.jpg", + name: "Junichi.Y🐼@休職中", + id: "ymnk_8752", + post: "https://x.com/ymnk_8752/status/1745458928698450057?s=20", + content: + "It is amazing! I hear about eBPF a lot, but I don't know what it is.", + }, + { + avatar: + "https://pbs.twimg.com/profile_images/1604797450124144640/6G7KytX8_400x400.jpg", + name: "あんどーぼんばー", + id: "AndooBomber", + post: "https://x.com/AndooBomber/status/1747663021747691808?s=20", + content: "I tried Keploy, good tool.", + }, +]; +const firstRow = tweets.slice(0, tweets.length / 2); +const secondRow = tweets.slice(tweets.length / 2); - -
-
- - - - - - - -
+const ReviewCard = ({ + avatar, + name, + id, + content, + post, +}: { + avatar: string; + name: string; + post: string; + id: string; + content: string; +}) => { + return ( + +
+
+
- - - - - - - +
{name}
+

{id}

-
- +
{content}
+ +
); }; -export default Testimonials; +const TwitterTestimonials = () => { + return ( +
+

+ What our community thinks +

+
+ + + {firstRow.map((tweet) => ( + + ))} + + + {secondRow.map((tweet) => ( + + ))} + +
+
+
+
+ ); +}; +export default TwitterTestimonials; diff --git a/lib/utils.ts b/lib/utils.ts new file mode 100644 index 0000000..150bcd5 --- /dev/null +++ b/lib/utils.ts @@ -0,0 +1,6 @@ +import clsx, { ClassValue } from "clsx"; +import { twMerge } from "tailwind-merge"; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d0f400c..46d8170 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@uiw/codemirror-theme-dracula": "^4.23.5", "@uiw/react-codemirror": "^4.23.5", "classnames": "^2.3.1", + "clsx": "^2.1.1", "codemirror": "^6.0.1", "date-fns": "^2.28.0", "framer-motion": "^11.0.20", @@ -31,6 +32,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.0.1", + "tailwind-merge": "^2.5.5", "typescript": "^4.7.4" }, "devDependencies": { @@ -1700,6 +1702,15 @@ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/codemirror": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz", @@ -5050,6 +5061,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tailwind-merge": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.5.tgz", + "integrity": "sha512-0LXunzzAZzo0tEPxV3I297ffKZPlKDrjj7NXphC8V5ak9yHC5zRmxnOe2m/Rd/7ivsOMJe3JZ2JVocoDdQTRBA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, "node_modules/tailwindcss": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", diff --git a/package.json b/package.json index b2c93ed..47ba663 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@uiw/codemirror-theme-dracula": "^4.23.5", "@uiw/react-codemirror": "^4.23.5", "classnames": "^2.3.1", + "clsx": "^2.1.1", "codemirror": "^6.0.1", "date-fns": "^2.28.0", "framer-motion": "^11.0.20", @@ -33,6 +34,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.0.1", + "tailwind-merge": "^2.5.5", "typescript": "^4.7.4" }, "devDependencies": { diff --git a/pages/index.tsx b/pages/index.tsx index 7fae509..e4326e0 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -22,48 +22,62 @@ export default function Index({ communityPosts, technologyPosts, preview }) {
-
-
-
-

- Keploy Blog -

-

- Empowering your tech journey with expert advice and analysis -

-
- - Technology - - - Community - -
+
+
+
+ {/* Content Section */} +
+

+ Keploy Blog +

+

+ Empowering developers with cutting-edge insights, practical guides, and innovative tech perspectives +

+ + {/* CTA Buttons */} + - -
- hero image + + {/* Hero Image */} +
+
+ Keploy Blog Mascot +
+ Open Source Vector +
-
- vector -
+
+ + {/* Subtle Background Effect */} +
+
+
+
Date: Sun, 1 Dec 2024 00:43:39 +0530 Subject: [PATCH 02/20] updated index page back to previous one Signed-off-by: ab7022 --- pages/index.tsx | 90 +++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 52 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index e4326e0..f454784 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -22,62 +22,48 @@ export default function Index({ communityPosts, technologyPosts, preview }) {
-
-
-
- {/* Content Section */} -
-

- Keploy Blog -

-

- Empowering developers with cutting-edge insights, practical guides, and innovative tech perspectives -

- - {/* CTA Buttons */} -
- - - Technology - - - - Community - +
+
+
+

+ Keploy Blog +

+

+ Empowering your tech journey with expert advice and analysis +

+
+ + Technology + + + Community + +
-
- - {/* Hero Image */} -
-
- Keploy Blog Mascot + hero image -
- Open Source Vector -
+
+ vector +
-
- - {/* Subtle Background Effect */} -
-
-
-
{ }, revalidate: 10, }; -}; +}; \ No newline at end of file From dd388f0a22c1971f4dd5c6d2fc17adf4b6f10735 Mon Sep 17 00:00:00 2001 From: ab7022 Date: Sun, 1 Dec 2024 00:44:58 +0530 Subject: [PATCH 03/20] updated index page back to previous one Signed-off-by: ab7022 --- pages/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/index.tsx b/pages/index.tsx index f454784..437b7c5 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -12,6 +12,7 @@ import Image from "next/image"; import OpenSourceVectorPng from "../public/images/open-source-vector.png"; export default function Index({ communityPosts, technologyPosts, preview }) { return ( + Date: Sun, 1 Dec 2024 00:52:31 +0530 Subject: [PATCH 04/20] updated index page back to previous one Signed-off-by: ab7022 --- pages/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/index.tsx b/pages/index.tsx index 437b7c5..f454784 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -12,7 +12,6 @@ import Image from "next/image"; import OpenSourceVectorPng from "../public/images/open-source-vector.png"; export default function Index({ communityPosts, technologyPosts, preview }) { return ( - Date: Thu, 5 Dec 2024 00:31:42 +0530 Subject: [PATCH 05/20] added new contant file for tweets --- components/testimonials.tsx | 118 ++---------------------------------- lib/utils.ts | 2 +- services/Tweets.tsx | 113 ++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 115 deletions(-) create mode 100644 services/Tweets.tsx diff --git a/components/testimonials.tsx b/components/testimonials.tsx index 54e9367..fd2b8fc 100644 --- a/components/testimonials.tsx +++ b/components/testimonials.tsx @@ -1,118 +1,8 @@ import React from "react"; import { Marquee } from "./Marquee"; -const tweets = [ - { - avatar: - "https://pbs.twimg.com/profile_images/1569793803313201154/Lso5fu1j_400x400.jpg", - name: "Jay Vasant", - id: "__alter123", - post: "https://x.com/__alter123/status/1731985031521014236?s=20", - content: - "The point being, maintaining unit tests is terribly difficult, and in general requires more efforts than the actual development itself. I've hardly seen any startups even at good scale able to manage unit tests. If you really think it's a requirement you can try tools like Keploy. But I feel even if you honestly think, manual testing should be always feasible", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1422864637532332033/mC1Nx0vj_400x400.jpg", - name: "matsuu@充電期間", - id: "matsuu", - post: "https://x.com/matsuu/status/1747448928575099236?s=20", - content: - "Based on the communication trace information that can be obtained using eBPF, it is possible to generate a test and a stub server to be used when executing the test.", - }, - - { - avatar: - "https://pbs.twimg.com/profile_images/1763255658777120770/7SsuKwlS_400x400.jpg", - name: "Akash Singh", - id: "Kind_Of_Akash", - post: "https://x.com/Kind_Of_Akash/status/1754207010470736165?s=20", - content: - "Hey people, I wanted to share about my first month as an open source contributor at Keploy -Picked up 10 issues including bugs, features, documentation and opened 3 issues. -Submitted 8 PR's, out of which 2 have been merged and rest are on review", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1213737438830452736/5_5zXtXN_400x400.jpg", - name: "mugi", - id: "mugi_uno", - post: "https://x.com/mugi_uno/status/1745726154924003502?s=20", - content: - "I think the problem with mock data is that it is difficult to maintain, so if it makes it easier, I think it would be a good idea. The automated testing tool “Keploy” using eBPF is amazing", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1653250498127089665/x5RJbLq5_400x400.jpg", - name: "きょん/kyong", - id: "kyongshiii06", - post: "https://x.com/kyongshiii06/status/1746532217336250821?s=20", - content: - "Keploy can record and replay complex, distributed API flows as mocks and stubs. It's like having a time machine for your tests—saving you tons of time.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1653250498127089665/x5RJbLq5_400x400.jpg", - name: "きょん/kyong", - id: "kyongshiii06", - post: "https://x.com/kyongshiii06/status/1753030333128495470?s=20", - content: - "I tried keploy, it was amazing. Just wrap and start docker, and then just hit the API with curl or the client and you'll be able to test more and more. This is the golden test.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1741543460115812352/8x4aAI9k_400x400.jpg", - name: "Shivam Sourav Jha", - id: "ShivamSouravJha", - post: "https://x.com/ShivamSouravJha/status/1747517726749286713?s=20", - content: - "Why do I like keploy so much? Literally I see many tools and so hard to integrate. I mean update VScode , use the sdk , make this change make that change. With Keploy, don't worry buddy just run your application, we will literally do everything for you. You need to 0 efforts.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/837573171427487744/IGQLsM55_400x400.jpg", - name: "やまもと@視力2.0", - id: "yamamoto_febc", - post: "https://x.com/yamamoto_febc/status/1755802346188390531?s=20", - content: - "It is quite easy to create normal tests. On the other hand, abnormal systems may be a little difficult. I think it's okay to use it only for normal systems.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1712175220176355329/sLXbk_PZ_400x400.jpg", - name: "TadasG", - id: "JustADude404", - post: "https://x.com/JustADude404/status/1746888711491424681?s=20", - content: - "Keploy is a tool which can automatically generate tests based on data from your running app. It simply attaches to your app, reads the data being passed through, and generates tests with real data. Pretty cool, huh?", - }, - - { - avatar: - "https://pbs.twimg.com/profile_images/1482259385959464960/1pQMXwj7_400x400.jpg", - name: "yadon", - id: "Seipann11", - post: "https://x.com/Seipann11/status/1755989987039064103?s=20", - content: - "Keploy is seriously amazing, a genius tool crushing issues at lightning speed.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1701251291861712897/PiTZ0UO7_400x400.jpg", - name: "Junichi.Y🐼@休職中", - id: "ymnk_8752", - post: "https://x.com/ymnk_8752/status/1745458928698450057?s=20", - content: - "It is amazing! I hear about eBPF a lot, but I don't know what it is.", - }, - { - avatar: - "https://pbs.twimg.com/profile_images/1604797450124144640/6G7KytX8_400x400.jpg", - name: "あんどーぼんばー", - id: "AndooBomber", - post: "https://x.com/AndooBomber/status/1747663021747691808?s=20", - content: "I tried Keploy, good tool.", - }, -]; -const firstRow = tweets.slice(0, tweets.length / 2); -const secondRow = tweets.slice(tweets.length / 2); +import Tweets from "../services/Tweets"; +const firstRow = Tweets.slice(0, Tweets.length / 2); +const secondRow = Tweets.slice(Tweets.length / 2); const ReviewCard = ({ avatar, @@ -128,7 +18,7 @@ const ReviewCard = ({ content: string; }) => { return ( - +
Date: Thu, 5 Dec 2024 01:06:30 +0530 Subject: [PATCH 06/20] added new contant file for tweets Signed-off-by: ab7022 --- lib/utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils.ts b/lib/utils.ts index 70f56a5..f8f2fc2 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,6 +1,5 @@ import clsx, { ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; - export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); -} +} \ No newline at end of file From 166bfd5cb675c54c14121025d1fa8ad6a7ee8154 Mon Sep 17 00:00:00 2001 From: ab7022 Date: Thu, 5 Dec 2024 01:17:02 +0530 Subject: [PATCH 07/20] Trigger DCO check Signed-off-by: ab7022 --- lib/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.ts b/lib/utils.ts index f8f2fc2..b425b77 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -2,4 +2,4 @@ import clsx, { ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); -} \ No newline at end of file +} From ff6179332c8228b44f7693dbb0bfabba8d498a08 Mon Sep 17 00:00:00 2001 From: ab7022 Date: Thu, 19 Dec 2024 17:50:41 +0530 Subject: [PATCH 08/20] fixed a bug --- lib/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.ts b/lib/utils.ts index b425b77..f8f2fc2 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -2,4 +2,4 @@ import clsx, { ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); -} +} \ No newline at end of file From a1a45353b7ea718b7c09d64b3516998477f29c3a Mon Sep 17 00:00:00 2001 From: Animesh Pathak Date: Tue, 10 Dec 2024 16:42:46 +0530 Subject: [PATCH 09/20] fix: linkedin metadata updated Signed-off-by: Animesh Pathak --- components/author-description.jsx | 2 +- pages/authors/index.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/author-description.jsx b/components/author-description.jsx index 36729bf..cf101f4 100644 --- a/components/author-description.jsx +++ b/components/author-description.jsx @@ -21,7 +21,7 @@ const AuthorDescription = ({ authorData, AuthorName, isPost }) => { const avatarImgElement = tempDiv.querySelector(".pp-author-boxes-avatar img"); const authorNameElement = tempDiv.querySelector(".pp-author-boxes-name a"); const linkedinLink = tempDiv.querySelector( - '.pp-author-boxes-meta.multiple-authors-links a[aria-label="Website"]' + '.pp-author-boxes-avatar-details a[aria-label="Website"]' ); const authorDescriptionElement = tempDiv.querySelector( ".pp-author-boxes-description.multiple-authors-description" diff --git a/pages/authors/index.tsx b/pages/authors/index.tsx index 8b4d468..faadd55 100644 --- a/pages/authors/index.tsx +++ b/pages/authors/index.tsx @@ -42,7 +42,6 @@ export default function Authors({ export const getStaticProps: GetStaticProps = async ({ preview = false }) => { const AllAuthors = await getAllAuthors(); - console.log(AllAuthors.edges); return { props: { AllAuthors, preview }, revalidate: 10, From 7b41c6745ae4268159dde7e9366015f4dbb6cd27 Mon Sep 17 00:00:00 2001 From: Yash Khare Date: Wed, 4 Dec 2024 16:19:21 +0530 Subject: [PATCH 10/20] feat: meta tags for blogs Signed-off-by: Yash Khare --- lib/api.ts | 12 ++++++++++++ pages/community/[slug].tsx | 5 ++--- pages/technology/[slug].tsx | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index 17e5494..e2b1943 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -300,6 +300,10 @@ export async function getAllPostsForTechnology(preview) { } } } + seo { + metaDesc + title + } } } } @@ -355,6 +359,10 @@ export async function getAllPostsForCommunity(preview) { } } } + seo { + metaDesc + title + } } } pageInfo { @@ -585,6 +593,10 @@ export async function getPostAndMorePosts(slug, preview, previewData) { } } } + seo{ + metaDesc + title + } } query PostBySlug($id: ID!, $idType: PostIdType!) { post(id: $id, idType: $idType) { diff --git a/pages/community/[slug].tsx b/pages/community/[slug].tsx index a685435..b0c6c2e 100644 --- a/pages/community/[slug].tsx +++ b/pages/community/[slug].tsx @@ -104,7 +104,6 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { if (post && post.content) { const content = post.content; - const avatarDivMatch = content.match( /]*class="pp-author-boxes-avatar"[^>]*>\s*]*src='([^']*)'[^>]*\/?>/ ); @@ -146,8 +145,8 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) {
diff --git a/pages/technology/[slug].tsx b/pages/technology/[slug].tsx index a3698a6..a95a9df 100644 --- a/pages/technology/[slug].tsx +++ b/pages/technology/[slug].tsx @@ -135,8 +135,8 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) {
From ed0c9fd2bf5ddc2baeb8dad7b5377dee07752046 Mon Sep 17 00:00:00 2001 From: charankamarapu Date: Mon, 25 Nov 2024 15:58:15 +0530 Subject: [PATCH 11/20] feat: add tag based suggestions Signed-off-by: charankamarapu --- lib/api.ts | 116 ++++++++++++++---------------------- pages/community/[slug].tsx | 5 +- pages/technology/[slug].tsx | 4 +- 3 files changed, 51 insertions(+), 74 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index e2b1943..c54fec2 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -446,104 +446,78 @@ export async function getPostsByAuthor() { return data?.posts; } -export async function getMoreStoriesForSlugs() { - const data = await fetchAPI( - ` - query AllPostsForCategory { - techPosts: posts(first: 100, where: { orderby: { field: DATE, order: DESC }, categoryName: "technology" }) { +export async function getMoreStoriesForSlugs(tags, slug) { + const tagFilter = tags?.edges?.length > 0; + const variables = tagFilter ? { tags: tags.edges.map((edge) => edge.node.name) } : undefined; + let stories = []; + let data; + + const queryWithTags = ` + query Posts($tags: [String!]) { + posts( + first: 7, + where: { orderby: { field: DATE, order: DESC }, ${tagFilter ? "tagSlugIn: $tags" : ""} } + ) { edges { node { title excerpt slug date - featuredImage { - node { - sourceUrl - } - } - author { - node { - name - firstName - lastName - avatar { - url - } - } - } + featuredImage { node { sourceUrl } } + author { node { name firstName lastName avatar { url } } } ppmaAuthorName - categories { - edges { - node { - name - } - } - } + categories { edges { node { name } } } } } } - communityPosts: posts(first: 100, where: { orderby: { field: DATE, order: DESC }, categoryName: "community" }) { + } + `; + + const fallbackQuery = ` + query PostsWithoutTags { + posts(first: 7, where: { orderby: { field: DATE, order: DESC } }) { edges { node { title excerpt slug date - featuredImage { - node { - sourceUrl - } - } - author { - node { - name - firstName - lastName - avatar { - url - } - } - } + featuredImage { node { sourceUrl } } + author { node { name firstName lastName avatar { url } } } ppmaAuthorName - categories { - edges { - node { - name - } - } - } + categories { edges { node { name } } } } } } } - `, - { - variables: {}, - } - ); + `; - const techPosts = data?.techPosts?.edges.map(({ node }) => node) || []; - const communityPosts = - data?.communityPosts?.edges.map(({ node }) => node) || []; - - const newTechPosts = [...techPosts, ...communityPosts]; - const newCommunityPosts = [...communityPosts, ...techPosts]; + // Fetch posts with tags if applicable + if (tagFilter) { + data = await fetchAPI(queryWithTags, { variables }); + stories = data?.posts?.edges.map(({ node }) => node) || []; + stories = stories.filter((story) => story.slug !== slug); + } - const techMoreStories = { - edges: newTechPosts.map((node) => ({ node })), - }; + // If no posts are found, fetch without tag filter + if (!stories.length) { + data = await fetchAPI(fallbackQuery); + stories = data?.posts?.edges.map(({ node }) => node) || []; + stories = stories.filter((story) => story.slug !== slug); - const communityMoreStories = { - edges: newCommunityPosts.map((node) => ({ node })), - }; + } + // Remove posts with the same slug return { - techMoreStories, - communityMoreStories, + techMoreStories: { edges: stories.map((node) => ({ node })) }, + communityMoreStories: { edges: stories.map((node) => ({ node })) }, }; } + + + export async function getPostAndMorePosts(slug, preview, previewData) { const postPreview = preview && previewData?.post; // The slug may be the id of an unpublished post @@ -563,6 +537,7 @@ export async function getPostAndMorePosts(slug, preview, previewData) { url } } + fragment PostFields on Post { title excerpt @@ -598,6 +573,7 @@ export async function getPostAndMorePosts(slug, preview, previewData) { title } } + query PostBySlug($id: ID!, $idType: PostIdType!) { post(id: $id, idType: $idType) { ...PostFields @@ -659,4 +635,4 @@ export async function getPostAndMorePosts(slug, preview, previewData) { if (data.posts.edges.length > 2) data.posts.edges.pop(); return data; -} +} \ No newline at end of file diff --git a/pages/community/[slug].tsx b/pages/community/[slug].tsx index b0c6c2e..1a5e8fa 100644 --- a/pages/community/[slug].tsx +++ b/pages/community/[slug].tsx @@ -211,7 +211,8 @@ export const getStaticProps: GetStaticProps = async ({ previewData, }) => { const data = await getPostAndMorePosts(params?.slug, preview, previewData); - const { communityMoreStories } = await getMoreStoriesForSlugs(); + const { communityMoreStories } = await getMoreStoriesForSlugs(data?.post?.tags, data?.post?.slug); + // console.log("here is the main post: ",data?.post); const authorDetails = []; authorDetails.push(await getReviewAuthorDetails("neha")); @@ -239,4 +240,4 @@ export const getStaticPaths: GetStaticPaths = async () => { paths: communtiyPosts || [], fallback: true, }; -}; +}; \ No newline at end of file diff --git a/pages/technology/[slug].tsx b/pages/technology/[slug].tsx index a95a9df..518f063 100644 --- a/pages/technology/[slug].tsx +++ b/pages/technology/[slug].tsx @@ -201,7 +201,7 @@ export const getStaticProps: GetStaticProps = async ({ previewData, }) => { const data = await getPostAndMorePosts(params?.slug, preview, previewData); - const { techMoreStories } = await getMoreStoriesForSlugs(); + const { techMoreStories } = await getMoreStoriesForSlugs(data?.post?.tags, data?.post?.slug); const authorDetails = []; authorDetails.push(await getReviewAuthorDetails("neha")); authorDetails.push(await getReviewAuthorDetails("Jain")); @@ -228,4 +228,4 @@ export const getStaticPaths: GetStaticPaths = async () => { paths: technologyPosts || [], fallback: true, }; -}; +}; \ No newline at end of file From 6dd79d916123770a8ea3c5a663892238219defc4 Mon Sep 17 00:00:00 2001 From: Animesh Pathak Date: Tue, 10 Dec 2024 13:24:36 +0530 Subject: [PATCH 12/20] fix: fallBack for MetaData Signed-off-by: Animesh Pathak --- pages/community/[slug].tsx | 4 ++-- pages/technology/[slug].tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/community/[slug].tsx b/pages/community/[slug].tsx index 1a5e8fa..bc7ba53 100644 --- a/pages/community/[slug].tsx +++ b/pages/community/[slug].tsx @@ -116,7 +116,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { // Match the

with class pp-author-boxes-description and extract its content const authorDescriptionMatch = content.match( - /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/s + /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/ ); // Apply table responsive wrapper @@ -146,7 +146,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { preview={preview} featuredImage={post?.featuredImage?.node?.sourceUrl || ""} Title={post?.seo.title || "Loading..."} - Description={`${post?.seo.metaDesc || "Blog About Keploy"}`} + Description={`${post?.seo.metaDesc || "Blog About " + `${post?.title}`}`} >

diff --git a/pages/technology/[slug].tsx b/pages/technology/[slug].tsx index 518f063..f449663 100644 --- a/pages/technology/[slug].tsx +++ b/pages/technology/[slug].tsx @@ -111,7 +111,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { // Match the

with class pp-author-boxes-description and extract its content const authorDescriptionMatch = content.match( - /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/s + /]*class="pp-author-boxes-description multiple-authors-description"[^>]*>(.*?)<\/p>/ ); if ( @@ -136,7 +136,7 @@ export default function Post({ post, posts, reviewAuthorDetails, preview }) { preview={preview} featuredImage={post?.featuredImage?.node?.sourceUrl || ""} Title={post?.seo.title || "Loading..."} - Description={`${post?.seo.metaDesc || "Blog About Keploy"}`} + Description={`${post?.seo.metaDesc || "Blog About " + `${post?.title}`}`} >

From fc9977599f643a5e1b4e7e87517dad0f66332d33 Mon Sep 17 00:00:00 2001 From: Aditya Sharma <70089590+Aditya-eddy@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:55:26 +0530 Subject: [PATCH 13/20] chore:adding timedelay (#71) Signed-off-by: Aditya-eddy Co-authored-by: Animesh Pathak <53110238+Sonichigo@users.noreply.github.com> --- .gitignore | 2 ++ components/post-body.tsx | 43 +++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 42aadf6..53a5bbb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +.early.coverage diff --git a/components/post-body.tsx b/components/post-body.tsx index 124ff9a..db72622 100644 --- a/components/post-body.tsx +++ b/components/post-body.tsx @@ -76,24 +76,31 @@ export default function PostBody({ // }, [content]); // Log content load for debugging useEffect(() => { - const headings = Array.from(document.querySelectorAll("h1, h2, h3, h4")); - const tocItems = headings.map((heading, index) => { - const id = `heading-${index}`; - heading.setAttribute("id", id); - return { - id, - title: heading.textContent, - type: heading.tagName.toLowerCase(), - }; - }); - tocItems.shift(); - const index = tocItems.findIndex((item) => item.title === "More Stories"); - if (index !== -1) { - tocItems.splice(index + 1); - } - setTocItems(tocItems); - setCopySuccessList(Array(tocItems.length).fill(false)); - }, []); + const timeout = setTimeout(() => { + const headings = Array.from(document.querySelectorAll("h1, h2, h3, h4")); + const tocItems = headings.map((heading, index) => { + const id = `heading-${index}`; + heading.setAttribute("id", id); + console.log("Here are the heading: ", heading.textContent); + return { + id, + title: heading.textContent, + type: heading.tagName.toLowerCase(), + }; + }); + + tocItems.shift(); + const index = tocItems.findIndex((item) => item.title === "More Stories"); + if (index !== -1) { + tocItems.splice(index + 1); + } + setTocItems(tocItems); + setCopySuccessList(Array(tocItems.length).fill(false)); + }, 500); // Adjust delay in milliseconds as needed + + return () => clearTimeout(timeout); // Cleanup timeout on component unmount or before running the effect again + }, [content]); + const handleCopyClick = (code, index) => { navigator.clipboard From e18ade52b69ff9b04d5ec77b1bcadbb19284318b Mon Sep 17 00:00:00 2001 From: Yash Khare Date: Wed, 11 Dec 2024 15:47:30 +0530 Subject: [PATCH 14/20] chore: optimize queries for specific user (#73) * chore: optimize queries for specific user Signed-off-by: Yash Khare * handle null exception Signed-off-by: Yash Khare --------- Signed-off-by: Yash Khare Co-authored-by: Animesh Pathak <53110238+Sonichigo@users.noreply.github.com> --- lib/api.ts | 49 +++++++++++++++++++++++++++++++++++++++- pages/authors/[slug].tsx | 33 +++++++++++++++------------ 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index c54fec2..41e2577 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -515,7 +515,54 @@ export async function getMoreStoriesForSlugs(tags, slug) { }; } - +export async function getPostsByAuthorName(authorName) { + let allEdges = []; + const data = await fetchAPI( + `query MyQuery3 { + posts(where: {authorName: "${authorName}"}) { + edges { + node { + title + excerpt + slug + date + postId + featuredImage { + node { + sourceUrl + } + } + author { + node { + name + firstName + lastName + avatar { + url + } + } + } + ppmaAuthorName + categories { + edges { + node { + name + } + } + } + seo { + metaDesc + title + } + } + } + } + }` + ); + const edges = data.posts.edges; + allEdges = [...allEdges, ...edges]; + return { edges: allEdges }; +} export async function getPostAndMorePosts(slug, preview, previewData) { diff --git a/pages/authors/[slug].tsx b/pages/authors/[slug].tsx index 83978b4..a3f51c8 100644 --- a/pages/authors/[slug].tsx +++ b/pages/authors/[slug].tsx @@ -3,10 +3,8 @@ import Header from "../../components/header"; import Container from "../../components/container"; import { getAllAuthors, - getAllPostsForCommunity, - getAllPostsForTechnology, getContent, - getPostsByAuthor, + getPostsByAuthorName, } from "../../lib/api"; import { GetStaticPaths, GetStaticProps } from "next"; import PostByAuthorMapping from "../../components/postByAuthorMapping"; @@ -59,26 +57,33 @@ export const getStaticProps: GetStaticProps = async ({ }) => { const { slug } = params as { slug: string }; - // Fetch posts from both sources - const postsByTechnology = await getAllPostsForTechnology(preview); - const postsByCommunity = await getAllPostsForCommunity(preview); + // Users mapped by first name + const usersMappedByFirstName = ["Animesh Pathak", "Shubham Jain", "Yash Khare"]; - // Combine posts from both sources - const allPosts = [...postsByTechnology.edges, ...postsByCommunity.edges]; + // Determine the userName based on the slug + let userName = slug; + if (usersMappedByFirstName.includes(slug)) { + userName = slug.split(" ")[0]; + } - // Filter the combined posts by the given slug - const filteredPosts = allPosts.filter( - (item) => item.node.ppmaAuthorName === slug - ); + // Fetch posts by author name + const posts = await getPostsByAuthorName(userName); + + // Safely extract edges from posts + const allPosts = posts?.edges || []; // Extract postId from the first matching post (if any) - const postId = filteredPosts[0]?.node?.postId; + const postId = allPosts.length > 0 ? allPosts[0]?.node?.postId : null; // Fetch content using postId (if available) const content = postId ? await getContent(postId) : null; return { - props: { preview, filteredPosts, content }, + props: { + preview, + filteredPosts: allPosts, // Ensure filteredPosts is always an array + content, + }, revalidate: 10, // ISR with 10 seconds revalidation }; }; From a26c8a42d3fe21e046a929f0493eea5d1f419902 Mon Sep 17 00:00:00 2001 From: Tvisha Date: Fri, 13 Dec 2024 14:00:18 +0530 Subject: [PATCH 15/20] apollo (#76) Co-authored-by: Tvisha Raji --- components/layout.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/components/layout.tsx b/components/layout.tsx index 458356b..bf61aa4 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -43,6 +43,7 @@ export default function Layout({ preview, children, featuredImage, Title, Descri `, }} /> +