Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add github stars #29

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ module.exports = {
proseWrap: 'preserve',
htmlWhitespaceSensitivity: 'css',
endOfLine: 'lf'
};
}
12 changes: 10 additions & 2 deletions projects/fastgpt/app/[[...lang]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ export default async function LangHome({
lang && lang[0] && lang[0] !== "index" ? lang[0] : defaultLocale;
const dict = await getDictionary(langName);

let stars = 13 * 1000;
try {
const { stargazers_count } = await (
await fetch('https://api.github.com/repos/labring/FastGPT')
).json();
stars = stargazers_count;
} catch (error) {}

return (
<>
<Header dict={dict} />
<main className="flex flex-col items-center py-6">
{/* Hero Section */}
<Hero locale={dict.Hero} CTALocale={dict.CTAButton} />
<Hero locale={dict.Hero} CTALocale={dict.CTAButton} stars={stars} />
<SocialProof locale={dict.SocialProof} />
{/* Can be used to display technology stack, partners, project honors, etc. */}
{/*<ScrollingLogos />*/}
Expand All @@ -41,7 +49,7 @@ export default async function LangHome({
<FAQ id="FAQ" locale={dict.FAQ} langName={langName} />

{/* CTA (Call to Action) */}
<CTA locale={dict.CTA} CTALocale={dict.CTAButton} />
<CTA locale={dict.CTA} CTALocale={dict.CTAButton} stars={stars}/>
</main>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions projects/fastgpt/components/home/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import CTAButton from "@/components/home/CTAButton";
import { RoughNotation } from "react-rough-notation";

const CTA = ({ locale, CTALocale }: { locale: any; CTALocale: any }) => {
const CTA = ({ locale, CTALocale,stars }: { locale: any; CTALocale: any; stars:number }) => {
return (
<section className="flex flex-col justify-center max-w-[88%] items-center py-16 gap-12">
<div className="flex flex-col text-center gap-4">
Expand All @@ -22,7 +22,7 @@ const CTA = ({ locale, CTALocale }: { locale: any; CTALocale: any }) => {
{locale.description6}
</p>
</div>
<CTAButton locale={CTALocale} />
<CTAButton locale={CTALocale} stars={stars} />
</section>
);
};
Expand Down
4 changes: 2 additions & 2 deletions projects/fastgpt/components/home/CTAButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from "@/components/ui/button";
import { RocketIcon } from "lucide-react";
import Link from "next/link";

const CTAButton = ({ locale }: { locale: any }) => {
const CTAButton = ({ locale,stars }: { locale: any;stars:number }) => {
return (
<div className="flex items-center gap-4">
<Link
Expand All @@ -25,7 +25,7 @@ const CTAButton = ({ locale }: { locale: any }) => {
>
<Button className="flex gap-3 cursor-pointer font-semibold text-base px-6 py-6 rounded-full border hover:scale-105 duration-200 dark:text-white dark:bg-gradient-to-r dark:from-gray-800 dark:to-black dark:border-gray-600 dark:hover:text-gray-500 dark:hover:border-gray-800 dark:hover:from-black dark:hover:to-gray-900 text-white bg-blue-500 border-gray-300 hover:text-gray-200 hover:border-gray-400">
<svg viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg"><path fill="#FFFFFF" d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg>
13k
{(stars / 1000).toFixed(1)}k
</Button>
</Link>
</div>
Expand Down
4 changes: 2 additions & 2 deletions projects/fastgpt/components/home/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LineText } from "@/components/LineText";
import CTAButton from "@/components/home/CTAButton";
import { motion } from "framer-motion";

const Hero = ({ locale, CTALocale }: { locale: any; CTALocale: any }) => {
const Hero = ({ locale, CTALocale,stars }: { locale: any; CTALocale: any;stars:number }) => {
return (
<>
<motion.div
Expand All @@ -30,7 +30,7 @@ const Hero = ({ locale, CTALocale }: { locale: any; CTALocale: any }) => {
</p>
</section>
</motion.div>
<CTAButton locale={CTALocale}></CTAButton>
<CTAButton locale={CTALocale} stars={stars} />
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion projects/fastgpt/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const siteConfig: SiteConfig = {
card: "summary_large_image",
title: baseSiteConfig.name,
description: baseSiteConfig.description,
images: [`${baseSiteConfig.url}/og.png`],
images: [`${baseSiteConfig.url}/og.png?${new Date().getTime()}`],
creator: baseSiteConfig.creator,
},
}
20 changes: 0 additions & 20 deletions projects/fastgpt/middleware.ts

This file was deleted.