Skip to content

Commit

Permalink
New home (#77)
Browse files Browse the repository at this point in the history
* Update workflow to Preview home page (#51)

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Update preview workflow

Signed-off-by: Carson Yang <[email protected]>

* Add gh-rebot config

Signed-off-by: Carson Yang <[email protected]>

* new home

* feat: finish

* update images

* fix: next-ui-react version

* fix: ui

* add: inter modal

* fix video ui

* fix ui again again again ...

* delete inter modal

* fix: jump to default no lang

* update: chinese seo

* replace chinese link

* add google tag manager

* add domain detection

* feat: add baidu conversion tracking

* fix

* add police filing (#72)

* add comment (#73)

* feat(docker): add police filing env and update cloud domain (#74)

Add NEXT_PUBLIC_POLICE_FILING environment variable for police filing
requirements and update cloud domain from tryfastgpt.ai to fastgpt.cn.

- Add NEXT_PUBLIC_POLICE_FILING as both ARG and ENV
- Update cloud domain references in sed commands

Signed-off-by: Carson Yang <[email protected]>

* feat(ci): add police filing build arg to landing page workflow (#75)

Add NEXT_PUBLIC_POLICE_FILING environment variable as build argument in
fastgpt-home-image workflow for configuring police filing information on
the landing page.

Signed-off-by: Carson Yang <[email protected]>

* add baidu keywords (#76)

---------

Signed-off-by: Carson Yang <[email protected]>
Co-authored-by: Carson Yang <[email protected]>
Co-authored-by: heavenmei <[email protected]>
Co-authored-by: heheer <[email protected]>
  • Loading branch information
4 people authored Nov 14, 2024
1 parent 0e27ee5 commit 86fe580
Show file tree
Hide file tree
Showing 68 changed files with 3,195 additions and 1,738 deletions.
30 changes: 30 additions & 0 deletions .github/gh-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: v1
debug: true
action:
printConfig: false
release:
retry: 15s
actionName: Release
allowOps:
- yangchuansheng
bot:
prefix: /
spe: _
allowOps:
- sealos-ci-robot
- sealos-release-robot
email: [email protected]
username: sealos-ci-robot
repo:
org: false

message:
success: |
🤖 says: Hooray! The action {{.Body}} has been completed successfully. 🎉
format_error: |
🤖 says: ‼️ There is a formatting issue with the action, kindly verify the action's format.
permission_error: |
🤖 says: ‼️ The action doesn't have permission to trigger.
release_error: |
🤖 says: ‼️ Release action failed.
Error details: {{.Error}}
1 change: 1 addition & 0 deletions .github/workflows/fastgpt-home-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
NEXT_PUBLIC_HOME_URL=${{ secrets.NEXT_PUBLIC_HOME_URL }}
NEXT_PUBLIC_USER_URL=${{ secrets.NEXT_PUBLIC_USER_URL }}
NEXT_PUBLIC_FILING_ADDRESS=${{ secrets.NEXT_PUBLIC_FILING_ADDRESS }}
NEXT_PUBLIC_POLICE_FILING=${{ secrets.NEXT_PUBLIC_POLICE_FILING }}
outputs:
tags: ${{ steps.datetime.outputs.datetime }}
Expand Down
57 changes: 45 additions & 12 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: github pages
name: Preview Home Page

on:
workflow_dispatch:
pull_request_target:
paths:
- "projects/fastgpt/**"
branches:
- "new-home"
- "main"

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
Expand All @@ -22,27 +23,59 @@ jobs:
deployments: write
pull-requests: write
runs-on: ubuntu-latest

# Job outputs
outputs:
url: ${{ steps.deploy.outputs.deployment-url }}

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node_version: 20
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: recursive # Fetch submodules
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
- name: Build
env:
NEXT_PUBLIC_HOME_URL: https://tryfastgpt.ai
NEXT_PUBLIC_USER_URL: https://cloud.fastgpt.in
NEXT_PUBLIC_USER_URL: https://cloud.tryfastgpt.ai
run: |
cd projects/fastgpt
npm install
npm run build
- name: Deploy to Cloudflare Pages
uses: andykenward/[email protected]
id: pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ./projects/fastgpt/out --project-name=fastgpt-home-run

docsOutput:
needs: [ deploy ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare-account-id: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
cloudflare-project-name: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
directory: ./projects/fastgpt/out
github-token: ${{ secrets.GH_PAT }}
github-environment: ${{ vars.CLOUDFLARE_PROJECT_NAME }} ${{ (github.ref == 'refs/heads/main' && '(Production)') || '(Preview)' }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Write md
run: |
echo "# 📘 Preview FastGPT homepage" > report.md
echo "[👀 Visit Preview](${{ needs.deploy.outputs.url }})" >> report.md
cat report.md
- name: Print preview url
uses: labring/[email protected]
if: ${{ (github.event_name == 'pull_request_target') }}
with:
version: v0.0.6
env:
GH_TOKEN: "${{ secrets.GH_PAT }}"
SEALOS_TYPE: "pr_comment"
SEALOS_FILENAME: "report.md"
SEALOS_REPLACE_TAG: "DEFAULT_REPLACE_DEPLOY"
7 changes: 6 additions & 1 deletion projects/fastgpt/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ NEXT_PUBLIC_BAIDU_TONGJI=
NEXT_PUBLIC_GOOGLE_ID=

NEXT_PUBLIC_HOME_URL=
NEXT_PUBLIC_USER_URL=
NEXT_PUBLIC_USER_URL=

# 备案号
NEXT_PUBLIC_FILING_ADDRESS=
# 公安备案号
NEXT_PUBLIC_POLICE_FILING=
5 changes: 4 additions & 1 deletion projects/fastgpt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ ARG NEXT_PUBLIC_BAIDU_KEY
ARG NEXT_PUBLIC_HOME_URL
ARG NEXT_PUBLIC_USER_URL
ARG NEXT_PUBLIC_FILING_ADDRESS
ARG NEXT_PUBLIC_POLICE_FILING

ENV NEXT_PUBLIC_BAIDU_TONGJI=$NEXT_PUBLIC_BAIDU_TONGJI
ENV NEXT_PUBLIC_BAIDU_KEY=$NEXT_PUBLIC_BAIDU_KEY
ENV NEXT_PUBLIC_HOME_URL=$NEXT_PUBLIC_HOME_URL
ENV NEXT_PUBLIC_USER_URL=$NEXT_PUBLIC_USER_URL
ENV NEXT_PUBLIC_FILING_ADDRESS=$NEXT_PUBLIC_FILING_ADDRESS
ENV NEXT_PUBLIC_POLICE_FILING=$NEXT_PUBLIC_POLICE_FILING

# copy packages and one project
ADD . ./


RUN sed -i "s#https://doc.fastgpt.in#https://doc.fastgpt.cn#g" $(grep -rl "https://doc.fastgpt.in" ./)
RUN sed -i "s#https://doc.tryfastgpt.ai#https://doc.fastgpt.cn#g" $(grep -rl "https://doc.tryfastgpt.ai" ./)
RUN sed -i "s#https://cloud.tryfastgpt.ai#https://cloud.fastgpt.cn#g" $(grep -rl "https://cloud.tryfastgpt.ai" ./)
RUN sed -i "s/defaultLocale = \"en\"/defaultLocale = \"zh\"/g" lib/i18n.ts

RUN npm install
Expand All @@ -35,4 +38,4 @@ FROM fholzer/nginx-brotli:latest
LABEL org.opencontainers.image.source https://github.com/labring/fastgpt-home

COPY --from=builder /app/out /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
49 changes: 30 additions & 19 deletions projects/fastgpt/app/[[...lang]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import CTA from '@/components/home/CTA';
import FAQ from '@/components/home/FAQ';
import Feature from '@/components/home/Feature';
import Hero from '@/components/home/Hero';
import Pricing from '@/components/home/Pricing';
import SocialProof from '@/components/home/SocialProof';
// import SocialProof from '@/components/home/SocialProof';
import VideoPlayer from '@/components/home/Video';
import { siteConfig, siteConfigZh } from '@/config/site';
import { defaultLocale, getDictionary, localeNames } from '@/lib/i18n';
import { SiteConfig } from '@/types/siteConfig';

export default async function LangHome({ params: { lang } }: { params: { lang?: string[] } }) {
let langName = lang && lang[0] && lang[0] !== 'index' ? lang[0] : defaultLocale;
Expand All @@ -21,32 +22,35 @@ export default async function LangHome({ params: { lang } }: { params: { lang?:
if (stargazers_count) {
stars = stargazers_count;
}
} catch (error) {}
} catch (error) { }

return (
<>
<Header dict={dict} />
<main className="flex flex-col items-center py-6">
{/* Hero Section */}
<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 />*/}
<VideoPlayer dict={dict} />
<main className="flex flex-col items-center mt-12 sm:mt-14 lg:mt-20 ">
<div className='mx-4 sm:mx-6 md:mx-12 xl:mx-[60px] 2xl:max-w-7xl 2xl:mx-auto flex flex-col items-center'>
{/* Hero Section */}
<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 />*/}
<VideoPlayer dict={dict} />

<Ability id="Ability" locale={dict.Ability} langName={langName} />
<Ability id="Ability" locale={dict.Ability} langName={langName} />

{/* USP (Unique Selling Proposition) */}
<Feature id="Features" locale={dict.Feature} langName={langName} />
{/* USP (Unique Selling Proposition) */}
<Feature id="Features" locale={dict.Feature} langName={langName} />

{/* Pricing */}
<Pricing id="Pricing" locale={dict.Pricing} langName={langName} />
{/* Pricing */}
{/* <Pricing id="Pricing" locale={dict.Pricing} langName={langName} /> */}

{/* FAQ (Frequently Asked Questions) */}
<FAQ id="FAQ" locale={dict.FAQ} langName={langName} />
{/* FAQ (Frequently Asked Questions) */}
<FAQ id="FAQ" locale={dict.FAQ} langName={langName} />

{/* CTA (Call to Action) */}
<CTA locale={dict.CTA} CTALocale={dict.CTAButton} stars={stars} />
{/* CTA (Call to Action) Footer */}
<CTA locale={dict.CTA} CTALocale={dict.CTAButton} stars={stars} />
</div>
{/* <InterModal locale={dict.InterModal} /> */}
</main>
</>
);
Expand All @@ -56,3 +60,10 @@ export async function generateStaticParams() {
const keys = Object.keys(localeNames).map((lang) => ({ lang: [lang] }));
return [{ lang: [''] }, ...keys];
}

export async function generateMetadata(
{ params: { lang } }: { params: { lang?: string[] } }
): Promise<SiteConfig> {
let langName = lang && lang[0] && lang[0] !== 'index' ? lang[0] : defaultLocale;
return langName === 'zh' ? siteConfigZh : siteConfig;
}
34 changes: 30 additions & 4 deletions projects/fastgpt/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BaiDuAnalytics from '@/app/BaiDuAnalytics';
import GoogleAnalytics from '@/app/GoogleAnalytics';
import { TailwindIndicator } from '@/components/TailwindIndicator';
import { ThemeProvider } from '@/components/ThemeProvider';
import Footer from '@/components/footer/Footer';
import { siteConfig } from '@/config/site';
import { defaultLocale } from '@/lib/i18n';
import { cn } from '@/lib/utils';
Expand All @@ -12,6 +11,7 @@ import '@/styles/plyr.css';
import { Analytics } from '@vercel/analytics/react';
import { Viewport } from 'next';
import { Inter as FontSans } from 'next/font/google';
import Script from 'next/script';

const fontSans = FontSans({
subsets: ['latin'],
Expand Down Expand Up @@ -45,13 +45,39 @@ export default async function RootLayout({
children: React.ReactNode;
params: { lang: string[] | undefined };
}) {
const isChineseDomain = process.env.NEXT_PUBLIC_USER_URL?.includes('.cn') || process.env.NEXT_PUBLIC_USER_URL?.includes('.run');

return (
<html lang={(lang && lang[0]) || defaultLocale} suppressHydrationWarning>
<head />
<body className={cn('min-h-screen bg-background font-sans antialiased', fontSans.variable)}>
<head>
{!isChineseDomain && (
<Script
id="gtm-script"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W9HPZZ22');`
}}
/>
)}
</head>
<body className={cn('min-h-screen font-sans antialiased', fontSans.variable)}>
{!isChineseDomain && (
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-W9HPZZ22"
height="0"
width="0"
style={{display: 'none', visibility: 'hidden'}}
></iframe>
</noscript>
)}
<ThemeProvider attribute="class" defaultTheme={siteConfig.nextThemeColor} enableSystem>
{children}
<Footer />
{/* <Footer /> */}
<Analytics />
<TailwindIndicator />
</ThemeProvider>
Expand Down
5 changes: 4 additions & 1 deletion projects/fastgpt/components/ThemedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ export function ThemedButton() {
setIsClient(typeof window !== "undefined");
}, []);
return (
<div onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
<div onClick={() => setTheme(theme === "light" ? "dark" : "light")} className="flex gap-4 font-medium p-1 hover:bg-white/10 cursor-pointer rounded-md">
{theme === "light" && isClient ? <PhMoonFill /> : <PhSunBold />}
<div className="md:hidden">
{theme === "light" && isClient ? "Night Mode" : "Light Mode"}
</div>
</div>
);
}
Expand Down
Loading

0 comments on commit 86fe580

Please sign in to comment.