diff --git a/sim/app/(landing)/github-stars.tsx b/sim/app/(landing)/github-stars.tsx new file mode 100644 index 000000000..7be7c2a3e --- /dev/null +++ b/sim/app/(landing)/github-stars.tsx @@ -0,0 +1,40 @@ +import { Star } from 'lucide-react' +import { GithubIcon } from '@/components/icons' + +async function getGitHubStars() { + const response = await fetch('https://api.github.com/repos/simstudioai/sim', { + headers: { + Accept: 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28', + }, + next: { revalidate: 3600 }, // Revalidate every hour + }) + + if (!response.ok) { + // Return 0 stars if API fails, we don't want to break the UI + return 0 + } + + const data = await response.json() + return data.stargazers_count +} + +export default async function GitHubStars() { + const stars = await getGitHubStars() + + return ( + + +
+ {stars} + +
+
+ ) +} diff --git a/sim/app/(landing)/landing.tsx b/sim/app/(landing)/landing.tsx index 0441d753e..1e391bea5 100644 --- a/sim/app/(landing)/landing.tsx +++ b/sim/app/(landing)/landing.tsx @@ -1,93 +1,14 @@ -'use client' - -import { Star } from 'lucide-react' -import { GithubIcon } from '@/components/icons' +import GitHubStars from './github-stars' import HeroWorkflowProvider from './hero-workflow' -import { useWindowSize } from './use-window-size' +import NavClient from './nav-client' import WaitlistForm from './waitlist-form' -const XIcon = () => ( - - - -) - -const DiscordIcon = () => ( - - - -) - export default function Landing() { - const { width } = useWindowSize() - const isMobile = width !== undefined && width < 640 - return (
- + + +
diff --git a/sim/app/(landing)/nav-client.tsx b/sim/app/(landing)/nav-client.tsx new file mode 100644 index 000000000..8dc4ea617 --- /dev/null +++ b/sim/app/(landing)/nav-client.tsx @@ -0,0 +1,75 @@ +'use client' + +import { useWindowSize } from './use-window-size' + +const XIcon = () => ( + + + +) + +const DiscordIcon = () => ( + + + +) + +export default function NavClient({ children }: { children: React.ReactNode }) { + const { width } = useWindowSize() + const isMobile = width !== undefined && width < 640 + + return ( + + ) +}